diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-24 14:11:15 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-08-24 14:11:15 +0200 |
commit | 74055dc882e484b217f398917a3cc24bf2ea8cbe (patch) | |
tree | 905fa5d78258d699c3dac4b22769fd209bafd8bc /server/initializers/database.ts | |
parent | 8b6f0fd53d12faf54a58602a8bcfab05e8b5947b (diff) | |
download | PeerTube-74055dc882e484b217f398917a3cc24bf2ea8cbe.tar.gz PeerTube-74055dc882e484b217f398917a3cc24bf2ea8cbe.tar.zst PeerTube-74055dc882e484b217f398917a3cc24bf2ea8cbe.zip |
Fix tests
Diffstat (limited to 'server/initializers/database.ts')
-rw-r--r-- | server/initializers/database.ts | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/server/initializers/database.ts b/server/initializers/database.ts index e05e7c335..a20cdacc3 100644 --- a/server/initializers/database.ts +++ b/server/initializers/database.ts | |||
@@ -77,13 +77,15 @@ const sequelizeTypescript = new SequelizeTypescript({ | |||
77 | } | 77 | } |
78 | }) | 78 | }) |
79 | 79 | ||
80 | sequelizeTypescript.authenticate() | 80 | function checkDatabaseConnectionOrDie () { |
81 | .then(() => logger.debug('Connection to PostgreSQL has been established successfully.')) | 81 | sequelizeTypescript.authenticate() |
82 | .catch(err => { | 82 | .then(() => logger.debug('Connection to PostgreSQL has been established successfully.')) |
83 | 83 | .catch(err => { | |
84 | logger.error('Unable to connect to PostgreSQL database.', { err }) | 84 | |
85 | process.exit(-1) | 85 | logger.error('Unable to connect to PostgreSQL database.', { err }) |
86 | }) | 86 | process.exit(-1) |
87 | }) | ||
88 | } | ||
87 | 89 | ||
88 | async function initDatabaseModels (silent: boolean) { | 90 | async function initDatabaseModels (silent: boolean) { |
89 | sequelizeTypescript.addModels([ | 91 | sequelizeTypescript.addModels([ |
@@ -140,6 +142,7 @@ async function initDatabaseModels (silent: boolean) { | |||
140 | 142 | ||
141 | export { | 143 | export { |
142 | initDatabaseModels, | 144 | initDatabaseModels, |
145 | checkDatabaseConnectionOrDie, | ||
143 | sequelizeTypescript | 146 | sequelizeTypescript |
144 | } | 147 | } |
145 | 148 | ||