From 15156671582463bc837b35793be0e47edf96a9cb Mon Sep 17 00:00:00 2001 From: ghost2023 Date: Wed, 5 Aug 2026 11:39:45 +0300 Subject: [PATCH] fixup --- .../src/migrations/3250000000000-FreightBaseline.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/edr-freight-api/src/migrations/3250000000000-FreightBaseline.ts b/apps/edr-freight-api/src/migrations/3250000000000-FreightBaseline.ts index 8eb050622..5e39b3974 100644 --- a/apps/edr-freight-api/src/migrations/3250000000000-FreightBaseline.ts +++ b/apps/edr-freight-api/src/migrations/3250000000000-FreightBaseline.ts @@ -20,6 +20,15 @@ import { MigrationInterface, QueryRunner } from "typeorm"; * Regenerate (never hand-edit): run every migration into an empty database, then * `pg_dump --schema-only -n freight -T freight.migrations` plus a * `--data-only --column-inserts` dump of the non-empty tables. + * + * ONE deliberate deviation from that dump, which a regeneration would silently + * undo — reapply it: `freight.otp_verifications` carries the constraint names + * `pk_otp_verifications` / `uq_otp_verifications_phone` rather than TypeORM's + * generated `PK_91d17…` / `UQ_5121c…`. Prod built that table through + * `1870000000000-RepairSynchronizeDrift` (which names its constraints by hand) + * while a fresh run builds it through `1810000000003-CreateOtpVerifications` + * (which lets TypeORM hash them). Same columns either way; matching prod's names + * keeps `sql/adopt-split-migration-history.sql` strict. */ const STRUCTURE_SQL = ` @@ -2721,7 +2730,7 @@ ALTER TABLE ONLY freight.booking_rate_snapshot ADD CONSTRAINT "PK_8ca5cf692c4c3e95d91a7343117" PRIMARY KEY (id); ALTER TABLE ONLY freight.otp_verifications - ADD CONSTRAINT "PK_91d17e75ac3182dba6701869b39" PRIMARY KEY (id); + ADD CONSTRAINT pk_otp_verifications PRIMARY KEY (id); ALTER TABLE ONLY freight.user_trade_access ADD CONSTRAINT "PK_94e21d7bfb20e57940e3255df87" PRIMARY KEY (id); @@ -2802,7 +2811,7 @@ ALTER TABLE ONLY freight.ff_clients ADD CONSTRAINT "UQ_4107fef2abf7128f890ef276244" UNIQUE (forwarder_company_id, client_company_id); ALTER TABLE ONLY freight.otp_verifications - ADD CONSTRAINT "UQ_5121c67380278afb68a84537266" UNIQUE (phone); + ADD CONSTRAINT uq_otp_verifications_phone UNIQUE (phone); ALTER TABLE ONLY freight.company_profiles ADD CONSTRAINT "UQ_539ff8f8225951adb2ef76b0313" UNIQUE (reference);