You may or may have not already stumbled upon this rather obscure error message (no, I'm not starting a serie on obscures error messages). Well the first thing to think when you encounter this is your foreign keys. This message generally denotes a failure in foreign keys creation, for example when the two columns you are trying to link are not of the exact same type (that is, you can't link an integer(4) to an integer(11)).
Now what if you are absolutely certain that your two columns are of the same type ? I just had the problem with this piece of doctrine schema (simplified for example purpose):
Media:
columns:
image: { type: string(255), notnull: true, unique: true }
ExplorationMission:
columns:
probe_image: { type: integer, notnull: true }
relations:
ProbeImage: { class: Media, local: probe_image, foreign: id, onDelete: 'SET NULL' }
Can you spot the problem ?
It's rather obvious when you know it, but I spent rather some time cursing mysql in vain. The point is that there is a major logic error in this schema. it declares the probe_image as NOT NULL while it gently asks the FK to set it null on delete. See ?
Hope it saves some frustration :-)