Skip to content

fix(generate): drop a plain index where a unique one covers the same columns - #149

Merged
cultron merged 1 commit into
mainfrom
fix/unique-and-index-collision
Oct 4, 2026
Merged

cultron merged 1 commit into
mainfrom
fix/unique-and-index-collision

Conversation

@cultron

@cultron cultron commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Prod svc 52's schema has both {fields:[manager_email]} and {fields:[manager_email], unique:true} on Warehouse. TypeORM names both IDX_2fab7864…, so the second CREATE INDEX fails (42P07) and schema:sync rolls back. apso test smoke caught it before a real first deploy hit it.

parseApsorcV2 now runs dedupeIndexes on every entity: the unique index is kept (it serves lookups too), the plain one and exact duplicates are dropped. Applies to TS, Python and Go.

Verified on svc 52's current schema: released 0.42.0 fails at schema; with this change generate + build + test smoke pass on all entities. New unit test; 377 tests, lint 0 errors.

…columns

TypeORM names an index from its table and columns only, so a plain and a
unique index on the same columns get one name; the second CREATE INDEX fails
and schema:sync rolls back (prod svc 52, Warehouse.manager_email). The
parser now keeps the unique index and drops the plain one and exact
duplicates, for every language.
@cultron
cultron merged commit 9a4afa2 into main Oct 4, 2026
4 checks passed
@cultron
cultron deleted the fix/unique-and-index-collision branch October 4, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant