From 39c95f12800ed63cd2709cf10e1d01481c569e19 Mon Sep 17 00:00:00 2001 From: Zack Pollard Date: Thu, 10 Jul 2025 18:18:51 +0100 Subject: [PATCH] refactor: rename geodata pk constraint to match runtime constraint name (#19856) --- .../1752161055253-RenameGeodataPKConstraint.ts | 9 +++++++++ server/src/schema/tables/geodata-places.table.ts | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 server/src/schema/migrations/1752161055253-RenameGeodataPKConstraint.ts diff --git a/server/src/schema/migrations/1752161055253-RenameGeodataPKConstraint.ts b/server/src/schema/migrations/1752161055253-RenameGeodataPKConstraint.ts new file mode 100644 index 0000000000..686791e201 --- /dev/null +++ b/server/src/schema/migrations/1752161055253-RenameGeodataPKConstraint.ts @@ -0,0 +1,9 @@ +import { Kysely, sql } from 'kysely'; + +export async function up(db: Kysely): Promise { + await sql`ALTER TABLE "geodata_places" DROP CONSTRAINT IF EXISTS "PK_c29918988912ef4036f3d7fbff4";`.execute(db); + await sql`ALTER TABLE "geodata_places" DROP CONSTRAINT IF EXISTS "geodata_places_pkey"`.execute(db); + await sql`ALTER TABLE "geodata_places" ADD CONSTRAINT "geodata_places_pkey" PRIMARY KEY ("id");`.execute(db); +} + +export async function down(): Promise {} diff --git a/server/src/schema/tables/geodata-places.table.ts b/server/src/schema/tables/geodata-places.table.ts index abdc213e7c..eec2b240d0 100644 --- a/server/src/schema/tables/geodata-places.table.ts +++ b/server/src/schema/tables/geodata-places.table.ts @@ -1,6 +1,6 @@ import { Column, Index, PrimaryColumn, Table, Timestamp } from 'src/sql-tools'; -@Table({ name: 'geodata_places' }) +@Table({ name: 'geodata_places', primaryConstraintName: 'geodata_places_pkey' }) @Index({ name: 'idx_geodata_places_alternate_names', using: 'gin',