Merge branch 'release/2.1.0' into develop
[oweals/peertube.git] / server / initializers / migrations / 0335-video-downloading-enabled.ts
1 import * as Sequelize from 'sequelize'
2 import { Migration } from '../../models/migrations'
3
4 async function up (utils: {
5   transaction: Sequelize.Transaction
6   queryInterface: Sequelize.QueryInterface
7   sequelize: Sequelize.Sequelize
8 }): Promise<void> {
9   const data = {
10     type: Sequelize.BOOLEAN,
11     allowNull: false,
12     defaultValue: true
13   } as Migration.Boolean
14   await utils.queryInterface.addColumn('video', 'downloadEnabled', data)
15
16   data.defaultValue = null
17   return utils.queryInterface.changeColumn('video', 'downloadEnabled', data)
18 }
19
20 function down (options) {
21   throw new Error('Not implemented.')
22 }
23
24 export {
25   up,
26   down
27 }