Failing to Create Foreign Keys (errno 150) + Solution
Oct 19, 2010 · 1 minute readCategory: mysql
This is post is now quite old and the the information it contains may be out of date or innacurate.
If you find any errors or have any suggestions to update the information please let us know or create a pull request on GitHub
If you are getting errno 150 then take a look at the data types for the two fields that you are trying to relate to each other.
I had issues in Magento creating foreign keys against the customer_entity and sales_flat_order tables (entity_id columns). Turns out the issue was that these columns were set to UNSIGNED on the Magento tables, yet my tables columns did not have this attribute.
Set your columns to UNSIGNED (and otherwise double check the datatypes are the same) and I bet it will all work for you.