diff options
Diffstat (limited to 'src/util/migrations/sqlite/1660260672914-CodeCleanup4.ts')
-rw-r--r-- | src/util/migrations/sqlite/1660260672914-CodeCleanup4.ts | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/util/migrations/sqlite/1660260672914-CodeCleanup4.ts b/src/util/migrations/sqlite/1660260672914-CodeCleanup4.ts index 33f4df03..ed284bc8 100644 --- a/src/util/migrations/sqlite/1660260672914-CodeCleanup4.ts +++ b/src/util/migrations/sqlite/1660260672914-CodeCleanup4.ts @@ -1,10 +1,10 @@ import { MigrationInterface, QueryRunner } from "typeorm"; export class CodeCleanup41660260672914 implements MigrationInterface { - name = 'CodeCleanup41660260672914' + name = "CodeCleanup41660260672914"; - public async up(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(` + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(` CREATE TABLE "temporary_users" ( "id" varchar PRIMARY KEY NOT NULL, "username" varchar NOT NULL, @@ -41,7 +41,7 @@ export class CodeCleanup41660260672914 implements MigrationInterface { CONSTRAINT "UQ_b1dd13b6ed980004a795ca184a6" UNIQUE ("settingsId") ) `); - await queryRunner.query(` + await queryRunner.query(` INSERT INTO "temporary_users"( "id", "username", @@ -108,14 +108,14 @@ export class CodeCleanup41660260672914 implements MigrationInterface { "notes" FROM "users" `); - await queryRunner.query(` + await queryRunner.query(` DROP TABLE "users" `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE "temporary_users" RENAME TO "users" `); - await queryRunner.query(` + await queryRunner.query(` CREATE TABLE "temporary_users" ( "id" varchar PRIMARY KEY NOT NULL, "username" varchar NOT NULL, @@ -153,7 +153,7 @@ export class CodeCleanup41660260672914 implements MigrationInterface { CONSTRAINT "FK_76ba283779c8441fd5ff819c8cf" FOREIGN KEY ("settingsId") REFERENCES "user_settings" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION ) `); - await queryRunner.query(` + await queryRunner.query(` INSERT INTO "temporary_users"( "id", "username", @@ -222,21 +222,21 @@ export class CodeCleanup41660260672914 implements MigrationInterface { "settingsId" FROM "users" `); - await queryRunner.query(` + await queryRunner.query(` DROP TABLE "users" `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE "temporary_users" RENAME TO "users" `); - } + } - public async down(queryRunner: QueryRunner): Promise<void> { - await queryRunner.query(` + public async down(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(` ALTER TABLE "users" RENAME TO "temporary_users" `); - await queryRunner.query(` + await queryRunner.query(` CREATE TABLE "users" ( "id" varchar PRIMARY KEY NOT NULL, "username" varchar NOT NULL, @@ -273,7 +273,7 @@ export class CodeCleanup41660260672914 implements MigrationInterface { CONSTRAINT "UQ_b1dd13b6ed980004a795ca184a6" UNIQUE ("settingsId") ) `); - await queryRunner.query(` + await queryRunner.query(` INSERT INTO "users"( "id", "username", @@ -342,14 +342,14 @@ export class CodeCleanup41660260672914 implements MigrationInterface { "settingsId" FROM "temporary_users" `); - await queryRunner.query(` + await queryRunner.query(` DROP TABLE "temporary_users" `); - await queryRunner.query(` + await queryRunner.query(` ALTER TABLE "users" RENAME TO "temporary_users" `); - await queryRunner.query(` + await queryRunner.query(` CREATE TABLE "users" ( "id" varchar PRIMARY KEY NOT NULL, "username" varchar NOT NULL, @@ -384,7 +384,7 @@ export class CodeCleanup41660260672914 implements MigrationInterface { "notes" text NOT NULL ) `); - await queryRunner.query(` + await queryRunner.query(` INSERT INTO "users"( "id", "username", @@ -451,9 +451,8 @@ export class CodeCleanup41660260672914 implements MigrationInterface { "notes" FROM "temporary_users" `); - await queryRunner.query(` + await queryRunner.query(` DROP TABLE "temporary_users" `); - } - + } } |