title: Organizing Database Structure
body: <pre><code>TABLE presentation {
      id BIGINT
      unique_id BIGINT
      name VARCHAR (128)
      description VARCHAR (256)
      updated_at TIMESTAMP
      created_at TIMESTAMP
  }
  </code></pre>
  
  <p>I'm creating an application that allows users to create presentations. Each presentation is built within a layout, each layout contains several positions, each position is occupied by an asset (text, image, video).</p>
  
  <p>I'm trying to figure out the best way to make the connection between my presentation, layout and assets.</p>
  
  <p>Initially, I was thinking of having a table for <code>presentations</code>, <code>layouts</code>, <code>positions</code>, <code>assets</code>. I obviously need this schema to be flexible, so I can add several new <code>layouts</code> with a different number of positions.</p>
  
  <p>I could just create my <code>presentation</code> table like so:</p>
  
  <pre><code>TABLE presentation {
      id BIGINT
      unique_id BIGINT
      name VARCHAR (128)
      description VARCHAR (256)
      position1 (BIGINT) - would contain an asset_id
      position2 (BIGINT) - would contain an asset_id
      position3 (BIGINT) - would contain an asset_id
      position4 (BIGINT) - would contain an asset_id
      updated_at TIMESTAMP
      created_at TIMESTAMP
  }
  </code></pre>
  
  <p>But this is extremely shortsighted and only allows for 4 total positions within a presentation ... but I'd be on my way to bigger and badder things by now.</p>
  
  <p>Or, I somehow make a connection between <code>presentations</code>, <code>layouts</code>, <code>positions</code> and <code>assets</code> that would allow for total flexibility ... and this is what I'm trying to get some help with.</p>
  
  <p>I'm not quite sure if I'm over thinking this, or not... the bottom line is that I'm really not sure how to make the proper connection between these models.</p>