diff options
-rw-r--r-- | server/initializers/database.js | 2 | ||||
-rw-r--r-- | server/initializers/installer.js | 5 | ||||
-rw-r--r-- | server/initializers/migrations/0010-users-password.js | 9 |
3 files changed, 9 insertions, 7 deletions
diff --git a/server/initializers/database.js b/server/initializers/database.js index 1da574631..45c8a240d 100644 --- a/server/initializers/database.js +++ b/server/initializers/database.js | |||
@@ -7,9 +7,9 @@ const logger = require('../helpers/logger') | |||
7 | 7 | ||
8 | // Bootstrap models | 8 | // Bootstrap models |
9 | require('../models/application') | 9 | require('../models/application') |
10 | require('../models/oauth-token') | ||
10 | require('../models/user') | 11 | require('../models/user') |
11 | require('../models/oauth-client') | 12 | require('../models/oauth-client') |
12 | require('../models/oauth-token') | ||
13 | require('../models/pods') | 13 | require('../models/pods') |
14 | require('../models/video') | 14 | require('../models/video') |
15 | // Request model needs Video model | 15 | // Request model needs Video model |
diff --git a/server/initializers/installer.js b/server/initializers/installer.js index 974402094..8c3148e79 100644 --- a/server/initializers/installer.js +++ b/server/initializers/installer.js | |||
@@ -13,6 +13,7 @@ const constants = require('./constants') | |||
13 | const logger = require('../helpers/logger') | 13 | const logger = require('../helpers/logger') |
14 | const peertubeCrypto = require('../helpers/peertube-crypto') | 14 | const peertubeCrypto = require('../helpers/peertube-crypto') |
15 | 15 | ||
16 | const Application = mongoose.model('Application') | ||
16 | const Client = mongoose.model('OAuthClient') | 17 | const Client = mongoose.model('OAuthClient') |
17 | const User = mongoose.model('User') | 18 | const User = mongoose.model('User') |
18 | 19 | ||
@@ -117,7 +118,9 @@ function createOAuthAdminIfNotExist (callback) { | |||
117 | logger.info('Username: ' + username) | 118 | logger.info('Username: ' + username) |
118 | logger.info('User password: ' + password) | 119 | logger.info('User password: ' + password) |
119 | 120 | ||
120 | return callback(null) | 121 | logger.info('Creating Application collection.') |
122 | const application = new Application({ mongoSchemaVersion: constants.LAST_MONGO_SCHEMA_VERSION }) | ||
123 | application.save(callback) | ||
121 | }) | 124 | }) |
122 | }) | 125 | }) |
123 | } | 126 | } |
diff --git a/server/initializers/migrations/0010-users-password.js b/server/initializers/migrations/0010-users-password.js index e031fa142..a0616a269 100644 --- a/server/initializers/migrations/0010-users-password.js +++ b/server/initializers/migrations/0010-users-password.js | |||
@@ -2,6 +2,7 @@ | |||
2 | Convert plain user password to encrypted user password. | 2 | Convert plain user password to encrypted user password. |
3 | */ | 3 | */ |
4 | 4 | ||
5 | const eachSeries = require('async/eachSeries') | ||
5 | const mongoose = require('mongoose') | 6 | const mongoose = require('mongoose') |
6 | 7 | ||
7 | const User = mongoose.model('User') | 8 | const User = mongoose.model('User') |
@@ -10,11 +11,9 @@ exports.up = function (callback) { | |||
10 | User.list(function (err, users) { | 11 | User.list(function (err, users) { |
11 | if (err) return callback(err) | 12 | if (err) return callback(err) |
12 | 13 | ||
13 | users.forEach(function (user) { | 14 | eachSeries(users, function (user, callbackEach) { |
14 | user.save() | 15 | user.save(callbackEach) |
15 | }) | 16 | }, callback) |
16 | |||
17 | return callback(null) | ||
18 | }) | 17 | }) |
19 | } | 18 | } |
20 | 19 | ||