]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/initializers/migrations/0150-avatar-cascade.ts
Try to fix video duplication
[github/Chocobozzz/PeerTube.git] / server / initializers / migrations / 0150-avatar-cascade.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 }): Promise<void> {
8 await utils.queryInterface.removeConstraint('actor', 'actor_avatarId_fkey')
9
10 await utils.queryInterface.addConstraint('actor', [ 'avatarId' ], {
11 type: 'foreign key',
12 references: {
13 table: 'avatar',
14 field: 'id'
15 },
16 onDelete: 'set null',
17 onUpdate: 'CASCADE'
18 })
19 }
20
21 function down (options) {
22 throw new Error('Not implemented.')
23 }
24
25 export {
26 up,
27 down
28 }