]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/initializers/migrations/0410-video-playlist-element.ts
Merge branch 'release/4.1.0' into develop
[github/Chocobozzz/PeerTube.git] / server / initializers / migrations / 0410-video-playlist-element.ts
CommitLineData
bfbd9128
C
1import * as Sequelize from 'sequelize'
2
3async function up (utils: {
a1587156
C
4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize
bfbd9128
C
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
b49f22d8
C
21 await utils.queryInterface.addConstraint('videoPlaylistElement', {
22 fields: [ 'videoId' ],
bfbd9128
C
23 type: 'foreign key',
24 references: {
25 table: 'video',
26 field: 'id'
27 },
28 onDelete: 'set null',
29 onUpdate: 'CASCADE'
30 })
31}
32
33function down (options) {
34 throw new Error('Not implemented.')
35}
36
37export {
38 up,
39 down
40}