Core Typeorm
Typeorm universal-core module abstraction.
Install
npm install @universal-packages/core-typeormInitialization
If no --type is provided it will default to postgres.
ucore initialize typeorm --typescript --type mysqlGlobal
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:createDrop 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:dropTypescript
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.