1

After trying to use the Propel PHP ORM on my database, I noticed that there is an issue with foreign keys. This is a table with foreign keys:

CREATE TABLE `appusers` (
`AppID` INT(11) NOT NULL,
`UserID` INT(11) NOT NULL,
`Enabled` TINYINT(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`AppID`, `UserID`),
INDEX `FK_AppUserID` (`UserID`),
CONSTRAINT `FK_AppUserID` FOREIGN KEY (`UserID`) REFERENCES `users` (`ID`) ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT `FK_UserAppID` FOREIGN KEY (`AppID`) REFERENCES `apps` (`ID`) ON UPDATE CASCADE ON DELETE CASCADE 
);

Notice how the foreign keys reference the tables users/apps with column ID.

When I show the create code for the table again, this is what happens:

CONSTRAINT `FK_AppUserID` FOREIGN KEY (`UserID`) REFERENCES `users` (`id`) ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT `FK_UserAppID` FOREIGN KEY (`AppID`) REFERENCES `apps` (`id`) ON UPDATE CASCADE ON DELETE CASCADE 

The foreign keys now reference the tables users/apps with column id. Every time a foreign key is created, the column on the referenced side is turned into lowercase. This is not correct, mysql does not have an issue with this but the PHP ORM certainly does.

Engine for all my tables is InnoDB and they all use the collation latin1_general_cs.

Does anyone know why it's doing this and what I can do to fix it?

New contributor
user265889 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • What is the "it" that you think is doing "this"? – mustaccio Feb 11 at 13:17
  • What Operating System? – Rick James Feb 12 at 3:43

Your Answer

user265889 is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.