You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-26 22:41:17 +02:00
Converted models and services to TypeScript
This commit is contained in:
26
packages/lib/models/Migration.ts
Normal file
26
packages/lib/models/Migration.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import BaseModel from '../BaseModel';
|
||||
|
||||
const migrationScripts: Record<number, any> = {
|
||||
20: require('../migrations/20.js'),
|
||||
27: require('../migrations/27.js'),
|
||||
33: require('../migrations/33.js'),
|
||||
};
|
||||
|
||||
export default 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: number) {
|
||||
if (!migrationScripts[number]) throw new Error('Migration script has not been added to "migrationScripts" array');
|
||||
return migrationScripts[number];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user