Move models to typescript-sequelize
[oweals/peertube.git] / server / initializers / migrations / 0120-video-null.ts
1 import * as Sequelize from 'sequelize'
2 import { CONSTRAINTS_FIELDS } from '../constants'
3
4 async function up (utils: {
5   transaction: Sequelize.Transaction,
6   queryInterface: Sequelize.QueryInterface,
7   sequelize: Sequelize.Sequelize,
8   db: any
9 }): Promise<void> {
10
11   {
12     const data = {
13       type: Sequelize.INTEGER,
14       allowNull: true,
15       defaultValue: null
16     }
17     await utils.queryInterface.changeColumn('Videos', 'licence', data)
18   }
19
20   {
21     const data = {
22       type: Sequelize.INTEGER,
23       allowNull: true,
24       defaultValue: null
25     }
26     await utils.queryInterface.changeColumn('Videos', 'category', data)
27   }
28
29   {
30     const data = {
31       type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.max),
32       allowNull: true,
33       defaultValue: null
34     }
35     await utils.queryInterface.changeColumn('Videos', 'description', data)
36   }
37 }
38
39 function down (options) {
40   throw new Error('Not implemented.')
41 }
42
43 export {
44   up,
45   down
46 }