{"size": 1475, "ext": "js", "max_stars_repo_path": "server/knex/migrations/20191119112846_update_capcodes_oracle.js", "max_stars_repo_name": "DingosGotMyBaby/pagermon", "max_stars_repo_stars_event_min_datetime": "2019-01-22T18:16:32.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-26T01:32:13.000Z", "max_issues_repo_path": "server/knex/migrations/20191119112846_update_capcodes_oracle.js", "max_issues_repo_name": "DingosGotMyBaby/pagermon", "max_issues_repo_issues_event_min_datetime": "2019-01-13T01:57:33.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-21T21:58:12.000Z", "max_forks_repo_path": "server/knex/migrations/20191119112846_update_capcodes_oracle.js", "max_forks_repo_name": "DingosGotMyBaby/pagermon", "max_forks_repo_forks_event_min_datetime": "2019-02-27T02:06:49.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-08T17:23:29.000Z"}
{"max_stars_count": 124, "max_issues_count": 249, "max_forks_count": 75, "avg_line_length": 29.5, "max_line_length": 66, "alphanum_fraction": 0.5369491525}
var nconf = require('nconf');
var confFile = './config/config.json';
var dbtype = nconf.get('database:type');

exports.up = function(db, Promise) {
  if (dbtype == 'oracledb') {
    return db.schema.hasTable('capcodes').then(function(exists) {
      if (!exists) {
        return db.schema.createTable('capcodes', table => {
          table.charset('utf8');
          table.collate('utf8_general_ci');
          table.increments('id').primary().unique().notNullable();
          table.string('address', [255]).notNullable();
          table.string('alias', [1000]).notNullable();
          table.string('agency', [255]);
          table.string('icon', [255]);
          table.string('color', [255]);
          table.text('pluginconf');
          table.integer('ignore').defaultTo(0);
          table.unique(['id', 'address'], 'cc_pk_idx');
        });
      } else {
        return db.schema.table('capcodes', table => {
          table.dropColumn('alias');
          table.dropColumn('agency');
          table.dropColumn('icon');
          table.dropColumn('color');
        }).then(function () {
          return db.schema.table('capcodes', table => {
            table.string('alias', [1000]);
            table.string('agency', [255]);
            table.string('icon', [255]);
            table.string('color', [255]);
          });
        });
      }
    })
  } else {
    return Promise.resolve('Not Required')
  }
}

exports.down = function(db, Promise) {
  
};




