{"size": 1223, "ext": "js", "max_stars_repo_path": "db/migrations/20200806195904_rc3.js", "max_stars_repo_name": "BenHall-7/tidyhive-be", "max_stars_repo_stars_event_min_datetime": "2020-05-21T07:17:29.000Z", "max_stars_repo_stars_event_max_datetime": "2020-11-11T02:38:10.000Z", "max_issues_repo_path": "db/migrations/20200806195904_rc3.js", "max_issues_repo_name": "BenHall-7/tidyhive-be", "max_issues_repo_issues_event_min_datetime": "2020-02-20T06:02:49.000Z", "max_issues_repo_issues_event_max_datetime": "2020-08-24T22:30:01.000Z", "max_forks_repo_path": "db/migrations/20200806195904_rc3.js", "max_forks_repo_name": "BenHall-7/tidyhive-be", "max_forks_repo_forks_event_min_datetime": "2020-05-03T20:43:41.000Z", "max_forks_repo_forks_event_max_datetime": "2020-09-10T15:48:09.000Z"}
{"max_stars_count": 2, "max_issues_count": 8, "max_forks_count": 9, "avg_line_length": 26.0212765957, "max_line_length": 57, "alphanum_fraction": 0.5731807032}
exports.up = function (knex) {
  return knex.schema
    .alterTable('todo_categories', (table) => {
      table.dropColumn('category_name');

      table
        .integer('category_id')
        .notNullable()
        .references('category.id')
        .onDelete('CASCADE')
        .onUpdate('CASCADE');
    })
    .alterTable('category', (table) => {
      table.dropColumn('category_name');
      table
        .varchar('household_id')
        .notNullable()
        .references('households.id')
        .onDelete('CASCADE')
        .onUpdate('CASCADE');
    })
    .alterTable('category', (table) => {
      table.string('category_name').notNullable();
    });
};

exports.down = function (knex) {
  return knex.schema

    .alterTable('category', (table) => {
      table.dropColumn('category_name');
      table.dropColumn('household_id');
    })
    .alterTable('category', (table) => {
      table.text('category_name').unique().notNullable();
    })
    .alterTable('todo_categories', (table) => {
      table
        .text('category_name')
        .unsigned()
        .references('category.category_name')
        .onDelete('CASCADE')
        .onUpdate('CASCADE');
      table.dropColumn('category_id');
    });
};
