Fix db:schema:dump when foreign key column name is not 'id'

This pull request should address #409. Actually #264 solves this error then added a test to avoid regressions.