diff --git a/src/database/entities/ApplicationCommand.ts b/src/database/entities/ApplicationCommand.ts index 01ff5a146..e22e5f417 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 2270019b8..7ccfb641b 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 000000000..36d510d92 --- /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 { + await queryRunner.query(`ALTER TABLE "application_commands" ALTER COLUMN "version" SET DEFAULT 0`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "application_commands" ALTER COLUMN "version" SET DEFAULT (0)`); + } +}