aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-03-04 10:40:09 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-03-04 10:40:09 +0100
commited708d62a677fc75311220739389dfe6b869cfad (patch)
treee69a3df8efcc6f36f505596186669ffc4dcebbd7 /server/initializers
parent4b4660582b370589f942bf74e2e682e47a9dfa0b (diff)
downloadPeerTube-ed708d62a677fc75311220739389dfe6b869cfad.tar.gz
PeerTube-ed708d62a677fc75311220739389dfe6b869cfad.tar.zst
PeerTube-ed708d62a677fc75311220739389dfe6b869cfad.zip
Server: fix migrations with an empty Applications table
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/migrator.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/server/initializers/migrator.js b/server/initializers/migrator.js
index 8c67903ad..0f25a23d1 100644
--- a/server/initializers/migrator.js
+++ b/server/initializers/migrator.js
@@ -32,6 +32,18 @@ function migrate (finalCallback) {
32 db.Application.loadMigrationVersion(callback) 32 db.Application.loadMigrationVersion(callback)
33 }, 33 },
34 34
35 function createMigrationRowIfNotExists (actualVersion, callback) {
36 if (actualVersion === null) {
37 db.Application.create({
38 migrationVersion: 0
39 }, function (err) {
40 return callabck(err, 0)
41 })
42 }
43
44 return callback(null, actualVersion)
45 },
46
35 function abortMigrationIfNotNeeded (actualVersion, callback) { 47 function abortMigrationIfNotNeeded (actualVersion, callback) {
36 // No need migrations 48 // No need migrations
37 if (actualVersion >= constants.LAST_MIGRATION_VERSION) return finalCallback(null) 49 if (actualVersion >= constants.LAST_MIGRATION_VERSION) return finalCallback(null)