title: has_one without belongs_to in ecto/phoenix/elixir
body: <h2>Problem</h2>
  <p>I have a <code>files</code> table and there are many other tables that create a one-to-one association, e.g. <code>users</code> might have a <code>avatar</code> and <code>posts</code> might have <code>photo</code>.</p>
  <h2>A possible solution</h2>
  <p>A possible solution would be to create <code>users_files</code> and <code>posts_files</code> tables and use <code>has_one :through</code>. However, this looks excessive.</p>
  <h2>The ideal solution</h2>
  <p>The ideal solution would be to define tables like this</p>
  <pre><code>users
   - avatar_id
  
  posts
   - photo_id
  </code></pre>
  <p>and have <code>with:</code> parameter in <code>has_one</code> so the schema looks like this</p>
  <pre><code>schema &quot;users&quot; do
      has_one :avatar, MyApp.FileDb, with: :avatar_id, foreign_key: :id #id is default
  
  end
  
  schema &quot;posts&quot; do
      has_one :photo, MyApp.FileDb, with: :photo_id, foreign_key: :id
  
  end
  </code></pre>
  <p>and that way you don't need to define a <code>belongs_to</code> on <code>files</code>. Is there a similar mechanism already? What is the standard way to deal with this in Phoenix?</p>