0.0.2 • Published 7 years ago

fl-migrations v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Migrations for backbone-orm

NPM version Build Status Coverage Status License

fl-migrations is an implementation of migrations for backbone-orm

Install

npm install fl-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 'fl-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()

Tests

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

7 years ago

0.0.1

7 years ago