1 import { Transaction } from 'sequelize'
2 import { AllowNull, Column, Default, IsInt, Model, Table } from 'sequelize-typescript'
5 tableName: 'application'
7 export class ApplicationModel extends Model<ApplicationModel> {
13 migrationVersion: number
15 static countTotal () {
16 return ApplicationModel.count()
19 static loadMigrationVersion () {
21 attributes: [ 'migrationVersion' ]
24 return ApplicationModel.findOne(query).then(data => data ? data.migrationVersion : null)
27 static updateMigrationVersion (newVersion: number, transaction: Transaction) {
30 transaction: transaction
33 return ApplicationModel.update({ migrationVersion: newVersion }, options)