exports.up = async (knex) => {
  // enable the WAL in sqlite3
  await knex.raw('PRAGMA journal_mode=WAL;');

  return knex.schema.createTable('user', (table) => {
    table.timestamps(true, true);
    table.increments('id');
    table.string('initials').notNullable();
    table.string('full_name').notNullable();
    table.string('password').notNullable();
    table.boolean('admin').defaultTo(false);
    table.string('email').notNullable().unique();
    table.index('email');
  });
};

exports.down = function(knex) {
  return knex.schema.dropTable('user');
};
