This commit is contained in:
ghost2023
2026-08-05 11:39:45 +03:00
parent 41f2fd8333
commit 1515667158

View File

@@ -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);