summary refs log tree commit diff
path: root/src/util/migration/postgres/1772404321403-EmbedCacheMultiEmbed.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/migration/postgres/1772404321403-EmbedCacheMultiEmbed.ts')
-rw-r--r--src/util/migration/postgres/1772404321403-EmbedCacheMultiEmbed.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/util/migration/postgres/1772404321403-EmbedCacheMultiEmbed.ts b/src/util/migration/postgres/1772404321403-EmbedCacheMultiEmbed.ts
new file mode 100644

index 00000000..55e80fdc --- /dev/null +++ b/src/util/migration/postgres/1772404321403-EmbedCacheMultiEmbed.ts
@@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class EmbedCacheCreatedAt1772404321403 implements MigrationInterface { + name = "EmbedCacheCreatedAt1772404321403"; + + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(`ALTER TABLE "embed_cache" ALTER COLUMN "embed" DROP NOT NULL;`); + await queryRunner.query(`ALTER TABLE "embed_cache" ADD "embeds" text NULL;`); + } + + public async down(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(`ALTER TABLE "embed_cache" DROP COLUMN "embeds"`); + await queryRunner.query(`UPDATE "embed_cache" SET "embed" = '{}' WHERE "embed" IS NULL;`); + await queryRunner.query(`ALTER TABLE "embed_cache" ALTER COLUMN "embed" SET NOT NULL;`); + } +}