aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrator.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers/migrator.ts')
-rw-r--r--server/initializers/migrator.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/server/initializers/migrator.ts b/server/initializers/migrator.ts
index cfa3220e0..d42cb3ccc 100644
--- a/server/initializers/migrator.ts
+++ b/server/initializers/migrator.ts
@@ -1,10 +1,12 @@
1import { waterfall, eachSeries } from 'async' 1import { waterfall, eachSeries } from 'async'
2import fs = require('fs') 2import fs = require('fs')
3import path = require('path') 3import path = require('path')
4import * as Sequelize from 'sequelize'
4 5
5const db = require('./database') 6import { database as db } from './database'
6import { LAST_MIGRATION_VERSION } from './constants' 7import { LAST_MIGRATION_VERSION } from './constants'
7import { logger } from '../helpers' 8import { logger } from '../helpers'
9import { ApplicationInstance } from '../models'
8 10
9function migrate (finalCallback) { 11function migrate (finalCallback) {
10 waterfall([ 12 waterfall([
@@ -94,7 +96,7 @@ function getMigrationScripts (callback) {
94} 96}
95 97
96function executeMigration (actualVersion, entity, callback) { 98function executeMigration (actualVersion, entity, callback) {
97 const versionScript = parseInt(entity.version) 99 const versionScript = parseInt(entity.version, 10)
98 100
99 // Do not execute old migration scripts 101 // Do not execute old migration scripts
100 if (versionScript <= actualVersion) return callback(null) 102 if (versionScript <= actualVersion) return callback(null)
@@ -112,7 +114,7 @@ function executeMigration (actualVersion, entity, callback) {
112 transaction: t, 114 transaction: t,
113 queryInterface: db.sequelize.getQueryInterface(), 115 queryInterface: db.sequelize.getQueryInterface(),
114 sequelize: db.sequelize, 116 sequelize: db.sequelize,
115 Sequelize: db.Sequelize 117 Sequelize: Sequelize
116 } 118 }
117 migrationScript.up(options, function (err) { 119 migrationScript.up(options, function (err) {
118 if (err) { 120 if (err) {