I have this task to design a database schema for a simple audio content streaming application, and I have questions about what would be the best way to store relations between tracks and playlists.
I have these ideas in mind:
<code>track
- id
- url
- title
playlist
- id
- userId
- name
- tracks (json format)
</code>
<code>track
- id
- url
- title
playlist
- id
- userId
- name
- tracks (json format)
</code>
track
- id
- url
- title
playlist
- id
- userId
- name
- tracks (json format)
But I have also heard about junction tables where the design would be
<code>track
- id
- url
- title
playlist
- id
- userId
- name
playlist_track
- id
- track_id
- playlist_id
</code>
<code>track
- id
- url
- title
playlist
- id
- userId
- name
playlist_track
- id
- track_id
- playlist_id
</code>
track
- id
- url
- title
playlist
- id
- userId
- name
playlist_track
- id
- track_id
- playlist_id
Would the second design be and issue? Because if each users creates many playlists, the data stored in playlist_track
would increase infinitely over time.
Thanks in advance if someone can help me understand what would be the best design/solution here 🙂