Circular Reference Error when Using Self-Reference in Table Definition with Drizzle-ORM
I encountered an error while defining a PostgreSQL table using Drizzle-ORM. The issue arises when attempting to create a self-referencing array column that references the primary key of its own table. The error message suggests that there is an issue with type inference possibly due to the self-reference.
Expected Behavior:
I expect to define a self-referencing column (dependencies_courses) that can store an array of course IDs, referencing the id column of the same course table without causing a type inference issue.
1 Reply
found this on Drizzle docs https://orm.drizzle.team/docs/indexes-constraints
which solved my problem
Drizzle ORM - Indexes & Constraints
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.