Drizzle ORM: Inferring Relation multiple Many to one relation

Hi everyone,

I'm working on a project using Drizzle ORM in a Next.js environment and I've run into a snag. My goal is to set up a database schema for an educational platform where courses have dependencies on other courses. Specifically, I'm trying to establish two types of relationships in my courses table:

Course Dependencies: Identifying the prerequisite courses for a given course.
Dependent Courses: Listing the courses that depend on a given course as a prerequisite.
However, I'm encountering an error when trying to infer the relation for dependentCourses in my courses table. Here's the error message I received:

Error
Error: There is not enough information to infer relation "__public__.courses.dependentCourses"
    at normalizeRelation [...]
    at Command.<anonymous> [...]

Node.js v21.4.0
Was this page helpful?