2022-12-16 07:37:08 -07:00
|
|
|
export class addFkAbuseUserReportTargetUserIdToUserId1671199573000 {
|
2023-04-06 19:56:46 -06:00
|
|
|
name = "addFkAbuseUserReportTargetUserIdToUserId1671199573000";
|
2022-12-16 07:37:08 -07:00
|
|
|
|
|
|
|
async up(queryRunner) {
|
2023-04-06 19:56:46 -06:00
|
|
|
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`,
|
|
|
|
);
|
2022-12-16 07:37:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
async down(queryRunner) {
|
2023-04-06 19:56:46 -06:00
|
|
|
await queryRunner.query(
|
2023-06-05 22:15:49 -06:00
|
|
|
`ALTER TABLE abuse_user_report DROP CONSTRAINT fk_7f4e851a35d81b64dda28eee0`,
|
2023-04-06 19:56:46 -06:00
|
|
|
);
|
2022-12-16 07:37:08 -07:00
|
|
|
}
|
|
|
|
}
|