© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•2y ago•
1 reply
Nelson Sousa

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

I am defining this table
menuItem
menuItem
and I want this table to support multi-levels, so I am adding a
parentId
parentId
column that should reference this own column
id
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!
image.png
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Reference the same table
Drizzle TeamDTDrizzle Team / help
2y ago
Circular Reference Error when Using Self-Reference in Table Definition with Drizzle-ORM
Drizzle TeamDTDrizzle Team / help
2y ago
Get table definition?
Drizzle TeamDTDrizzle Team / help
2y ago
relations to the same table
Drizzle TeamDTDrizzle Team / help
2y ago