2.1.1 • Published 7 years ago

exodusjs v2.1.1

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

exodus.js

Simple postgres database migrations

Install

$ npm i -D exodusjs # short for npm install --save-dev exodusjs

How Do I Use It?

$ export DATABASE_URL=postgres://postgres:@localhost:5432/database
$ exodus create add-events-table # this creates a migrations/ folder in the current directory along with a new migration file!
$ exodus migrate
$ [EXODUS] Running 1 migration
$ [EXODUS] Ran migration 20150811090001-add-events-table
$ [EXODUS] Finished
$ exodus rollback
$ [EXODUS] Rolling back 1 migration
$ [EXODUS] Rolling back migration 20150811090001-add-events-table
$ [EXODUS] Finished

What Does A Migration Look Like?

// 20150811090001-add-events-table
var migration = {
  up: `
    your sql goes here
  `,
  down: `
    your sql goes here
  `
};

module.exports = migration;

A Real Migration

var migration = {
  up: `
    create table events (
      id bigserial primary key,
      data json,
      created_at timestamp without time zone default now()
    );
  `,
  down: `
    drop table events;
  `
};

module.exports = migration;

How Does It Work?

When you run exodus migrate for the first time, a migrations table is created in your database and it tracks which migrations have been run.

What's With The Name?

Migrations... exodus... they're synonyms. You get it.

2.1.1

7 years ago

2.0.4

8 years ago

2.0.3

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago