How to reference the same table in the table's definition?

I am defining this table menuItem and I want this table to support multi-levels, so I am adding a parentId column that should reference this own column id. How should I do it with Drizzle ORM? My attempt failed with a TypeScript error, as you can see in the printscreen. I am using postgres, if that matters. Thank you!
No description
1 Reply
nelsonprsousa
nelsonprsousaOP9mo ago
Just found the answer, sorry about this post. https://orm.drizzle.team/docs/indexes-constraints#foreign-key
Drizzle ORM - Indexes & Constraints
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Want results from more Discord servers?
Add your server