From 2ffdc5cbe59c279e3d52dc48e8a03bfef63f7af4 Mon Sep 17 00:00:00 2001 From: Rory& Date: Tue, 3 Feb 2026 02:11:06 +0100 Subject: Add member profile customisation fields to db --- .../1770079838835-MemberProfileCustomisation.ts | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/util/migration/postgres/1770079838835-MemberProfileCustomisation.ts (limited to 'src/util/migration/postgres') diff --git a/src/util/migration/postgres/1770079838835-MemberProfileCustomisation.ts b/src/util/migration/postgres/1770079838835-MemberProfileCustomisation.ts new file mode 100644 index 00000000..740391ee --- /dev/null +++ b/src/util/migration/postgres/1770079838835-MemberProfileCustomisation.ts @@ -0,0 +1,36 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class MemberProfileCustomisation1770079838835 implements MigrationInterface { + name = "MemberProfileCustomisation1770079838835"; + + public async up(queryRunner: QueryRunner): Promise { + // just gonna let typeorm do its thing for once... + await queryRunner.query(`ALTER TABLE "thread_members" DROP CONSTRAINT "FK_606ac45e8756d3440c584477f4e"`); + await queryRunner.query(`ALTER TABLE "webhooks" DROP CONSTRAINT "fk_d64f38834fa676f6caa4786ddd6"`); + await queryRunner.query(`DROP INDEX "public"."IDX_bde0970b6a26bdbd83508addd2"`); + await queryRunner.query(`ALTER TABLE "members" ADD "avatar_decoration_data" text`); + await queryRunner.query(`ALTER TABLE "members" ADD "display_name_styles" text`); + await queryRunner.query(`ALTER TABLE "members" ADD "collectibles" text`); + await queryRunner.query(`ALTER TABLE "guilds" ALTER COLUMN "channel_ordering" DROP DEFAULT`); + await queryRunner.query(`CREATE UNIQUE INDEX "IDX_38d4f704373da3f0dc9b352ac9" ON "thread_members" ("id", "member_idx") `); + await queryRunner.query( + `ALTER TABLE "thread_members" ADD CONSTRAINT "FK_4721015b4e24ad29da55dbd2de0" FOREIGN KEY ("member_idx") REFERENCES "members"("index") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "thread_members" DROP CONSTRAINT "FK_4721015b4e24ad29da55dbd2de0"`); + await queryRunner.query(`DROP INDEX "public"."IDX_38d4f704373da3f0dc9b352ac9"`); + await queryRunner.query(`ALTER TABLE "guilds" ALTER COLUMN "channel_ordering" SET DEFAULT '[]'`); + await queryRunner.query(`ALTER TABLE "members" DROP COLUMN "collectibles"`); + await queryRunner.query(`ALTER TABLE "members" DROP COLUMN "display_name_styles"`); + await queryRunner.query(`ALTER TABLE "members" DROP COLUMN "avatar_decoration_data"`); + await queryRunner.query(`CREATE UNIQUE INDEX "IDX_bde0970b6a26bdbd83508addd2" ON "thread_members" ("id", "member_idx") `); + await queryRunner.query( + `ALTER TABLE "webhooks" ADD CONSTRAINT "fk_d64f38834fa676f6caa4786ddd6" FOREIGN KEY ("source_channel_id") REFERENCES "channels"("id") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + await queryRunner.query( + `ALTER TABLE "thread_members" ADD CONSTRAINT "FK_606ac45e8756d3440c584477f4e" FOREIGN KEY ("member_idx") REFERENCES "members"("index") ON DELETE CASCADE ON UPDATE NO ACTION`, + ); + } +} -- cgit 1.5.1