I guess this handling is why FOREIGN KEYs aren't created for composite foreign keys? Would it be better to just add FOREIGN KEY definitions in separate loop over all the foreign keys of the model? This would mean no inline foreign keys, but that doesn't seem too bad to me.