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, 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'
3import { LAST_MIGRATION_VERSION } from './constants' 3import { LAST_MIGRATION_VERSION } from './constants'
4import { sequelizeTypescript } from './database' 4import { sequelizeTypescript } from './database'
5import { readdir } from 'fs-extra' 5import { readdir } from 'fs-extra'
6import { QueryTypes } from 'sequelize'
6 7
7async function migrate () { 8async 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 }