aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations/0040-video-nsfw.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-03-28 21:19:46 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-03-28 21:19:46 +0200
commit31b59b477459d4f26ed8ef089a0e5553fb6a332b (patch)
tree70de15dc172045d01ad45718f55c22d5ca43b354 /server/initializers/migrations/0040-video-nsfw.js
parentd07137b90b2b2b0c1e93a6f0e7bf8719b133027c (diff)
downloadPeerTube-31b59b477459d4f26ed8ef089a0e5553fb6a332b.tar.gz
PeerTube-31b59b477459d4f26ed8ef089a0e5553fb6a332b.tar.zst
PeerTube-31b59b477459d4f26ed8ef089a0e5553fb6a332b.zip
Server: add nsfw attribute
Diffstat (limited to 'server/initializers/migrations/0040-video-nsfw.js')
-rw-r--r--server/initializers/migrations/0040-video-nsfw.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/server/initializers/migrations/0040-video-nsfw.js b/server/initializers/migrations/0040-video-nsfw.js
new file mode 100644
index 000000000..7f3692b28
--- /dev/null
+++ b/server/initializers/migrations/0040-video-nsfw.js
@@ -0,0 +1,34 @@
1'use strict'
2
3const waterfall = require('async/waterfall')
4
5// utils = { transaction, queryInterface, sequelize, Sequelize }
6exports.up = function (utils, finalCallback) {
7 const q = utils.queryInterface
8 const Sequelize = utils.Sequelize
9
10 const data = {
11 type: Sequelize.BOOLEAN,
12 allowNull: false,
13 defaultValue: false
14 }
15
16 waterfall([
17
18 function addNSFWColumn (callback) {
19 q.addColumn('Videos', 'nsfw', data, { transaction: utils.transaction }).asCallback(function (err) {
20 return callback(err)
21 })
22 },
23
24 function nullOnDefault (callback) {
25 data.defaultValue = null
26
27 q.changeColumn('Videos', 'nsfw', data, { transaction: utils.transaction }).asCallback(callback)
28 }
29 ], finalCallback)
30}
31
32exports.down = function (options, callback) {
33 throw new Error('Not implemented.')
34}