Re: Problems with foreign keys in MySQL
The problem with the last command was a missing primary key. I added the missing command in the new SQL script I am generating before the ALTER TABLE command:
ALTER TABLE `test_apptest`.`Rights` ADD CONSTRAINT PRIMARY KEY (ID);
ALTER TABLE `test_apptest`.`Roles_have_Rights`
ADD CONSTRAINT `fk_Roles_have_Rights_Rights1`
FOREIGN KEY (`Rights_ID`)
REFERENCES `test_apptest`.`Rights` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
ENGINE = InnoDB;
Subject
Views
Written By
Posted
4082
July 07, 2017 03:46AM
760
July 07, 2017 07:05AM
Re: Problems with foreign keys in MySQL
486
July 07, 2017 07:46AM
470
July 07, 2017 07:52AM
478
July 11, 2017 05:39AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.