PRIMARY KEY (`user_email`, `Department_faculty_name`, `Department_department_name`, `Faculty_faculty_name`),įOREIGN KEY (`Department_department_name`, `Department_faculty_name`) `Department_faculty_name` VARCHAR(50) NOT NULL, `Department_department_name` VARCHAR(50) NOT NULL, `Faculty_faculty_name` VARCHAR(50) NOT NULL, `contact_office_telephone` VARCHAR(15) NULL, `contact_number_mobile` VARCHAR(15) NULL, `user_password_hash` VARCHAR(50) NOT NULL, REFERENCES `rech_system`.`Faculty` (`faculty_name`)ĬREATE INDEX `fk_Department_Faculty_idx` ON `rech_system`.`Department` (`faculty_name` ASC) ĭROP TABLE IF EXISTS `rech_system`.`Person` ĬREATE TABLE IF NOT EXISTS `rech_system`.`Person` ( PRIMARY KEY (`department_name`, `faculty_name`), SET SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES' ĬREATE SCHEMA IF NOT EXISTS `rech_system` DEFAULT CHARACTER SET utf8 ĭROP TABLE IF EXISTS `rech_system`.`Faculty` ĬREATE TABLE IF NOT EXISTS `rech_system`.`Faculty` (ĭROP TABLE IF EXISTS `rech_system`.`Department` ĬREATE TABLE IF NOT EXISTS `rech_system`.`Department` ( See full database SQL below: ( You can import this into MySQL Workbench to see Entity models) - MySQL Script generated by MySQL Workbench Searching on DBA Stackexchange, simple human errors caused issues, none which appear to relate to my issue: See 1) 2) - Possible causes of 1215 error Overall, the most likely problem which appears is a lack of an index from the parent (identifying) entity where multiple columns are indexed. The Error occurs when adding table Person (and I suspect table Message may give the same issue too) Error 1215: Cannot add foreign key constraintĮrror while running my MySQL schema code generated from the EER Diagram I used to model my database.
0 Comments
Leave a Reply. |