please could you please tell me what I am doing wrong? I have MySQl script but finally I got this
Error 1215: Cannot add foreign key constraints
Here is code:
CREATE TABLE IF NOT EXISTS profile_public_data
(
idProfile INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
login VARCHAR(64),
name VARCHAR(45),
lastName VARCHAR(45),
location VARCHAR(45),
is_active BOOLEAN DEFAULT false,
age TINYINT,
photo VARCHAR(45),
PRIMARY KEY(idProfile)
);
CREATE TABLE IF NOT EXISTS profile_private_data
(
idProfile INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
CONSTRAINT fk_idProfile
FOREIGN KEY(idProfile)
REFERENCES `profile_public_data`(idProfile)
ON DELETE SET NULL
ON UPDATE SET NULL,
email VARCHAR(45),
password VARCHAR(45),
PRIMARY KEY(idProfile)
);