diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-13 17:46:23 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-13 17:46:23 +0100 |
commit | 91fea9fc48a4ce53dd69e0e20f5804ad95a6c27d (patch) | |
tree | 1f227acea3e9684928dedbc070cc5fa6b3af42ee /server.ts | |
parent | 65b3ed25fc33c63ab2c56372c1a010541f8fddc2 (diff) | |
download | PeerTube-91fea9fc48a4ce53dd69e0e20f5804ad95a6c27d.tar.gz PeerTube-91fea9fc48a4ce53dd69e0e20f5804ad95a6c27d.tar.zst PeerTube-91fea9fc48a4ce53dd69e0e20f5804ad95a6c27d.zip |
Add migration
Diffstat (limited to 'server.ts')
-rw-r--r-- | server.ts | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -40,12 +40,16 @@ if (errorMessage !== null) { | |||
40 | // ----------- Database ----------- | 40 | // ----------- Database ----------- |
41 | // Do not use barrels because we don't want to load all modules here (we need to initialize database first) | 41 | // Do not use barrels because we don't want to load all modules here (we need to initialize database first) |
42 | import { logger } from './server/helpers/logger' | 42 | import { logger } from './server/helpers/logger' |
43 | |||
43 | // Initialize database and models | 44 | // Initialize database and models |
44 | import { initDatabase } from './server/initializers/database' | 45 | import { initDatabaseModels } from './server/initializers/database' |
45 | initDatabase(false).then(() => onDatabaseInitDone()) | 46 | import { migrate } from './server/initializers/migrator' |
47 | migrate() | ||
48 | .then(() => initDatabaseModels(false)) | ||
49 | .then(() => onDatabaseInitDone()) | ||
46 | 50 | ||
47 | // ----------- PeerTube modules ----------- | 51 | // ----------- PeerTube modules ----------- |
48 | import { migrate, installApplication } from './server/initializers' | 52 | import { installApplication } from './server/initializers' |
49 | import { activitypubHttpJobScheduler, transcodingJobScheduler, VideosPreviewCache } from './server/lib' | 53 | import { activitypubHttpJobScheduler, transcodingJobScheduler, VideosPreviewCache } from './server/lib' |
50 | import { apiRouter, clientsRouter, staticRouter, servicesRouter, webfingerRouter, activityPubRouter } from './server/controllers' | 54 | import { apiRouter, clientsRouter, staticRouter, servicesRouter, webfingerRouter, activityPubRouter } from './server/controllers' |
51 | 55 | ||
@@ -154,9 +158,8 @@ app.use(function (err, req, res, next) { | |||
154 | 158 | ||
155 | function onDatabaseInitDone () { | 159 | function onDatabaseInitDone () { |
156 | const port = CONFIG.LISTEN.PORT | 160 | const port = CONFIG.LISTEN.PORT |
157 | // Run the migration scripts if needed | 161 | |
158 | migrate() | 162 | installApplication() |
159 | .then(() => installApplication()) | ||
160 | .then(() => { | 163 | .then(() => { |
161 | // ----------- Make the server listening ----------- | 164 | // ----------- Make the server listening ----------- |
162 | server.listen(port, () => { | 165 | server.listen(port, () => { |