I am studying database relationships with Ecto at the moment and I recall reading about the foreign key. The following is an excerpt from that page:
:foreign_key - Sets the foreign key field name, defaults to the name of the association suffixed by _id . For example, belongs_to :company will define foreign key of :company_id . The associated has_one or has_many field in the other schema should also have its :foreign_key option set with the same value.