{"size": 780, "ext": "js", "max_stars_repo_path": "app/data/bookshelf/migrations/00000000000000000.js", "max_stars_repo_name": "we-had-to/treat-yo-self", "max_stars_repo_stars_event_min_datetime": "2015-05-04T13:34:37.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-26T04:21:43.000Z", "max_issues_repo_path": "app/data/bookshelf/migrations/00000000000000000.js", "max_issues_repo_name": "we-had-to/treat-yo-self", "max_issues_repo_issues_event_min_datetime": "2015-05-21T17:21:59.000Z", "max_issues_repo_issues_event_max_datetime": "2017-10-24T08:19:55.000Z", "max_forks_repo_path": "app/data/bookshelf/migrations/00000000000000000.js", "max_forks_repo_name": "we-had-to/treat-yo-self", "max_forks_repo_forks_event_min_datetime": "2015-06-02T08:14:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-26T04:21:43.000Z"}
{"max_stars_count": 284, "max_issues_count": 20, "max_forks_count": 54, "avg_line_length": 28.8888888889, "max_line_length": 87, "alphanum_fraction": 0.6423076923}
/**
 * Naming convention for migration files is date, hours, minutes, seconds, milliseconds
 * 4+2+2+2+2+2+3 = 17 numbers e.g. 20150331211015325
 **/

export function up(knex, Promise) {
  return Promise.all([
    knex.schema.createTable('Thing', function (table) {
      table.bigIncrements('id').primary().unsigned();
      table.string('name', 50);
      table.biginteger('user_id').unsigned().index().references('id').inTable('User');
    }),
    knex.schema.createTable('User', function (table) {
      table.bigIncrements('id').primary().unsigned();
      table.string('name', 50);
      table.string('password', 255);
    })
  ]);
}

export function down(knex, Promise) {
  return Promise.all([
    knex.schema.dropTable('User'),
    knex.schema.dropTable('Thing')
  ]);
}
