{"size": 1521, "ext": "js", "max_stars_repo_path": "data/migrations/20201202194136_cases.js", "max_stars_repo_name": "Lambda-School-Labs/human-rights-first-asylum-be-b", "max_stars_repo_stars_event_min_datetime": "2021-01-28T16:08:26.000Z", "max_stars_repo_stars_event_max_datetime": "2021-01-28T16:08:26.000Z", "max_issues_repo_path": "data/migrations/20201202194136_cases.js", "max_issues_repo_name": "Lambda-School-Labs/human-rights-first-asylum-be-b", "max_issues_repo_issues_event_min_datetime": "2020-12-11T17:33:57.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-17T19:13:03.000Z", "max_forks_repo_path": "data/migrations/20201202194136_cases.js", "max_forks_repo_name": "Lambda-School-Labs/human-rights-first-asylum-be-b", "max_forks_repo_forks_event_min_datetime": "2021-01-14T16:45:48.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-04T16:09:50.000Z"}
{"max_stars_count": 1, "max_issues_count": 8, "max_forks_count": 4, "avg_line_length": 38.025, "max_line_length": 84, "alphanum_fraction": 0.6449704142}
exports.up = function (knex) {
  return knex.schema
    .raw('CREATE EXTENSION IF NOT EXISTS "uuid-ossp"')
    .createTable('cases', function (table) {
      table.string('case_id').notNullable().primary();
      table
        .string('user_id')
        .references('user_id')
        .inTable('profiles')
        .onDelete('RESTRICT');
      table.string('case_url');
      table.string('case_number');
      table.date('case_date');
      table
        .integer('judge_id')
        .references('judge_id')
        .inTable('judges')
        .onDelete('RESTRICT');
      table.string('case_outcome'); // TBD may be another table with outcome codes
      table.string('country_of_origin'); // TBD may be another table with countries
      table.string('protected_grounds');
      table.string('application_type'); // TBD may be another table with app types
      table.string('case_origin_city'); // TBD may be another table with cities
      table.string('case_origin_state'); // TBD may be another table with states
      table.string('gender'); // TBD may be another table with genders
      table.string('applicant_language'); // TBD may be another table with languages
      table.string('indigenous_group');
      table.string('type_of_violence');
      table.boolean('appellate');
      table.boolean('filed_in_one_year');
      table.boolean('credible');
      table.string('status');
      table.timestamps(false, true);
    });
};

exports.down = (knex) => {
  return knex.schema.dropTableIfExists('cases');
};
