in

Failed to create table because of foreign key constrains


I’m trying to create three tables but I get error on the last one regarding its foreign key, I made sure that the foreign key has the same type in the two tables, same specifications, and it is a primary key in the parent table.
I tried also solutions that were suggested in previous posts but the situation wasn’t the same so it didn’t work.

CREATE TABLE Movies (
   movie_title VARCHAR(86), 
   imdb_id VARCHAR(9), 
   movie_id INT, 
   runtime INT, 
   budget INT, 
   revenue INT, 
   release_date DATE, 
   vote_count INT, 
   vote_average DOUBLE, 
   popularity DOUBLE, 
   language VARCHAR(2), 
   tagline VARCHAR(221), 
   overview TEXT(992), 
   PRIMARY KEY (movie_id), 
   FULLTEXT idx (overview)
);

I get: SUCCESFULLY CREATED TABLE Movies

CREATE TABLE Movie_Genre (
   movie_id INT,
   genre_id INT,
   PRIMARY KEY (movie_id, genre_id),
   FOREIGN KEY (movie_id) REFERENCES Movies(movie_id)
);

I get: SUCCESFULLY CREATED TABLE Movie_Genre

CREATE TABLE Genres (
   genre_id INT,
   genre_name VARCHAR(15),
   PRIMARY KEY (genre_id),
   FOREIGN KEY (genre_id) REFERENCES Movie_Genre(genre_id)
);

I get:

Failed to add the foreign key constraint. Missing index for constraint 'Genres_ibfk_1' in the referenced table 'Movie_Genre'



Source: https://stackoverflow.com/questions/70631366/failed-to-create-table-because-of-foreign-key-constrains

HostMatch V 1.0 — Like Tinder for podcast hosts

Python scripts for a generic performance testing infrastructure using Locust