diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-23 09:50:57 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-24 16:26:21 +0200 |
commit | 3acc50844047a37698f0618fa235c138e386a053 (patch) | |
tree | e33243bf7fadbcf2df616fc41814245094fd881a /server/initializers | |
parent | 1735c825726edaa0af5035cb6cbb0cc0db502c6d (diff) | |
download | PeerTube-3acc50844047a37698f0618fa235c138e386a053.tar.gz PeerTube-3acc50844047a37698f0618fa235c138e386a053.tar.zst PeerTube-3acc50844047a37698f0618fa235c138e386a053.zip |
Upgrade sequelize
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/database.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/server/initializers/database.ts b/server/initializers/database.ts index d1744d21f..d9a265e7a 100644 --- a/server/initializers/database.ts +++ b/server/initializers/database.ts | |||
@@ -140,15 +140,15 @@ async function checkPostgresExtensions () { | |||
140 | } | 140 | } |
141 | 141 | ||
142 | async function checkPostgresExtension (extension: string) { | 142 | async function checkPostgresExtension (extension: string) { |
143 | const query = `SELECT true AS enabled FROM pg_available_extensions WHERE name = '${extension}' AND installed_version IS NOT NULL;` | 143 | const query = `SELECT 1 FROM pg_available_extensions WHERE name = '${extension}' AND installed_version IS NOT NULL;` |
144 | const options = { | 144 | const options = { |
145 | type: QueryTypes.SELECT as QueryTypes.SELECT, | 145 | type: QueryTypes.SELECT as QueryTypes.SELECT, |
146 | raw: true | 146 | raw: true |
147 | } | 147 | } |
148 | 148 | ||
149 | const res = await sequelizeTypescript.query<{ enabled: boolean }>(query, options) | 149 | const res = await sequelizeTypescript.query<object>(query, options) |
150 | 150 | ||
151 | if (!res || res.length === 0 || res[ 0 ][ 'enabled' ] !== true) { | 151 | if (!res || res.length === 0) { |
152 | // Try to create the extension ourselves | 152 | // Try to create the extension ourselves |
153 | try { | 153 | try { |
154 | await sequelizeTypescript.query(`CREATE EXTENSION ${extension};`, { raw: true }) | 154 | await sequelizeTypescript.query(`CREATE EXTENSION ${extension};`, { raw: true }) |