(hotfix) remove null categories in RSS/Atom feeds
[oweals/peertube.git] / server / initializers / migrations / 0410-video-playlist-element.ts
1 import * as Sequelize from 'sequelize'
2
3 async function up (utils: {
4   transaction: Sequelize.Transaction,
5   queryInterface: Sequelize.QueryInterface,
6   sequelize: Sequelize.Sequelize,
7   db: any
8 }): Promise<void> {
9   {
10     const data = {
11       type: Sequelize.INTEGER,
12       allowNull: true,
13       defaultValue: null
14     }
15
16     await utils.queryInterface.changeColumn('videoPlaylistElement', 'videoId', data)
17   }
18
19   await utils.queryInterface.removeConstraint('videoPlaylistElement', 'videoPlaylistElement_videoId_fkey')
20
21   await utils.queryInterface.addConstraint('videoPlaylistElement', [ 'videoId' ], {
22     type: 'foreign key',
23     references: {
24       table: 'video',
25       field: 'id'
26     },
27     onDelete: 'set null',
28     onUpdate: 'CASCADE'
29   })
30 }
31
32 function down (options) {
33   throw new Error('Not implemented.')
34 }
35
36 export {
37   up,
38   down
39 }