Skip to content

Instantly share code, notes, and snippets.

@wlaurance
Created April 15, 2014 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wlaurance/10756584 to your computer and use it in GitHub Desktop.
Save wlaurance/10756584 to your computer and use it in GitHub Desktop.
Users Table
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