Created
April 15, 2014 18:30
-
-
Save wlaurance/10756584 to your computer and use it in GitHub Desktop.
Users Table
This file contains 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 = "users" | |
exports.up = (db, callback) -> | |
sql = """ | |
create table #{table}( | |
"id" uuid PRIMARY KEY | |
DEFAULT uuid_generate_v4(), | |
"firstName" character varying NOT NULL, | |
"lastName" character varying NOT NULL, | |
"email" character varying NOT NULL UNIQUE, | |
"hash" character varying 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