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