<p>Well the table will need to reference the reported objects. I envisage a <code>user_reports</code> tables with columns along the lines of:</p>

<pre><code>id
user_id
object_type
object_id
reporter_id
</code></pre>

<p>Where <code>user_id</code> is the ID of the reported user, <code>object _type</code> and <code>object_id</code> form a polymorphic reference to the reported object (eg <code>DiaryEntry</code> and <code>23</code> or <code>DiaryComment</code> and <code>456</code>) and <code>reporter_id</code> is the ID of the user making a report.</p>

<p>There would need to be an index on <code>user_id</code> so we could find all reports for a user, and a unique index on <code>reporter_id+object_type+object_id</code> to make sure users can't report the same object twice.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/openstreetmap/openstreetmap-website/issues/841#issuecomment-63872474">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABWnLYyLTuoQWibtMyJGGkDQZJU7YyGXks5nPkQtgaJpZM4C-rMw.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
    <link itemprop="url" href="https://github.com/openstreetmap/openstreetmap-website/issues/841#issuecomment-63872474"></link>
    <meta itemprop="name" content="View Issue"></meta>
  </div>
  <meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>