kunklejr/node-db-migrate — pull request #161 by nanodocumet (2014-03-24 06:09:52+00:00)
Title: Add multiple migration directories for up and down

Note: There are no tests at this point; I am having a lot of issues installing the dev dependencies. I have been using `npm install --dev db-migrate` and I get a lot of *"Error: ENOENT, lstat"* error messages.

As of now, db-migrate reads migration files from a single directory when doing ups/down. This commit adds the capability to include a set of directories, separated by commas, when doing ups/down. This way, you can have greater control of what migrations could run for different environments. Migrations are merged into a single list and sorted by timestamp.

Example:
migrations/1001-create-users-table
migrations/1040-create-logs-table
post_migrations/1005-create-groups-table

After running `db-migrate up -m migrations,post_migrations`, the above migrations will run in this order:
migrations/1001-create-users-table
post_migrations/1005-create-groups-table
migrations/1040-create-logs-table

Other example:
schema/1001-create-users-table
debug/1005-create-debugging-table

You might want to run the following commands depending on your environment:
- *Production*: `db-migrate up -m schema`
- *Development*: `db-migrate up -m schema,debug`

This commit adds an extra column, called `group`, to the *migrations* table. Eventually there will be a need to check if the column exists if this happens to be executed against an existing installation. This extra check will make the change backwards compatible. Let me know if you still want me to do this, should not be complicated. In my case, I am starting fresh, so, I don't need this change. The help text in db-migrate file in bin might need to be updated too.