diff options
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/constants.js | 10 | ||||
-rw-r--r-- | server/initializers/migrations/0020-video-likes.js | 19 | ||||
-rw-r--r-- | server/initializers/migrations/0025-video-dislikes.js | 19 |
3 files changed, 46 insertions, 2 deletions
diff --git a/server/initializers/constants.js b/server/initializers/constants.js index 2d5bb84cc..16a2dd320 100644 --- a/server/initializers/constants.js +++ b/server/initializers/constants.js | |||
@@ -5,7 +5,7 @@ const path = require('path') | |||
5 | 5 | ||
6 | // --------------------------------------------------------------------------- | 6 | // --------------------------------------------------------------------------- |
7 | 7 | ||
8 | const LAST_MIGRATION_VERSION = 15 | 8 | const LAST_MIGRATION_VERSION = 25 |
9 | 9 | ||
10 | // --------------------------------------------------------------------------- | 10 | // --------------------------------------------------------------------------- |
11 | 11 | ||
@@ -95,6 +95,11 @@ const CONSTRAINTS_FIELDS = { | |||
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
98 | const VIDEO_RATE_TYPES = { | ||
99 | LIKE: 'like', | ||
100 | DISLIKE: 'dislike' | ||
101 | } | ||
102 | |||
98 | // --------------------------------------------------------------------------- | 103 | // --------------------------------------------------------------------------- |
99 | 104 | ||
100 | // Score a pod has when we create it as a friend | 105 | // Score a pod has when we create it as a friend |
@@ -249,7 +254,8 @@ module.exports = { | |||
249 | STATIC_MAX_AGE, | 254 | STATIC_MAX_AGE, |
250 | STATIC_PATHS, | 255 | STATIC_PATHS, |
251 | THUMBNAILS_SIZE, | 256 | THUMBNAILS_SIZE, |
252 | USER_ROLES | 257 | USER_ROLES, |
258 | VIDEO_RATE_TYPES | ||
253 | } | 259 | } |
254 | 260 | ||
255 | // --------------------------------------------------------------------------- | 261 | // --------------------------------------------------------------------------- |
diff --git a/server/initializers/migrations/0020-video-likes.js b/server/initializers/migrations/0020-video-likes.js new file mode 100644 index 000000000..6db62cb90 --- /dev/null +++ b/server/initializers/migrations/0020-video-likes.js | |||
@@ -0,0 +1,19 @@ | |||
1 | 'use strict' | ||
2 | |||
3 | // utils = { transaction, queryInterface, sequelize, Sequelize } | ||
4 | exports.up = function (utils, finalCallback) { | ||
5 | const q = utils.queryInterface | ||
6 | const Sequelize = utils.Sequelize | ||
7 | |||
8 | const data = { | ||
9 | type: Sequelize.INTEGER, | ||
10 | allowNull: false, | ||
11 | defaultValue: 0 | ||
12 | } | ||
13 | |||
14 | q.addColumn('Videos', 'likes', data, { transaction: utils.transaction }).asCallback(finalCallback) | ||
15 | } | ||
16 | |||
17 | exports.down = function (options, callback) { | ||
18 | throw new Error('Not implemented.') | ||
19 | } | ||
diff --git a/server/initializers/migrations/0025-video-dislikes.js b/server/initializers/migrations/0025-video-dislikes.js new file mode 100644 index 000000000..40d2e7351 --- /dev/null +++ b/server/initializers/migrations/0025-video-dislikes.js | |||
@@ -0,0 +1,19 @@ | |||
1 | 'use strict' | ||
2 | |||
3 | // utils = { transaction, queryInterface, sequelize, Sequelize } | ||
4 | exports.up = function (utils, finalCallback) { | ||
5 | const q = utils.queryInterface | ||
6 | const Sequelize = utils.Sequelize | ||
7 | |||
8 | const data = { | ||
9 | type: Sequelize.INTEGER, | ||
10 | allowNull: false, | ||
11 | defaultValue: 0 | ||
12 | } | ||
13 | |||
14 | q.addColumn('Videos', 'dislikes', data, { transaction: utils.transaction }).asCallback(finalCallback) | ||
15 | } | ||
16 | |||
17 | exports.down = function (options, callback) { | ||
18 | throw new Error('Not implemented.') | ||
19 | } | ||