typeorm-storage-umzug
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

TypeORMStorage for Umzug

  • Use Umzug and TypeORM for database migrations using TypeORMStorage, instead of SequelizeStorage.
  • Heavily inspired by SequelizeStorage, I mostly mirrored it to TypeORM (with less features 😬).

How to use?

  • This snippet is from the example.
  1. Install dependencies using yarn add typeorm-storage-umzug or npm 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

  1. get rid of many .initalize .destroy.
  2. make package not depend on TypeORM or Umzug.
  3. revise .tsconfig I copied the one at nestjs.

Readme

Keywords

none

Package Sidebar

Install

npm i typeorm-storage-umzug

Weekly Downloads

12

Version

0.0.2

License

MIT

Unpacked Size

7.45 kB

Total Files

7

Last publish

Collaborators

  • g0maa