Skip to content

Instantly share code, notes, and snippets.

@the-vampiire
Created January 30, 2020 03:54
Show Gist options
  • Save the-vampiire/639b95575eb62749899c7f4c7b42e554 to your computer and use it in GitHub Desktop.
Save the-vampiire/639b95575eb62749899c7f4c7b42e554 to your computer and use it in GitHub Desktop.
knex-stub-sample
/* eslint func-names:0 */
exports.up = function (knex) {
return knex.schema.createTable("", (table) => {
table.increments();
table
.integer("") // foreign_key_name
.unsigned()
.notNullable()
.references("") // table.primary_key_name
.onDelete("CASCADE"); // RESTRICT, CASCADE, SET NULL, NO ACTION
table.timestamps(true, true);
});
};
exports.down = function (knex) {
return knex.schema.dropTable("");
};
// exports.config = { transaction: false };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment