36 lines
857 B
JavaScript
36 lines
857 B
JavaScript
/**
|
|
* @param { import("knex").Knex } knex
|
|
* @returns { Promise<void> }
|
|
*/
|
|
exports.up = function(knex) {
|
|
|
|
return knex.schema
|
|
.createTable('users', function (table) {
|
|
table.uuid('id')
|
|
.primary()
|
|
.defaultTo(knex.raw(`gen_random_uuid()`));
|
|
table.string('first_name', 255)
|
|
.notNullable();
|
|
table.string('last_name', 255)
|
|
.notNullable();
|
|
table.string('email', 255)
|
|
.unique()
|
|
.notNullable();
|
|
})
|
|
// .createTable('products', function (table) {
|
|
// table.increments('id');
|
|
// table.decimal('price').notNullable();
|
|
// table.string('name', 1000).notNullable();
|
|
// });
|
|
};
|
|
|
|
/**
|
|
* @param { import("knex").Knex } knex
|
|
* @returns { Promise<void> }
|
|
*/
|
|
exports.down = function(knex) {
|
|
return knex.schema
|
|
// .dropTable('products')
|
|
.dropTable('users');
|
|
};
|