summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-07-03 15:49:08 +0200
committerRory& <root@rory.gay>2026-07-03 15:49:08 +0200
commit26485273c777c478d1e72de3c68d88cb0c035e43 (patch)
tree36177327167c937e6164e3289705f119cb7dc552
parentLet typeorm have its fun the rest of the way (diff)
downloadserver-ts-26485273c777c478d1e72de3c68d88cb0c035e43.tar.xz
Fix migration for app commands version
-rw-r--r--src/database/entities/ApplicationCommand.ts2
-rw-r--r--src/database/migration/postgres/1783086174271-ReconcileTypeormModels.ts2
-rw-r--r--src/database/migration/postgres/1783086517091-ReconcileTypeormModels.ts13
3 files changed, 14 insertions, 3 deletions
diff --git a/src/database/entities/ApplicationCommand.ts b/src/database/entities/ApplicationCommand.ts

index 01ff5a14..e22e5f41 100644 --- a/src/database/entities/ApplicationCommand.ts +++ b/src/database/entities/ApplicationCommand.ts
@@ -80,7 +80,7 @@ export class ApplicationCommand extends BaseClass { @Column({ nullable: true, type: "jsonb" }) contexts?: InteractionContextType[]; - @Column({ type: "int8", default: "0::bigint" }) + @Column({ type: "int8", default: 0n }) version: Snowflake; // Is this really a snowflake though? "An autoincrementing version identifier updated during substantial record changes" @Column({ default: 0 }) diff --git a/src/database/migration/postgres/1783086174271-ReconcileTypeormModels.ts b/src/database/migration/postgres/1783086174271-ReconcileTypeormModels.ts
index 2270019b..7ccfb641 100644 --- a/src/database/migration/postgres/1783086174271-ReconcileTypeormModels.ts +++ b/src/database/migration/postgres/1783086174271-ReconcileTypeormModels.ts
@@ -27,7 +27,6 @@ export class ReconcileTypeormModels1783086174271 implements MigrationInterface { await queryRunner.query( `CREATE TABLE "report_menus" ("id" bigint NOT NULL, "type" integer NOT NULL, "variant" character varying NOT NULL, "isCurrent" boolean NOT NULL, "inherits" character varying, "content" jsonb NOT NULL, CONSTRAINT "PK_1b5d649a189d57579d558ace79f" PRIMARY KEY ("id"))`, ); - await queryRunner.query(`ALTER TABLE "application_commands" ALTER COLUMN "version" SET DEFAULT '0::bigint'`); await queryRunner.query(`ALTER TABLE "embed_cache" ALTER COLUMN "created_at" SET NOT NULL`); await queryRunner.query(`ALTER TABLE "security_settings" DROP COLUMN "allowed_algorithms"`); await queryRunner.query(`ALTER TABLE "security_settings" ADD "allowed_algorithms" character varying array NOT NULL`); @@ -99,7 +98,6 @@ export class ReconcileTypeormModels1783086174271 implements MigrationInterface { await queryRunner.query(`ALTER TABLE "security_settings" DROP COLUMN "allowed_algorithms"`); await queryRunner.query(`ALTER TABLE "security_settings" ADD "allowed_algorithms" text NOT NULL`); await queryRunner.query(`ALTER TABLE "embed_cache" ALTER COLUMN "created_at" DROP NOT NULL`); - await queryRunner.query(`ALTER TABLE "application_commands" ALTER COLUMN "version" SET DEFAULT (0)`); await queryRunner.query(`DROP TABLE "report_menus"`); await queryRunner.query(`CREATE INDEX "IDX_e22a70819d07659c7a71c112a1" ON "message_stickers" USING btree ("sticker_id") `); await queryRunner.query(`CREATE INDEX "IDX_40bb6f23e7cc133292e92829d2" ON "message_stickers" USING btree ("message_id") `); diff --git a/src/database/migration/postgres/1783086517091-ReconcileTypeormModels.ts b/src/database/migration/postgres/1783086517091-ReconcileTypeormModels.ts new file mode 100644
index 00000000..36d510d9 --- /dev/null +++ b/src/database/migration/postgres/1783086517091-ReconcileTypeormModels.ts
@@ -0,0 +1,13 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class ReconcileTypeormModels1783086517091 implements MigrationInterface { + name = "ReconcileTypeormModels1783086517091"; + + public async up(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(`ALTER TABLE "application_commands" ALTER COLUMN "version" SET DEFAULT 0`); + } + + public async down(queryRunner: QueryRunner): Promise<void> { + await queryRunner.query(`ALTER TABLE "application_commands" ALTER COLUMN "version" SET DEFAULT (0)`); + } +}