diff options
Diffstat (limited to 'src/util/migrations/sqlite/1660416010862-InvitersAreDeletable.ts')
-rw-r--r-- | src/util/migrations/sqlite/1660416010862-InvitersAreDeletable.ts | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/util/migrations/sqlite/1660416010862-InvitersAreDeletable.ts b/src/util/migrations/sqlite/1660416010862-InvitersAreDeletable.ts index 9b29e119..a05082c6 100644 --- a/src/util/migrations/sqlite/1660416010862-InvitersAreDeletable.ts +++ b/src/util/migrations/sqlite/1660416010862-InvitersAreDeletable.ts @@ -1,10 +1,10 @@ import { MigrationInterface, QueryRunner } from "typeorm"; export class InvitersAreDeletable1660416010862 implements MigrationInterface { - name = 'InvitersAreDeletable1660416010862' + name = "InvitersAreDeletable1660416010862"; - public async up(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(` + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(` CREATE TABLE "temporary_invites" ( "code" varchar PRIMARY KEY NOT NULL, "temporary" boolean NOT NULL, @@ -24,7 +24,7 @@ export class InvitersAreDeletable1660416010862 implements MigrationInterface { CONSTRAINT "FK_3f4939aa1461e8af57fea3fb05d" FOREIGN KEY ("guild_id") REFERENCES "guilds" ("id") ON DELETE CASCADE ON UPDATE NO ACTION ) `); - await queryRunner.query(` + await queryRunner.query(` INSERT INTO "temporary_invites"( "code", "temporary", @@ -55,14 +55,14 @@ export class InvitersAreDeletable1660416010862 implements MigrationInterface { "vanity_url" FROM "invites" `); - await queryRunner.query(` + await queryRunner.query(` DROP TABLE "invites" `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE "temporary_invites" RENAME TO "invites" `); - await queryRunner.query(` + await queryRunner.query(` CREATE TABLE "temporary_invites" ( "code" varchar PRIMARY KEY NOT NULL, "temporary" boolean NOT NULL, @@ -83,7 +83,7 @@ export class InvitersAreDeletable1660416010862 implements MigrationInterface { CONSTRAINT "FK_15c35422032e0b22b4ada95f48f" FOREIGN KEY ("inviter_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE NO ACTION ) `); - await queryRunner.query(` + await queryRunner.query(` INSERT INTO "temporary_invites"( "code", "temporary", @@ -114,21 +114,21 @@ export class InvitersAreDeletable1660416010862 implements MigrationInterface { "vanity_url" FROM "invites" `); - await queryRunner.query(` + await queryRunner.query(` DROP TABLE "invites" `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE "temporary_invites" RENAME TO "invites" `); - } + } - public async down(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(` + public async down(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(` ALTER TABLE "invites" RENAME TO "temporary_invites" `); - await queryRunner.query(` + await queryRunner.query(` CREATE TABLE "invites" ( "code" varchar PRIMARY KEY NOT NULL, "temporary" boolean NOT NULL, @@ -148,7 +148,7 @@ export class InvitersAreDeletable1660416010862 implements MigrationInterface { CONSTRAINT "FK_3f4939aa1461e8af57fea3fb05d" FOREIGN KEY ("guild_id") REFERENCES "guilds" ("id") ON DELETE CASCADE ON UPDATE NO ACTION ) `); - await queryRunner.query(` + await queryRunner.query(` INSERT INTO "invites"( "code", "temporary", @@ -179,14 +179,14 @@ export class InvitersAreDeletable1660416010862 implements MigrationInterface { "vanity_url" FROM "temporary_invites" `); - await queryRunner.query(` + await queryRunner.query(` DROP TABLE "temporary_invites" `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE "invites" RENAME TO "temporary_invites" `); - await queryRunner.query(` + await queryRunner.query(` CREATE TABLE "invites" ( "code" varchar PRIMARY KEY NOT NULL, "temporary" boolean NOT NULL, @@ -207,7 +207,7 @@ export class InvitersAreDeletable1660416010862 implements MigrationInterface { CONSTRAINT "FK_3f4939aa1461e8af57fea3fb05d" FOREIGN KEY ("guild_id") REFERENCES "guilds" ("id") ON DELETE CASCADE ON UPDATE NO ACTION ) `); - await queryRunner.query(` + await queryRunner.query(` INSERT INTO "invites"( "code", "temporary", @@ -238,9 +238,8 @@ export class InvitersAreDeletable1660416010862 implements MigrationInterface { "vanity_url" FROM "temporary_invites" `); - await queryRunner.query(` + await queryRunner.query(` DROP TABLE "temporary_invites" `); - } - + } } |