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?

  • 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.