Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on Create self-referencing many-to-many relation
Post
Create self-referencing many-to-many relation
+0
−4
I've turned the tables movies
and scenes
into media
and now I don't know what to do with the movies_scenes
relation.
CREATE TABLE IF NOT EXISTS "movies_scenes" (
`movie_id` integer,
`scene_id` integer,
`scene_index` tinyint,
foreign key(`movie_id`) references `movies`(`id`) on delete cascade,
foreign key(`scene_id`) references `scenes`(`id`) on delete cascade,
PRIMARY KEY(`movie_id`, `scene_id`)
);
1 comment thread