diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-15 11:25:53 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:52 +0100 |
commit | 59c857da5961e2bcddcfd07832783c1e4afcd01a (patch) | |
tree | 899998038c38fdf6a6238945a0fbc79181d5cea0 /server/initializers/database.ts | |
parent | 608624252466acf9f1d9ee1c1170bd4fe4d18d18 (diff) | |
download | PeerTube-59c857da5961e2bcddcfd07832783c1e4afcd01a.tar.gz PeerTube-59c857da5961e2bcddcfd07832783c1e4afcd01a.tar.zst PeerTube-59c857da5961e2bcddcfd07832783c1e4afcd01a.zip |
Fix error when creating a fresh database
Diffstat (limited to 'server/initializers/database.ts')
-rw-r--r-- | server/initializers/database.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/server/initializers/database.ts b/server/initializers/database.ts index 19b5a0466..0a716e4fb 100644 --- a/server/initializers/database.ts +++ b/server/initializers/database.ts | |||
@@ -89,7 +89,12 @@ database.init = async (silent: boolean) => { | |||
89 | 89 | ||
90 | for (const modelName of Object.keys(database)) { | 90 | for (const modelName of Object.keys(database)) { |
91 | if ('associate' in database[modelName]) { | 91 | if ('associate' in database[modelName]) { |
92 | database[modelName].associate(database) | 92 | try { |
93 | database[modelName].associate(database) | ||
94 | } catch (err) { | ||
95 | logger.error('Cannot associate model %s.', modelName, err) | ||
96 | process.exit(0) | ||
97 | } | ||
93 | } | 98 | } |
94 | } | 99 | } |
95 | 100 | ||