week5-node-express-knex-pg/db/migrations/20241021122628_create_subscribers_table.cjs

22 lines
586 B
JavaScript
Raw Permalink Normal View History

2024-10-21 17:09:40 +01:00
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.up = function (knex) {
return knex.schema.createTable("subscribers", (table) => {
table.increments("id");
table.string("firstname", 50).notNullable().defaultTo("");
table.string("lastname", 50).notNullable().defaultTo("");
table.string("email", 100).notNullable().defaultTo("");
table.timestamps(true, true);
});
};
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.down = function (knex) {
return knex.schema.dropTable("subscribers");
};