@universal-packages/core-typeorm

TypeORM universal-core module abstraction.


License
MIT
Install
npm install @universal-packages/core-typeorm@1.9.6

Documentation

Core Typeorm

npm version Testing codecov

Typeorm universal-core module abstraction.

Install

npm install @universal-packages/core-typeorm

Initialization

If no --type is provided it will default to postgres.

ucore initialize typeorm --typescript --type mysql

Global

Core expose DataSource as the global subject if core modulesAsGlobals config is true.

typeormSubject.manager.find()
core.coreModules.typeormModule.subject.manager.find()

Typeorm cli

To execute any of the Typeorm cli commands you can do it through the typeorm.

Instead of

npm run typeorm <command> <options>

Do

ucore exec typeorm <command> <options>

All commands will behave the same, except that the data source always will be set from the TypeormModule that gets the configuration through universal-core config system.

Additional cli

Crate DB

Creates the configured db using the right adapter. In non production environments it creates the analogous test dbs named your-development-db-name-<test>-<cpu-#>

ucore exec typeorm db:create

Drop DB

Drops the configured db using the right adapter. In non production environments it drops the analogous test dbs named your-development-db-name-<test>-<cpu-#>

ucore exec typeorm db:drop

Typescript

In order for typescript to see the global types you need to reference the types somewhere in your project, normally ./src/globals.d.ts.

/// <reference types="@universal-packages/core-typeorm" />

This library is developed in TypeScript and shipped fully typed.

Contributing

The development of this library happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving this library.

License

MIT licensed.