aboutsummaryrefslogtreecommitdiffhomepage
path: root/server.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-13 17:46:23 +0100
committerChocobozzz <me@florianbigard.com>2017-12-13 17:46:23 +0100
commit91fea9fc48a4ce53dd69e0e20f5804ad95a6c27d (patch)
tree1f227acea3e9684928dedbc070cc5fa6b3af42ee /server.ts
parent65b3ed25fc33c63ab2c56372c1a010541f8fddc2 (diff)
downloadPeerTube-91fea9fc48a4ce53dd69e0e20f5804ad95a6c27d.tar.gz
PeerTube-91fea9fc48a4ce53dd69e0e20f5804ad95a6c27d.tar.zst
PeerTube-91fea9fc48a4ce53dd69e0e20f5804ad95a6c27d.zip
Add migration
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, () => {