blakus/apps/blakus-api/migrations/20250304134127_initial.js
Broks Randolfs Gailītis 6d03f32009 Initial db config
Plus add cert creation for local development
2025-03-05 21:47:09 +02:00

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');
};