aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/checker.js3
-rw-r--r--server/initializers/constants.js5
-rw-r--r--server/initializers/migrations/0005-email-pod.js20
-rw-r--r--server/initializers/migrations/0005-example.js14
-rw-r--r--server/initializers/migrator.js9
5 files changed, 33 insertions, 18 deletions
diff --git a/server/initializers/checker.js b/server/initializers/checker.js
index 6471bb4f1..7adbbb37a 100644
--- a/server/initializers/checker.js
+++ b/server/initializers/checker.js
@@ -28,7 +28,8 @@ function checkMissedConfig () {
28 const required = [ 'listen.port', 28 const required = [ 'listen.port',
29 'webserver.https', 'webserver.hostname', 'webserver.port', 29 'webserver.https', 'webserver.hostname', 'webserver.port',
30 'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password', 30 'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password',
31 'storage.certs', 'storage.videos', 'storage.logs', 'storage.thumbnails', 'storage.previews' 31 'storage.certs', 'storage.videos', 'storage.logs', 'storage.thumbnails', 'storage.previews',
32 'admin.email'
32 ] 33 ]
33 const miss = [] 34 const miss = []
34 35
diff --git a/server/initializers/constants.js b/server/initializers/constants.js
index ad7cf4f4d..eb0509efe 100644
--- a/server/initializers/constants.js
+++ b/server/initializers/constants.js
@@ -54,6 +54,9 @@ const CONFIG = {
54 WS: config.get('webserver.https') === true ? 'wss' : 'ws', 54 WS: config.get('webserver.https') === true ? 'wss' : 'ws',
55 HOSTNAME: config.get('webserver.hostname'), 55 HOSTNAME: config.get('webserver.hostname'),
56 PORT: config.get('webserver.port') 56 PORT: config.get('webserver.port')
57 },
58 ADMIN: {
59 EMAIL: config.get('admin.email')
57 } 60 }
58} 61}
59CONFIG.WEBSERVER.URL = CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT 62CONFIG.WEBSERVER.URL = CONFIG.WEBSERVER.SCHEME + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT
@@ -92,7 +95,7 @@ const FRIEND_SCORE = {
92 95
93// --------------------------------------------------------------------------- 96// ---------------------------------------------------------------------------
94 97
95const LAST_MIGRATION_VERSION = 0 98const LAST_MIGRATION_VERSION = 5
96 99
97// --------------------------------------------------------------------------- 100// ---------------------------------------------------------------------------
98 101
diff --git a/server/initializers/migrations/0005-email-pod.js b/server/initializers/migrations/0005-email-pod.js
new file mode 100644
index 000000000..d90b674a1
--- /dev/null
+++ b/server/initializers/migrations/0005-email-pod.js
@@ -0,0 +1,20 @@
1/*
2 This is just an example.
3*/
4
5// utils = { transaction, queryInterface }
6exports.up = function (utils, callback) {
7 const q = utils.queryInterface
8 const Sequelize = utils.Sequelize
9
10 const data = {
11 type: Sequelize.STRING(400),
12 allowNull: false
13 }
14
15 q.addColumn('Pods', 'email', data, { transaction: utils.transaction }).asCallback(callback)
16}
17
18exports.down = function (options, callback) {
19 throw new Error('Not implemented.')
20}
diff --git a/server/initializers/migrations/0005-example.js b/server/initializers/migrations/0005-example.js
deleted file mode 100644
index cedc42919..000000000
--- a/server/initializers/migrations/0005-example.js
+++ /dev/null
@@ -1,14 +0,0 @@
1// /*
2// This is just an example.
3// */
4
5// const db = require('../database')
6
7// // options contains the transaction
8// exports.up = function (options, callback) {
9// db.Application.create({ migrationVersion: 42 }, { transaction: options.transaction }).asCallback(callback)
10// }
11
12// exports.down = function (options, callback) {
13// throw new Error('Not implemented.')
14// }
diff --git a/server/initializers/migrator.js b/server/initializers/migrator.js
index e5288b615..233ee2bdd 100644
--- a/server/initializers/migrator.js
+++ b/server/initializers/migrator.js
@@ -64,7 +64,7 @@ function getMigrationScripts (callback) {
64} 64}
65 65
66function executeMigration (actualVersion, entity, callback) { 66function executeMigration (actualVersion, entity, callback) {
67 const versionScript = entity.version 67 const versionScript = parseInt(entity.version)
68 68
69 // Do not execute old migration scripts 69 // Do not execute old migration scripts
70 if (versionScript <= actualVersion) return callback(null) 70 if (versionScript <= actualVersion) return callback(null)
@@ -78,7 +78,12 @@ function executeMigration (actualVersion, entity, callback) {
78 db.sequelize.transaction().asCallback(function (err, t) { 78 db.sequelize.transaction().asCallback(function (err, t) {
79 if (err) return callback(err) 79 if (err) return callback(err)
80 80
81 migrationScript.up({ transaction: t }, function (err) { 81 const options = {
82 transaction: t,
83 queryInterface: db.sequelize.getQueryInterface(),
84 Sequelize: db.Sequelize
85 }
86 migrationScript.up(options, function (err) {
82 if (err) { 87 if (err) {
83 t.rollback() 88 t.rollback()
84 return callback(err) 89 return callback(err)