26 lines
744 B
JavaScript
26 lines
744 B
JavaScript
/**
|
|
* @param { import("knex").Knex } knex
|
|
* @returns { Promise<void> }
|
|
*/
|
|
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<void> }
|
|
*/
|
|
exports.down = function(knex) {
|
|
return knex.schema.dropTable('users');
|
|
};
|