- Use
UmzugandTypeORMfor database migrations usingTypeORMStorage, instead ofSequelizeStorage. - Heavily inspired by SequelizeStorage, I mostly mirrored it to
TypeORM(with less features 😬).
- This snippet is from the example.
- Install dependencies using
yarn add typeorm-storage-umzugornpm 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;- get rid of many
.initalize.destroy. - make package not depend on
TypeORMorUmzug. - revise
.tsconfigI copied the one atnestjs.