Skip to content

Instantly share code, notes, and snippets.

@wlaurance
Created April 15, 2014 18:34
Show Gist options
  • Select an option

  • Save wlaurance/10756882 to your computer and use it in GitHub Desktop.

Select an option

Save wlaurance/10756882 to your computer and use it in GitHub Desktop.
projects table
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