diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-18 11:28:17 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-24 16:26:20 +0200 |
commit | 1735c825726edaa0af5035cb6cbb0cc0db502c6d (patch) | |
tree | 7bbb442f2cb4d7be58a4e08d87f5974403a3047c /server/initializers/migrator.ts | |
parent | e8bafea35bc930cb8ac5b2d521a188642a1adffe (diff) | |
download | PeerTube-1735c825726edaa0af5035cb6cbb0cc0db502c6d.tar.gz PeerTube-1735c825726edaa0af5035cb6cbb0cc0db502c6d.tar.zst PeerTube-1735c825726edaa0af5035cb6cbb0cc0db502c6d.zip |
Update sequelize
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 | } |