Issue #1817 - Fix foreign key creation for mysql

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.