title: Elegant schema to log users' actions
body: <p>I have a database schema to log operations users perform in my webapp:</p>
  
  <pre><code>Log
  ---
  Id
  Log_Type_Id
  Performed_by_Person_Id
  Performed_to_Person_Id
  Comment_Id
  Story_Id
  Photo_Id
  etc_Id
  
  Person_Log
  ----------
  Person_Id
  Log_Id
  </code></pre>
  
  <p>This way I can notify users of entries in their log with details about what exactly happened.  The problem is the Log table has to contain every possible type of user operation (they modified a story or comment, created a story or comment or photo, updated a profile, etc).  And almost all of those fields will necessarily be null for each entry.</p>
  
  <p>Ideally I have individual Log tables that the overall Log refers to, maybe something like:</p>
  
  <pre><code>Log
  ---
  Id
  Performed_by_Person_Id
  
  Log_Comment
  -----------
  Id
  Log_Id
  Comment_Id
  
  Log_Photo
  ---------
  Id
  Log_Id
  Photo_Id
  
  Person_Log
  ----------
  Person_Id
  Log_Id
  </code></pre>
  
  <p>The problem there is that I then don't have an easy way to notify users of things going on pertaining to them.  I easily get the log entry for them, but then I have to query each "child" table to see the specifics...  I can store the name of the child Log table in Log, but that seems so inelegant.  Is there a better, more relational, way of doing this that also works well with ORM systems?</p>