Git Product home page Git Product logo

chinook's Introduction

Chinook

A migration package based on node. Chinook is a type of salmon, a migratory fish.

Philosophy

The philosophy of chinook is that you should be close to your db -- this is manifest in several ways:

  • You can have migrations written in pure sql, you don't need to use a DSL.
  • chinook does not provide a DSL for migrations in node, feel free to bring your own though.

Installation

npm install -g chinook

running

chinook # just outputs a help message
chinook status # shows all migrations, and the state of the migrations
chinook init # sets up a migrations directory and a config file
chinook new name # create a new migration
chinook up [migrationid] # migrate up to migrationid, or the latest migration
chinook down [migrationid] # migrate down to migrationid, or the last migration
chinook reset # migrate down to before the earliest migration and remove
              # migration tracking table

DB support

Only supports postgres right now.

config file format

chinook.json is the config file for chinook. It should be in the directory where chinook will be invoked.

Some important keys:

  • migrations: the relative path of the migrations directory, "migrations" by default
  • table: the name of the table where migrations are stored. "migrations_complete" by default
  • connection: has a key for each environment (passed in via the NODE_ENV environmental variable, with "development" as the default if not specified) with one connection configuration per environment
    • Each connection configuration should be a string. If it starts with a $, it's interpreted as an environmental variable, that should contain a connection url, if it does not start with a $, it's interpreted as a connection url
    • Note that if nothing is specified for the current environment, chinook looks at the DATABASE_URL environment variable

migration format

Each migration is a directory with 2 files, up and down. They should be named up.js/down.js for migrations that use javascript, and up.sql/down.sql for migrations that are defined using sql. If there is a verify.sql or verify.js this will be run after the up migration and the migration will be rolled back if the verify script fails.

The name of each migration directory should be [some number]-text-and-possibly-more-dashes. The number is used to order the migrations so they can be numbered like 001, 002, etc or they can be numbered with the current unix time (which is what the chinook new command will generate).

chinook's People

Contributors

mpolun-mdsol avatar

Watchers

James Cloos avatar Max Polun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.