Omesepelepe
Omesepelepe
DTDrizzle Team
Created by Omesepelepe on 12/18/2024 in #help
"There is not enough information to infer relation" with many to many query
That last locationsToTagsRelations relation bit was initially missing and I added it because I read that relations have to be made on both sides. I missed that I defined it as many in there instead of one. Simply changing it to the correct relation type worked right away, didn't have to change the query. Here's the updated code for reference:
export const locationsToTagsRelations = relations(
locationsToTags,
({ one }) => ({
tag: one(tags, {
fields: [locationsToTags.tagId],
references: [tags.id],
}),
location: one(locations, {
fields: [locationsToTags.locationId],
references: [locations.id],
}),
}),
);
export const locationsToTagsRelations = relations(
locationsToTags,
({ one }) => ({
tag: one(tags, {
fields: [locationsToTags.tagId],
references: [tags.id],
}),
location: one(locations, {
fields: [locationsToTags.locationId],
references: [locations.id],
}),
}),
);
Thank you for the help!
3 replies