findmypast-oss / mssql_ecto

Ecto adapter for Mssqlex
Apache License 2.0
49 stars 20 forks source link

Associations do not work with non-standard primary keys #39

Closed cpursley closed 6 years ago

cpursley commented 6 years ago

When using non-standard primary keys in a legacy database schema, mssql_ecto associations are building out incompatible foreign keys.

An example primary key source in the database is UserID while the ecto alias of that is user_id. Mssql creates a foreign key like user_id_id.

cpursley commented 6 years ago

has_many works, but it only returns one result.

jbachhardie commented 6 years ago

I'll try to take a look at this but I don't have much time at the moment so any help would be appreciated.

cpursley commented 6 years ago

Turns out the bug was in my head, not the code ;)

Closing.