-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f864b7
commit 75e9b5d
Showing
18 changed files
with
559 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
backend/src/migrations/1669778297643-remove-apiKeyType-enum.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm" | ||
|
||
export class removeApiKeyTypeEnum1669778297643 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE "api_key" ALTER COLUMN "for" TYPE text`, | ||
) | ||
await queryRunner.query( | ||
`ALTER TABLE "api_key" ALTER COLUMN "for" SET NOT NULL`, | ||
) | ||
await queryRunner.query( | ||
`ALTER TABLE "api_key" ALTER COLUMN "for" SET DEFAULT 'GENERIC'`, | ||
) | ||
const existingApiKeyForEnum = await queryRunner.query( | ||
"SELECT 1 FROM pg_type WHERE typname = 'api_key_for_enum'", | ||
) | ||
const existingApiKeyTypeEnum = await queryRunner.query( | ||
"SELECT 1 FROM pg_type WHERE typname = 'api_key_type_enum'", | ||
) | ||
if (existingApiKeyForEnum) { | ||
await queryRunner.query(`DROP TYPE IF EXISTS "public"."api_key_for_enum"`) | ||
} | ||
if (existingApiKeyTypeEnum) { | ||
await queryRunner.query( | ||
`DROP TYPE IF EXISTS "public"."api_key_type_enum"`, | ||
) | ||
} | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
const existingApiKeyTypeEnum = await queryRunner.query( | ||
"SELECT 1 FROM pg_type WHERE typname = 'api_key_type_enum'", | ||
) | ||
if (!existingApiKeyTypeEnum[0]) { | ||
await queryRunner.query( | ||
`CREATE TYPE "public"."api_key_type_enum" AS ENUM('GCP', 'AWS', 'GENERIC')`, | ||
) | ||
} | ||
await queryRunner.query( | ||
`ALTER TABLE "api_key" ALTER COLUMN "for" "public"."api_key_type_enum" NOT NULL DEFAULT 'GENERIC'`, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.