Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Can't create composite primary key on existing table with 0.21 #420

Closed
aldebout opened this issue May 20, 2024 · 6 comments
Closed

Comments

@aldebout
Copy link

aldebout commented May 20, 2024

With 0.21.2, after following the migration guide including running up, generate fails to create a migration for the following change to an existing table (only change):

+ (t) => ({
+     pk: primaryKey({ columns: [t.userId, t.courseId] }),
+   })

Error: TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys').

Dialect is postgres.

userId and courseId are both FKs to other tables, the table I'm creating the PK on is a M2M join table.

Reverting back to 0.20.18 I have no issue generating the migration.

@AlexBlokh
Copy link
Contributor

hey, @aldebout
which dialect is this,postgres?

@aldebout
Copy link
Author

hey, @aldebout
which dialect is this,postgres?

Yes it is, sorry for not including it, I edited.

@AlexBlokh
Copy link
Contributor

fixed that, will be in the next upcoming release

@AndriiSherman
Copy link
Member

This should be fixed in drizzle-kit@0.21.3. If the issue persists, feel free to reopen it!

@jasonpanosso
Copy link

I still have this issue on v0.21.4, same exact scenario

@ivoilic
Copy link

ivoilic commented Jun 20, 2024

Same issue with postgres and v0.22.7

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

No branches or pull requests

5 participants