mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
31 lines
888 B
TypeScript
31 lines
888 B
TypeScript
import BaseModel from '../BaseModel';
|
|
import migration42 from '../migrations/42';
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
|
const migrationScripts: Record<number, any> = {
|
|
20: require('../migrations/20.js'),
|
|
27: require('../migrations/27.js'),
|
|
33: require('../migrations/33.js'),
|
|
35: require('../migrations/35.js'),
|
|
42: migration42,
|
|
};
|
|
|
|
export default class Migration extends BaseModel {
|
|
public static tableName() {
|
|
return 'migrations';
|
|
}
|
|
|
|
public static modelType() {
|
|
return BaseModel.TYPE_MIGRATION;
|
|
}
|
|
|
|
public static migrationsToDo() {
|
|
return this.modelSelectAll('SELECT * FROM migrations ORDER BY number ASC');
|
|
}
|
|
|
|
public static script(number: number) {
|
|
if (!migrationScripts[number]) throw new Error('Migration script has not been added to "migrationScripts" array');
|
|
return migrationScripts[number];
|
|
}
|
|
}
|