typeorm-storage-umzug
v0.0.2
Published
Umzug's SequelizeStorage but for TypeORM.
Downloads
43
Readme
TypeORMStorage for Umzug
- Use
Umzug
andTypeORM
for database migrations usingTypeORMStorage
, instead ofSequelizeStorage
. - Heavily inspired by SequelizeStorage, I mostly mirrored it to
TypeORM
(with less features 😬).
How to use?
- This snippet is from the example.
- Install dependencies using
yarn add typeorm-storage-umzug
ornpm install typeorm-storage-umzug
.
import { Umzug } from 'umzug';
import { TypeORMStorage } from 'typeorm-storage-umzug';
import { DataSource } from 'typeorm';
const orm = new DataSource({
type: 'postgres',
/* remaining DataSource options ... */
});
export const migrator = new Umzug({
/* ... remaining Umzug options ... */
context: orm,
storage: new TypeORMStorage({
dataSource: orm,
tableName: 'migrator_meta',
}),
});
export type Migration = typeof migrator._types.migration;
TODOs
- get rid of many
.initalize
.destroy
. - make package not depend on
TypeORM
orUmzug
. - revise
.tsconfig
I copied the one atnestjs
.