Fix foreign key creation for mysql

(Previously filed as issue #1817)

When creating a foreign key that is also a primary key, the mysql query
generator does not move the foreign key definition from the inline
attribute to the end of the table definition.