I fixed the create table errno: 150 reading better the mysql docs.
Special attention on this requiremet fo Innodb: foreign key columns are listed as the firstcolumns in the same order, see below, and, of course, check the docs…
InnoDBrequires indexes on foreign keys and referenced keys so that foreign key checks can be fast and not require a table scan. In the referencing table, there must be an index where the foreign key columns are listed as the first columns in the same order. Such an index is created on the referencing table automatically if it does not exist. This index might be silently dropped later, if you create another index that can be used to enforce the foreign key constraint.
index_name, if given, is used as described previously.