]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/initializers/migrations/0035-video-licence.ts
Merge branch 'release/2.1.0' into develop
[github/Chocobozzz/PeerTube.git] / server / initializers / migrations / 0035-video-licence.ts
CommitLineData
6fcd19ba
C
1import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird'
c1e791ba 3import { Migration } from '../../models/migrations'
6fcd19ba
C
4
5function up (utils: {
a1587156
C
6 transaction: Sequelize.Transaction
7 queryInterface: Sequelize.QueryInterface
6fcd19ba
C
8 sequelize: Sequelize.Sequelize
9}): Promise<void> {
6f0c39e2 10 const q = utils.queryInterface
6f0c39e2
C
11
12 const data = {
13 type: Sequelize.INTEGER,
14 allowNull: false,
15 defaultValue: 0
c1e791ba 16 } as Migration.Integer
6f0c39e2 17
6fcd19ba
C
18 return q.addColumn('Videos', 'licence', data)
19 .then(() => {
6f0c39e2 20 data.defaultValue = null
6fcd19ba
C
21 return q.changeColumn('Videos', 'licence', data)
22 })
6f0c39e2
C
23}
24
0a6658fd 25function down (options) {
6f0c39e2
C
26 throw new Error('Not implemented.')
27}
65fcc311
C
28
29export {
30 up,
31 down
32}