· 7 years ago · Sep 02, 2018, 10:50 PM
1Mysql error with converting from myISAM to innodb
2Error 1452 : Cannot add or update a child row: a foreign key constraint fails (`s2794971db/ProfileInterests`, CONSTRAINT `ProfileInterests_ibfk_2` FOREIGN KEY (`InterestID`) REFERENCES `Interests` (`ID`))
3
4create table if not exists Users (
5 ID int not null auto_increment primary key,
6 FirstName varchar(40) not null,
7 LastName varchar(40) not null,
8 UserName varchar(40) not null,
9 UserEmail varchar(40) not null,
10 UserDOB timestamp not null,
11 UserJoin datetime not null
12);
13
14create table if not exists Interests(
15 ID int not null auto_increment primary key,
16 Interests varchar(40) not null
17);
18
19create table if not exists ProfileInterests (
20 userID int not null References Users(ID),
21 InterestID int not null References Interests(ID),
22 MiddleID int not null auto_increment primary key
23);
24
25create table if not exists ProfileInterests (
26 userID int not null,
27 InterestID int not null,
28 MiddleID int not null auto_increment primary key
29);