aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations/0150-avatar-cascade.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers/migrations/0150-avatar-cascade.ts')
-rw-r--r--server/initializers/migrations/0150-avatar-cascade.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/server/initializers/migrations/0150-avatar-cascade.ts b/server/initializers/migrations/0150-avatar-cascade.ts
new file mode 100644
index 000000000..821696717
--- /dev/null
+++ b/server/initializers/migrations/0150-avatar-cascade.ts
@@ -0,0 +1,28 @@
1import * as Sequelize from 'sequelize'
2
3async 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
21function down (options) {
22 throw new Error('Not implemented.')
23}
24
25export {
26 up,
27 down
28}