diff options
Diffstat (limited to 'server/initializers/migrator.ts')
-rw-r--r-- | server/initializers/migrator.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/server/initializers/migrator.ts b/server/initializers/migrator.ts index adc2f9fb3..1cb0116b7 100644 --- a/server/initializers/migrator.ts +++ b/server/initializers/migrator.ts | |||
@@ -3,6 +3,7 @@ import { logger } from '../helpers/logger' | |||
3 | import { LAST_MIGRATION_VERSION } from './constants' | 3 | import { LAST_MIGRATION_VERSION } from './constants' |
4 | import { sequelizeTypescript } from './database' | 4 | import { sequelizeTypescript } from './database' |
5 | import { readdir } from 'fs-extra' | 5 | import { readdir } from 'fs-extra' |
6 | import { QueryTypes } from 'sequelize' | ||
6 | 7 | ||
7 | async function migrate () { | 8 | async function migrate () { |
8 | const tables = await sequelizeTypescript.getQueryInterface().showAllTables() | 9 | const tables = await sequelizeTypescript.getQueryInterface().showAllTables() |
@@ -13,7 +14,12 @@ async function migrate () { | |||
13 | 14 | ||
14 | let actualVersion: number | null = null | 15 | let actualVersion: number | null = null |
15 | 16 | ||
16 | const [ rows ] = await sequelizeTypescript.query('SELECT "migrationVersion" FROM "application"') | 17 | const query = 'SELECT "migrationVersion" FROM "application"' |
18 | const options = { | ||
19 | type: QueryTypes.SELECT as QueryTypes.SELECT | ||
20 | } | ||
21 | |||
22 | const rows = await sequelizeTypescript.query<{ migrationVersion: number }>(query, options) | ||
17 | if (rows && rows[0] && rows[0].migrationVersion) { | 23 | if (rows && rows[0] && rows[0].migrationVersion) { |
18 | actualVersion = rows[0].migrationVersion | 24 | actualVersion = rows[0].migrationVersion |
19 | } | 25 | } |