fire-migrate

0.3.1 • Public • Published

fire-migrate

CircleCI

fire-migrate is a tool to source control your migrations for firebase. It's the equivalent of liquibase for firebase.

fire-migrate verifies consecutive migrations and cross process locks.

To use call fireMigrate with the URL of your firebase application and an array of functions containing your firebase migrations. Each of the functions must call their first argument resolve() once the migration is complete.

fire-migrate matches the migrations by the name of the functions so if the name changes it will be reran.

npm install --save fire-migrate

Example:

var fireMigrate = require('fire-migrate');
var databaseRef = Firebase.initializeApp({
  apiKey: 'apiKey',
  authDomain: 'projectId.firebaseapp.com',
  databaseURL: 'https://example.firebaseio.com'
}).database().ref();

fireMigrate.migrate(databaseRef, [migration1, migration2]).then(() => {
  // continue with the rest of the application   
});

function migration1(resolve) {
  firebaseRef.push({
    //some data
  },resolve);
}

function migration2(resolve) {
  firebaseRef.push({
    //some data
  },resolve);
}

Package Sidebar

Install

npm i fire-migrate

Weekly Downloads

0

Version

0.3.1

License

ISC

Last publish

Collaborators

  • oriarditi