PgEnum Error on relation

error: column "xxxxxxxxxxxxxxx_name" of relation "xxxxxxxxxxxxxxxx" does not exist I cannot understand why i get this error.
No description
No description
7 Replies
adrtivv
adrtivv3mo ago
try this
wholesalerName: wholesalerNameEnum("wholesaler_name").notNull()
wholesalerName: wholesalerNameEnum("wholesaler_name").notNull()
David
David3mo ago
is there a reason why drizzle doesnt just grab the key name instead of having you passing a string with the name?
adrtivv
adrtivv3mo ago
i just remembered having this problem a few months ago and this solved it as for your question, i think the issue with mapping could be this: https://orm.drizzle.team/docs/sql-schema-declaration#camel-and-snake-casing
Drizzle ORM - Schema
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
David
David3mo ago
oh that's really interesting, didn't know that was a thing thanks!
adrtivv
adrtivv3mo ago
so for example, instead of mapping wholesalerName as wholesaler_name, it might be mapping it to wholesalername, probably
David
David3mo ago
Removes alot of headackes, cuz i sometimes change the key names and forget to change the strings if you wanted to do that you could just do {"first_name": something}, but yea it works
roze789
roze789OP2mo ago
yes, I finally found it out you must add keys even for FK

Did you find this page helpful?