'columns' does not exist in object passed to primaryKey() fn

Bootstrapped a project with CT3A@latest (drizzle-orm v ^0.28.5 in my package.json). I'm trying to create a composite primary key for a table, but the only way I've been able to get the primaryKey() function to work is to simple pass in comma separated table.columns (e.g. primaryKey(table.column1, table.column2, etc.)). I think because of the length of the column names that make up the composite primary key, I'm getting a MySQL error no. 1059 (identifier is too long). I can do primaryKey({ name: "custom_name"}), but I'm not sure how to designate the columns I want to make up the composite key, since the TS engine is telling me 'columns' doesn't exist on this object getting passed into primaryKey(). Are the docs not update with the most recent release? Is there a way to work around this, or should I use a previous release of drizzle-orm? TIA!
Indexes & Constraints - Drizzle ORM
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
2 Replies
Lalit Kapoor
Lalit Kapoor11mo ago
I believe this is also captured here - https://github.com/drizzle-team/drizzle-orm/issues/1532
GitHub
[BUG]: Can't Create Named Primary Key Constraint as Doc Suggests · ...
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 The docs show the following example when defining primary keys for a postgres t...
wheresthegold_
wheresthegold_10mo ago
Did you end up solving this..?
Want results from more Discord servers?
Add your server