mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2025-01-10 23:51:01 -07:00
Add FK abuse_user_report.targetUserId -> user.id (closes #9227)
This commit is contained in:
parent
c060af47b0
commit
29ea572c59
1 changed files with 12 additions and 0 deletions
|
@ -0,0 +1,12 @@
|
||||||
|
export class addFkAbuseUserReportTargetUserIdToUserId1671199573000 {
|
||||||
|
name = 'addFkAbuseUserReportTargetUserIdToUserId1671199573000'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`DELETE FROM abuse_user_report WHERE NOT EXISTS (SELECT 1 FROM "user" WHERE "user"."id" = "abuse_user_report"."targetUserId")`);
|
||||||
|
await queryRunner.query(`ALTER TABLE abuse_user_report ADD CONSTRAINT fk_7f4e851a35d81b64dda28eee0 FOREIGN KEY ("targetUserId") REFERENCES "user"("id") ON DELETE CASCADE`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE abuse_user_report DROP CONSTRAINT fk_7f4e851a35d81b64dda28eee0`);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue