aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/database.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-23 09:50:57 +0200
committerChocobozzz <me@florianbigard.com>2019-04-24 16:26:21 +0200
commit3acc50844047a37698f0618fa235c138e386a053 (patch)
treee33243bf7fadbcf2df616fc41814245094fd881a /server/initializers/database.ts
parent1735c825726edaa0af5035cb6cbb0cc0db502c6d (diff)
downloadPeerTube-3acc50844047a37698f0618fa235c138e386a053.tar.gz
PeerTube-3acc50844047a37698f0618fa235c138e386a053.tar.zst
PeerTube-3acc50844047a37698f0618fa235c138e386a053.zip
Upgrade sequelize
Diffstat (limited to 'server/initializers/database.ts')
-rw-r--r--server/initializers/database.ts6
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
142async function checkPostgresExtension (extension: string) { 142async 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 })