Typeorm universal-core module abstraction.
npm install @universal-packages/core-typeorm
If no --type
is provided it will default to postgres
.
ucore initialize typeorm --typescript --type mysql
Core expose DataSource
as the global subject if core modulesAsGlobals
config is true.
typeormSubject.manager.find()
core.coreModules.typeormModule.subject.manager.find()
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.
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
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
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.
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.