npm.io
0.1.2 • Published 6 years ago

migrations-engine

Licence
LGPL-3.0-only
Version
0.1.2
Deps
0
Size
15 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

migrations-engine npm travis

Simple library to manage database migrations in-memory:

  • migration must have a name
  • migrations are applied in order, by name (using String.localeCompare to order)
npm i migrations-engine --save
import { up, down } from 'migrations-engine';

const all = [
  // these are all available migrations
  {
    name: 'A',
  },
  {
    name: 'B',
  },
];

const applied = [
  // these are all applied migrations so far
  {
    name: 'A',
  },
];

const migrationsToApply = up(applied, all); // [{ name: 'B' }]

// apply migrations

The storage and applying of migrations is up to you.