import {Model} from './Model'; export interface IMigration { id?: number; uuid: string; applied: boolean; } export class Migration extends Model implements IMigration { id?: number; uuid: string; applied: boolean; public static getTableName() { return 'migrations'; } public static getSchema() { return '++id, uuid, applied'; } constructor(uuid: string, applied: boolean, id?: number) { super(); this.uuid = uuid; this.applied = applied; if ( id ) { this.id = id; } } public getSaveRecord(): any { return { ...(this.id ? { id: this.id } : {}), uuid: this.uuid, applied: this.applied, }; } public getDatabase(): Dexie.Table { return this.staticClass().dbService.table('migrations') as Dexie.Table; } }