diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-08-22 22:18:59 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-08-22 22:18:59 +1000 |
commit | 0cd9a46eea260c299db2e2983f7214ab8b119d29 (patch) | |
tree | 5fbb98e7adcfeab81594732089474afdde5893f9 /src/util/migrations/postgres/1660416055566-InvitersAreDeletable.ts | |
parent | Merge branch 'master' into feat/captchaVerify (diff) | |
parent | Merge remote-tracking branch 'Puyodead1/patch/prettier-config' into staging (diff) | |
download | server-0cd9a46eea260c299db2e2983f7214ab8b119d29.tar.xz |
Merge remote-tracking branch 'upstream/staging' into feat/captchaVerify
Diffstat (limited to 'src/util/migrations/postgres/1660416055566-InvitersAreDeletable.ts')
-rw-r--r-- | src/util/migrations/postgres/1660416055566-InvitersAreDeletable.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/util/migrations/postgres/1660416055566-InvitersAreDeletable.ts b/src/util/migrations/postgres/1660416055566-InvitersAreDeletable.ts new file mode 100644 index 00000000..e6101318 --- /dev/null +++ b/src/util/migrations/postgres/1660416055566-InvitersAreDeletable.ts @@ -0,0 +1,26 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class InvitersAreDeletable1660416055566 implements MigrationInterface { + name = 'InvitersAreDeletable1660416055566' + + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(` + ALTER TABLE "invites" DROP CONSTRAINT "FK_15c35422032e0b22b4ada95f48f" + `); + await queryRunner.query(` + ALTER TABLE "invites" + ADD CONSTRAINT "FK_15c35422032e0b22b4ada95f48f" FOREIGN KEY ("inviter_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE NO ACTION + `); + } + + public async down(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(` + ALTER TABLE "invites" DROP CONSTRAINT "FK_15c35422032e0b22b4ada95f48f" + `); + await queryRunner.query(` + ALTER TABLE "invites" + ADD CONSTRAINT "FK_15c35422032e0b22b4ada95f48f" FOREIGN KEY ("inviter_id") REFERENCES "users"("id") ON DELETE NO ACTION ON UPDATE NO ACTION + `); + } + +} |