1.0.10 • Published 5 years ago

umzug-typescript-helper v1.0.10

Weekly downloads
36
License
Unlicense
Repository
github
Last release
5 years ago

Build Status

umzug-typescript-helper

A micro library helping using TypeScript in your umzug migrations.

npm.io

Why?

umzug may run JS scripts only. Thus, in order to run a TypeScript migration you will have to compile all the migrations before umzug may run this.

This little library makes things a bit easier. All you need is just 1 TypeScript file that acts as an entry point for your migration. Something like this:

import * as migrations from './migrations';
import { migrate } from 'umzug-typescript-helper';

const umzugOptions = {
    // your umzug config, see https://github.com/sequelize/umzug for more info
};

migrate(migrations, umzugOptions).catch((err: any) => {
    console.error(err);
    process.exit(1);
});

And then your migrations go like this (e.g. in src/migrations/index.ts):

export function _20180902_initial() {
    return Promise.resolve("The migration ran successfully!");
}

Then you just compile (or/and bundle) everything and just run the migrations entrypoint script.

See this link for the complete example.

Check out this article for more details: How to migrate DBs with NodeJS and TypeScript

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.1.0

6 years ago