Not enough information to infer relation
I’m having an issue with my schema that is a migration from Prisma. For this particular issue, I have a
job
table, and a candidates
table, each of them has a many
relation to the other, so a job can have many candidates, and a candidate can have many jobs. When I try and run my project, I’m getting “There is not enough information to infer relation “job.candidates”.” Here’s my schema, can’t figure out what I’m doing wrong:
4 Replies
You want to have many to many relation yet you have no join table
That's basic SQL design you are missing on
You should create a table called
candidates_jobs
, where you will have columns candidate_id
and job_id
There will be one to many relationship between the join table and candidates, and one to many between the join table and jobs
Which will eventually form many to many relationshipDo you have an example? I'm trying to build out a new table based on what you're saying here and it's coming back with the same error.
Sure I do
I have another idea though
Watch this YT video
Sakura Dev
YouTube
Drizzle ORM #7- Many-To-Many Relations ⭐
❤️Please Support me by subscribing to my channel 👉🏻https://www.youtube.com/@sakuradev?sub_confirmation=1
Many-To-Many Relations has Always been tricky but In this episode of Drizzle ORM Comprehensive Course, You will Master how to create Many-To-Many Relations with Drizzle ORM.
📖 Drizzle ORM Playlist: https://www.youtube.com/playlist?list=PLhn...