-
-
Notifications
You must be signed in to change notification settings - Fork 643
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 |
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
|
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. |
why is this marked as closed? can you reopen this? 🙏 |
+1 to reopening this. Using |
Experiencing this issue as well when attempting to rename a table during both |
Same issue on my end |
Yep getting this issue as well. Whatever schema change I make, when I run push I just get that error |
Yeah same issue here |
@AndriiSherman, could you please reopen this issue? It is still present. @LavaToaster's solution is working, but it would be great if the patch landed in drizzle-kit. Thank you! |
The issue still persists in
|
Yes, the issue still persists. This error is triggered once I run the generate command. I get this error once I rename a table name (snake case) with a composite prime key. Versions: Please re-open it |
I am on latest versions "drizzle-orm": "^0.31.2" Drizzle is not usable without solving this issue and it's closed!!!! it's almost 2 months :/ Thanks for @LavaToaster I can continue working! Please reopen the issue... |
Just want to point out that this is open source software and there are real good people behind making it, putting in a ton of work, benefiting a lot of people |
Still people are getting paid working on it, correct me if am wrong. |
I can't speak to that, but I can say that even if I was getting paid to work on Drizzle, a comment like "what a joke" would be pretty off-putting and not feel that good to hear. I'm all for keeping this a supportive environment |
Sorry if anybody took it offensively, but almost 2 months for 1 line fix kinda funny no 😅 |
Hey everyone, sorry for the late response. I was really busy with other features we were working on. Let me push the patch update now so you can be unblocked |
@LavaToaster thanks a lot! |
Ok, yeah, it was my bad for not adding |
please check |
+1 with |
+1 I encountered this issue when running the drizzle-kit generate command. The process started as expected, resolving enum and table conflicts, and renaming columns. However, it threw a TypeError related to compositePrimaryKeys after resolving all conflicts.
Here’s the output leading up to the error:
|
I'm currently experiencing this issue on
Are there any known workarounds? This is a fairly serious blocker for us. |
For me the only thing that worked was DROPing the table and then runnning the Drizzle scripts again. I know this won't work well in production, but it worked for me. |
I've run into this error by renaming a table without any composite primary keys (though it does have a composite index) on
|
Well for all of you guys struggling with this there is a temporary workaround until they fix this. 1 - Go to the last I hope this is clear enough and if you wanna be sure you don't break the db, don't rename multiple tables at once its gonna be easier to handle for you |
this helped me out, thanks. was running into this with: |
I know this doesn't help solve the issue, but I will comment anyway. We migrated to prisma Why: Actually think before using anything. Don't just use what people say is good, e.g., "Theo," "Prime," "Josh," and a lot more. It may be good, but first look at your use case, and then judge if it's good or not. Don't use alpha/beta libraries in production. it may be obvious, but shiny things can sometimes cloud judgement. |
I haven't seen any benefit from drizzle except the Drizzle studio UI 😉 which you can't even deploy and use. Prisma for schema and migration + Kysely. |
Prisma Studio was actually the inspiration behind Drizzle Studio. 😉 |
Using Prisma is wild. It’s so slow. Requests per second is a terrible
benchmark. Prisma queries are extremely unoptimized. All of these drizzle
errors are actually quite simple to overcome with basic knowledge of SQL.
Prisma is a prime example of why people hate ORMs. Drizzle is a prime
example of why ORMs can work. Migrating to Prisma is not a solution. Anyone
who has actually used Prisma can tell you that.
…On Sat, Oct 5 2024 at 3:50 AM, Abdullah Mohammed ***@***.***> wrote:
I know this doesn't help solve the issue, but I will comment anyway.
We migrated to prisma
Why:
1 - Mature/Stable/Feature-rich.
2 - Prisma TypedSQL
3 - Great DX
4 - Fast development
5 - Speed is used to market Drizzle ORM. Prisma is fast. On the benchmark
they made, it shows that Prisma can handle 2.4k req/sec, in other words,
8,640,000 req/hour. 😅 Come on now, do you really think you will hit that
number any time soon? Most apps will not early on. Also, you have a lot of
room for optimizations like caching, rate limiting, etc. If your app REALLY
cares about performance, then sure, you could use Drizzle ORM or Kysely,
but not many products do. Although now Prisma is introducing TypedSQL,
which is the best of both worlds, it's not worth it to use Drizzle ORM or
Kysely.
Actually think before using anything. Don't just use what people say is
good, e.g., "Theo," "Prime," "Josh," and a lot more. It may be good, but
first look at your use case, and then judge if it's good or not. Don't use
alpha/beta libraries in production. it may be obvious, but shiny things can
sometimes cloud judgement.
I haven't seen any benefit from drizzle except the Drizzle studio UI 😉
which you can't even deploy and use.
Prisma for schema and migration + Kysely. is the best combo I found don't
even mention performance or DX.
Prisma Studio was actually the inspiration behind Drizzle Studio. 😉
image.png (view on web)
<https://github.com/user-attachments/assets/1beb6b92-05e5-41ed-a870-c34a1e727d09>
—
Reply to this email directly, view it on GitHub
<#2344 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFAHO2WSDLDCPZQGO4NIIN3ZZ6Y5TAVCNFSM6AAAAABH4XHQ46VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJVGAYDANRWHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Ah yes, Prisma—the villain of ORMs. Funny how Dub processes tons of data daily without 'unoptimized' issues. Maybe it's not Prisma, but skill issues 😉. Keep in mind that this Drizzle issue has been open for more than two months with a one-liner fix just sitting there :) |
“Ah yes,” funny how I don’t even know what Dub is. It must be irrelevant
just like your comments here “😉.” If you don’t have a solution then take
your comments somewhere else
…On Sat, Oct 5 2024 at 9:23 AM, Abdullah Mohammed ***@***.***> wrote:
Ah yes, Prisma—the villain of ORMs. Funny how Dub processes tons of data
daily without 'unoptimized' issues. Maybe it's not Prisma, but skill issues
😉.
Keep in mind that this Drizzle issue has been open for more than two
months with a one-liner fix just sitting there :)
—
Reply to this email directly, view it on GitHub
<#2344 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFAHO2QHQABJ2PVFHYLYVYDZZ775ZAVCNFSM6AAAAABH4XHQ46VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJVGA4TCNBTGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Haha, I know, it’s funny! Check out Dub. Also, maybe you know Cal.com? You should check out what Prisma has been doing lately! |
Drizzle - the ORM that doesn't patch fast enough :D |
Yeah save the generation use kysely 🤣 |
I am sorry for making this mess, i shouldn't have commented here. please stop! |
For people that just landed here and are lost in all the spam, this comment is the temporary workaround 🔝 |
Getting this issue as well when renaming a table/column and running
|
Was fixed in |
I tried with
|
This is a different error though. Might be worth creating a new issue that is separate from this one with steps to reproduce this bug. |
@L-Mario564 Kindly check it out #3539 |
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: