diff options
Diffstat (limited to 'server/initializers/migrator.ts')
-rw-r--r-- | server/initializers/migrator.ts | 8 |
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 @@ | |||
1 | import { waterfall, eachSeries } from 'async' | 1 | import { waterfall, eachSeries } from 'async' |
2 | import fs = require('fs') | 2 | import fs = require('fs') |
3 | import path = require('path') | 3 | import path = require('path') |
4 | import * as Sequelize from 'sequelize' | ||
4 | 5 | ||
5 | const db = require('./database') | 6 | import { database as db } from './database' |
6 | import { LAST_MIGRATION_VERSION } from './constants' | 7 | import { LAST_MIGRATION_VERSION } from './constants' |
7 | import { logger } from '../helpers' | 8 | import { logger } from '../helpers' |
9 | import { ApplicationInstance } from '../models' | ||
8 | 10 | ||
9 | function migrate (finalCallback) { | 11 | function migrate (finalCallback) { |
10 | waterfall([ | 12 | waterfall([ |
@@ -94,7 +96,7 @@ function getMigrationScripts (callback) { | |||
94 | } | 96 | } |
95 | 97 | ||
96 | function executeMigration (actualVersion, entity, callback) { | 98 | function 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) { |