2019-05-11 18:55:40 +02:00
|
|
|
const BaseModel = require('lib/BaseModel.js');
|
|
|
|
|
|
|
|
const migrationScripts = {
|
|
|
|
20: require('lib/migrations/20.js'),
|
2019-12-29 19:58:40 +02:00
|
|
|
27: require('lib/migrations/27.js'),
|
2020-08-08 01:13:21 +02:00
|
|
|
33: require('lib/migrations/33.js'),
|
2019-05-11 18:55:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class Migration extends BaseModel {
|
|
|
|
static tableName() {
|
|
|
|
return 'migrations';
|
|
|
|
}
|
|
|
|
|
|
|
|
static modelType() {
|
|
|
|
return BaseModel.TYPE_MIGRATION;
|
|
|
|
}
|
|
|
|
|
|
|
|
static migrationsToDo() {
|
|
|
|
return this.modelSelectAll('SELECT * FROM migrations ORDER BY number ASC');
|
|
|
|
}
|
|
|
|
|
|
|
|
static script(number) {
|
2019-12-29 19:58:40 +02:00
|
|
|
if (!migrationScripts[number]) throw new Error('Migration script has not been added to "migrationScripts" array');
|
2019-05-11 18:55:40 +02:00
|
|
|
return migrationScripts[number];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-29 15:43:53 +02:00
|
|
|
module.exports = Migration;
|