stein-orm-migrations

11.0.0 • Public • Published

Migrations for stein-orm

NPM version Build Status Coverage Status License

stein-orm-migrations is an implementation of migrations for stein-orm, forked from fl-migrations

Install

npm install stein-orm-migrations

Usage

Sample Migration File

// 00001_migration.js
import YourModel from './some_model_directory/YourModel'

module.exports = {
  up: (callback) => {
    const newModel = new YourModel({field1: 'someValue', field2: 'someOtherValue'})
    newModel.save(callback)
  },
}

Execute Migrations

import { Migrations } from 'stein-orm-migrations'

migrations = new Migrations({
  // required, the location of the migrations files
  path: './my_migrations_directory'

  // optional, the path to match migration files, defaults to '.js$'
  pattern: '.js$'
})

migrations.migrate()

Reset Migrations

migrations.reset()

Tests

eval $(cat .test_env) npm run create-db
eval $(cat .test_env) npm test

Readme

Keywords

Package Sidebar

Install

npm i stein-orm-migrations

Weekly Downloads

15

Version

11.0.0

License

MIT

Unpacked Size

28.1 kB

Total Files

19

Last publish

Collaborators

  • founderlab