-function migrate () {
- const p = db.sequelize.getQueryInterface().showAllTables()
- .then(tables => {
- // No tables, we don't need to migrate anything
- // The installer will do that
- if (tables.length === 0) throw null
- })
- .then(() => {
- return db.Application.loadMigrationVersion()
- })
- .then(actualVersion => {
- if (actualVersion === null) {
- return db.Application.create({ migrationVersion: 0 }).then(() => 0)
- }