/** * @param { import("knex").Knex } knex * @returns { Promise } */ exports.up = function(knex) { return knex.schema.createTable('users', function(table) { table.increments('id').primary(); table.string('username').notNullable(); table.string('email').notNullable(); table.string('password').notNullable(); table.boolean('is_admin').defaultTo(false); table.boolean('is_active').defaultTo(true); table.text('api_key').nullable(); table.datetime('created').defaultTo(knex.fn.now()); table.datetime('modified').defaultTo(knex.fn.now()); }); }; /** * @param { import("knex").Knex } knex * @returns { Promise } */ exports.down = function(knex) { return knex.schema.dropTable('users'); };