Like me, if you got the message “#1005 – Can’t create table (errno: 150)” when creating a new table, then chances are that Google Search gave you information that this is a foreign key constraint error. You go back, look at your SQL to create table and you think the relation is perfectly fine. Not sure, why this would give me an error. In this case, this post will address your issue.
Assuming that the foreign key definition is correct, when you get the error 150 while creating a foreign key constraint, there is a subtle knowledge needed. And this knowledge is that both tables in the constraint, must be using same Storage Engine. If one table is using MyISAM and another using InnoDB, then you would get above error. So, always make sure that both tables in a RDMS Foreign Key are using same Storage Engine.
Hope this post helped you and if it did, then please make sure to leave a comment.