0.1.2 • Published 4 years ago

migrations-engine v0.1.2

Weekly downloads
-
License
LGPL-3.0-only
Repository
-
Last release
4 years ago

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.