Created
April 15, 2014 18:34
-
-
Save wlaurance/10756882 to your computer and use it in GitHub Desktop.
projects table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dbm = require("db-migrate") | |
| type = dbm.dataType | |
| table = "projects" | |
| exports.up = (db, callback) -> | |
| sql = """ | |
| create table #{table}( | |
| "id" uuid PRIMARY KEY | |
| DEFAULT uuid_generate_v4(), | |
| "name" character varying NOT NULL, | |
| "createdDate" timestamptz NOT NULL | |
| ) | |
| """ | |
| db.runSql sql, callback | |
| exports.down = (db, callback) -> | |
| if process.env.DROP_TABLES | |
| db.dropTable table, callback | |
| else | |
| callback() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment