© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•11mo ago•
1 reply
Kevintyj

Fixes for composite PK?

https://github.com/drizzle-team/drizzle-orm/issues/3383
Referencing this issue, using composite primary keys like the author here with
errno: 1553
errno: 1553
on subsequent pushes, took a look at the migration code that was generated and it seems like its not dropping the foreign key constraints and drop and recreating the primary key. Tried using pnpm patch to patch drizzle with the suggested fix here: https://github.com/drizzle-team/drizzle-orm/issues/1428#issuecomment-1916722940 but it did not fix the issue as I am using named primary keys. Cannot seem for the life of me get this to work. Do I have to manually create migrations and fix such issues or what is the proposed solution? Seems like using composite primary keys is one of the most used SQL features and donno why more people haven't ran into this issue. Would love to see if anybody has fixses for the issue?
GitHub
BUG: References in primary key · Issue #3383 · drizzle-team/drizz...
Here my schema: export const tableA = mysqlTable("tableA", { id: int("id").primaryKey(), }); export const tableB = mysqlTable("tableB", { id: int("id").prima...
BUG: References in primary key · Issue #3383 · drizzle-team/drizz...
GitHub
[BUG]: ER_WRONG_AUTO_KEY - Drizzle Kit not detecting primary keys ...
What version of drizzle-orm are you using? 0.28.6 What version of drizzle-kit are you using? 0.19.13 Describe the Bug Drizzle-kit isn't introspecting the correct primary keys from planet scale....
[BUG]: ER_WRONG_AUTO_KEY - Drizzle Kit not detecting primary keys ...
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Composite PK
Drizzle TeamDTDrizzle Team / help
2y ago
MySQL UUID as PK
Drizzle TeamDTDrizzle Team / help
3y ago
Composite Primary Key?
Drizzle TeamDTDrizzle Team / help
16mo ago
nullsNotDistinct on composite unique
Drizzle TeamDTDrizzle Team / help
2y ago