Many to many join tables? #985
-
In the Getting Started (v3) video there is an example of using a join table like so: create table tags_videos (
video_id int not null,
tag_id int not null,
primary key (video_id, tag_id),
foreign key (video_id) references videos (id),
foreign key (tag_id) references tags (id)
); Now obviously this is good for finding all of the tags a video has, but what if we want to find all of the videos that a tag is associated with? Naturally, I would want to create a secondary index: My question is would sqlboiler transparently pick up on this direction of the join table as well? I know it will for the videos -> tags as shown in the example. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
sqlboiler does both directions when it sees something like this. Also the index is optional and varies by use case, you don't need to create one for sqlboiler to understand that, the join table itself is enough. |
Beta Was this translation helpful? Give feedback.
sqlboiler does both directions when it sees something like this. Also the index is optional and varies by use case, you don't need to create one for sqlboiler to understand that, the join table itself is enough.