Skip to content
This repository has been archived by the owner on Nov 24, 2020. It is now read-only.
/ migrator Public archive

This package provides an opinionated set of commands that can be used for database migrations

License

Notifications You must be signed in to change notification settings

libero/migrator

Repository files navigation

Libero Migrations

This package provides an opinionated set of commands that can be used by the reviewer services for database migrations

Migration CLI script

Its recommended to create a cli script that imports the package.

import { Cli } from '@libero/migrator';
import Config from './config';

const cli = new Cli({
    banner: 'Libero Reviewer Acme Service: Migration tool',
    name: 'yarn migrate',
    knexConfig: Config.knex,
    migrations: {
        path: `${__dirname}/migrations`,
        pattern: /.*\.ts/,
    },
});

cli.exec();

The parameter is an object that specifies various options

Finally add the script to the package.json file:

{
    //...
    "scripts": {
        //...
        "migrate": "src/migrate.ts"
    }
}

Available commands

Run all migrations

yarn migrate run

Rollback one migration

yarn migrate rollback

Show pending and executed migrations

yarn migrate status

Show only pending migrations

yarn migrate status --pending

Show only executed migrations

yarn migrate status --executed

About

This package provides an opinionated set of commands that can be used for database migrations

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published