aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations/0035-video-licence.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-03-27 20:53:11 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-03-27 20:53:11 +0200
commit6f0c39e2de400685b7baf8340b9e132f2659365a (patch)
treeb036c6ebf65ff4cb7f5649fc48a0b7201370bddd /server/initializers/migrations/0035-video-licence.js
parent28974889281523eec5b00dd5596c67d99c5167e5 (diff)
downloadPeerTube-6f0c39e2de400685b7baf8340b9e132f2659365a.tar.gz
PeerTube-6f0c39e2de400685b7baf8340b9e132f2659365a.tar.zst
PeerTube-6f0c39e2de400685b7baf8340b9e132f2659365a.zip
Server: add licence video attribute
Diffstat (limited to 'server/initializers/migrations/0035-video-licence.js')
-rw-r--r--server/initializers/migrations/0035-video-licence.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/server/initializers/migrations/0035-video-licence.js b/server/initializers/migrations/0035-video-licence.js
new file mode 100644
index 000000000..9cf75858d
--- /dev/null
+++ b/server/initializers/migrations/0035-video-licence.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.INTEGER,
12 allowNull: false,
13 defaultValue: 0
14 }
15
16 waterfall([
17
18 function addLicenceColumn (callback) {
19 q.addColumn('Videos', 'licence', 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', 'licence', data, { transaction: utils.transaction }).asCallback(callback)
28 }
29 ], finalCallback)
30}
31
32exports.down = function (options, callback) {
33 throw new Error('Not implemented.')
34}