add webtorrent opt-out settings
[oweals/peertube.git] / server / initializers / migrations / 0280-webtorrent-policy-user.ts
1 import * as Sequelize from 'sequelize'
2 import { values } from 'lodash'
3 import { WEBTORRENT_POLICY_TYPES } from '../constants'
4
5 async function up (utils: {
6   transaction: Sequelize.Transaction
7   queryInterface: Sequelize.QueryInterface
8   sequelize: Sequelize.Sequelize
9 }): Promise<any> {
10   {
11     const data = {
12       type: Sequelize.ENUM(values(WEBTORRENT_POLICY_TYPES)),
13       allowNull: false,
14       defaultValue: 'enable'
15     }
16
17     await utils.queryInterface.addColumn('user', 'webTorrentPolicy', data)
18   }
19
20 }
21
22 function down (options) {
23   throw new Error('Not implemented.')
24 }
25
26 export { up, down }