1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-12 08:54:00 +02:00
joplin/packages/lib/models/Migration.js

29 lines
660 B
JavaScript
Raw Normal View History

2020-11-05 18:58:23 +02:00
const BaseModel = require('../BaseModel').default;
const migrationScripts = {
2020-11-05 18:58:23 +02:00
20: require('../migrations/20.js'),
27: require('../migrations/27.js'),
33: require('../migrations/33.js'),
};
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) {
if (!migrationScripts[number]) throw new Error('Migration script has not been added to "migrationScripts" array');
return migrationScripts[number];
}
}
2019-07-29 15:43:53 +02:00
module.exports = Migration;