-
-
Notifications
You must be signed in to change notification settings - Fork 476
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]: TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys') #2344
Comments
This should be fixed in |
Issue is still there after updating. tried with both 0.21.3 and 0.21.4 |
I can confirm the issue still exists even on 22 beta. As a variant of the problem, the same issue exists when renaming a table, not only a field. |
Also having the same issues
|
@sakulstra yes, the issue happens with any type of schema change. Just gave this one as a sample since it is very minor change. but it fails no matter what you do |
I ran into the same issue, and I suspect this is related to naming conventions (camelCase vs snake case). As an example:
this will correctly create the I converted my table names to snake case and it seems like this solved the issue |
I solved this issue by modifying the package source for diff --git a/bin.cjs b/bin.cjs
index e5e7558dc577c4fba1ca4fe508a5851b4e8f4c91..e42056bb4937c68c0598be71ea8b63cea437dccc 100755
--- a/bin.cjs
+++ b/bin.cjs
@@ -27620,7 +27620,7 @@ var init_jsonStatements = __esm({
tableName,
data: it,
schema: schema5,
- constraintName: json1.tables[`${schema5}.${tableName}`].compositePrimaryKeys[PgSquasher.unsquashPK(it).name].name
+ constraintName: json1.tables[`${schema5 || "public"}.${tableName}`].compositePrimaryKeys[PgSquasher.unsquashPK(it).name].name
};
});
}; |
I can confirm the issue is still there and that the above fix from @LavaToaster solves the problem. @LavaToaster would you like to submit a PR? @AndriiSherman could you please reopen the issue? |
@goldoraf drizzle kit is not open source yet. So, cannot. |
What version of
drizzle-orm
are you using?0.30.10
What version of
drizzle-kit
are you using?0.21.2
Describe the Bug
if I have tables with no composite primary keys(table => pk: primaryKey(....) , then i can change my column names and do whatever i want with no issue in push.
issues arises when:
everytime before pushing new version of the schema, i have to drop all my tables in db. otherwise
drizzle-kit push
command keeps failing with this error.Expected behavior
No response
Environment & setup
next.js 14 app router application
The text was updated successfully, but these errors were encountered: