aboutsummaryrefslogtreecommitdiffhomepage
path: root/server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server.ts')
-rw-r--r--server.ts15
1 files changed, 9 insertions, 6 deletions
diff --git a/server.ts b/server.ts
index 2e9ed31d2..a89cdd69a 100644
--- a/server.ts
+++ b/server.ts
@@ -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)
42import { logger } from './server/helpers/logger' 42import { logger } from './server/helpers/logger'
43
43// Initialize database and models 44// Initialize database and models
44import { initDatabase } from './server/initializers/database' 45import { initDatabaseModels } from './server/initializers/database'
45initDatabase(false).then(() => onDatabaseInitDone()) 46import { migrate } from './server/initializers/migrator'
47migrate()
48 .then(() => initDatabaseModels(false))
49 .then(() => onDatabaseInitDone())
46 50
47// ----------- PeerTube modules ----------- 51// ----------- PeerTube modules -----------
48import { migrate, installApplication } from './server/initializers' 52import { installApplication } from './server/initializers'
49import { activitypubHttpJobScheduler, transcodingJobScheduler, VideosPreviewCache } from './server/lib' 53import { activitypubHttpJobScheduler, transcodingJobScheduler, VideosPreviewCache } from './server/lib'
50import { apiRouter, clientsRouter, staticRouter, servicesRouter, webfingerRouter, activityPubRouter } from './server/controllers' 54import { apiRouter, clientsRouter, staticRouter, servicesRouter, webfingerRouter, activityPubRouter } from './server/controllers'
51 55
@@ -154,9 +158,8 @@ app.use(function (err, req, res, next) {
154 158
155function onDatabaseInitDone () { 159function 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, () => {