MySQL Forums
Forum List  »  MySQL Workbench

Re: Problems with foreign keys in MySQL
Posted by: Ahmet SABAN
Date: July 07, 2017 07:46AM

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;

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Problems with foreign keys in MySQL
486
July 07, 2017 07:46AM


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.