<commit_before>
exports.up = knex =>
  knex.schema.createTable('user', (table) => {
    table.increments('id');
    table.string('username').unique().notNullable();
    table.string('name');
    table.boolean('is_admin');
    table.timestamp('created_at').defaultTo(knex.fn.now());
    table.index('username');
  })
  .createTable('password', (table) => {
    table.increments('id');
    table.integer('user_id').references('user.id').notNullable().onDelete('CASCADE');
    table.string('password_hash').notNullable();
    table.timestamp('updated_at').defaultTo(knex.fn.now());
    table.boolean('valid').defaultsTo(true);
  })
  .createTable('email', (table) => {
    table.increments('id');
    table.integer('user_id').references('user.id').notNullable().onDelete('CASCADE');
    table.string('address').unique().notNullable();
    table.boolean('verified').defaultsTo(false);
  })
  .createTable('role', (table) => {
    table.increments('id');
    table.string('name').unique().notNullable();
  })
  .createTable('user_role', (table) => {
    table.integer('user_id').references('user.id').notNullable();
    table.integer('role_id').references('role.id').notNullable();
  })
  .createTable('teamtype', (table) => {
    table.increments('id');
    table.string('name').notNullable();
    table.string('description').notNullable();
    table.boolean('initial_mature').notNullable();
    table.integer('initial_resources').notNullable();
    table.integer('initial_mindset').notNullable();
    table.boolean('disabled').defaultsTo(false);
  });

exports.down = (knex, Promise) =>
  Promise.all([
    knex.schema.dropTable('teamtype'),
    knex.schema.dropTable('password'),
    knex.schema.dropTable('email'),
    knex.schema.dropTable('user_role'),
    knex.schema.dropTable('role'),
    knex.schema.dropTable('user'),
  ]);<commit_msg>Require that teamtype name be unique<commit_after>
exports.up = knex =>
  knex.schema.createTable('user', (table) => {
    table.increments('id');
    table.string('username').unique().notNullable();
    table.string('name');
    table.boolean('is_admin');
    table.timestamp('created_at').defaultTo(knex.fn.now());
    table.index('username');
  })
  .createTable('password', (table) => {
    table.increments('id');
    table.integer('user_id').references('user.id').notNullable().onDelete('CASCADE');
    table.string('password_hash').notNullable();
    table.timestamp('updated_at').defaultTo(knex.fn.now());
    table.boolean('valid').defaultsTo(true);
  })
  .createTable('email', (table) => {
    table.increments('id');
    table.integer('user_id').references('user.id').notNullable().onDelete('CASCADE');
    table.string('address').unique().notNullable();
    table.boolean('verified').defaultsTo(false);
  })
  .createTable('role', (table) => {
    table.increments('id');
    table.string('name').unique().notNullable();
  })
  .createTable('user_role', (table) => {
    table.integer('user_id').references('user.id').notNullable();
    table.integer('role_id').references('role.id').notNullable();
  })
  .createTable('teamtype', (table) => {
    table.increments('id');
    table.string('name').unique().notNullable();
    table.string('description').notNullable();
    table.boolean('initial_mature').notNullable();
    table.integer('initial_resources').notNullable();
    table.integer('initial_mindset').notNullable();
    table.boolean('disabled').defaultsTo(false);
  });

exports.down = (knex, Promise) =>
  Promise.all([
    knex.schema.dropTable('teamtype'),
    knex.schema.dropTable('password'),
    knex.schema.dropTable('email'),
    knex.schema.dropTable('user_role'),
    knex.schema.dropTable('role'),
    knex.schema.dropTable('user'),
  ]);
{'fraction_non_alphanumeric': 0.21459343026386646, 'fraction_numerical': 0.0, 'mean_word_length': 4.868878357030016, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2957468', 'n_tokens_mistral': 1175, 'n_tokens_neox': 1160, 'n_words': 107}