Last active
June 11, 2018 21:25
-
-
Save ebectar/04c6762866d1569261e23973373f03a1 to your computer and use it in GitHub Desktop.
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
exports.up = function(knex, Promise) { | |
return knex.schema.createTable('tablename', function(table) { | |
// TABLE COLUMN DEFINITIONS HERE | |
table.increments() | |
table.string('colname1', 255).notNullable().defaultTo('') | |
table.string('colname2', 255).notNullable().defaultTo('') | |
table.string('colname3', 255).notNullable().defaultTo('') | |
table.timestamps(true, true) | |
// OR | |
// table.dateTime('created_at').notNullable().defaultTo(knex.raw('now()')) | |
// table.dateTime('updated_at').notNullable().defaultTo(knex.raw('now()')) | |
}) | |
} | |
exports.down = function(knex, Promise) { | |
return knex.schema.dropTableIfExists('tablename') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment