TrackGroups, Playlists, and UserGroups

Hey all, I have discovered a wrinkle about the current structure of the database that came out while working on the MySQL migration. (Just to clarify: this is without any additional tables being made. This is just the new tables from MySQL being moved into Postgres, and the consolidation of the MySQL “rsntr_users” (artists) table with the “UserGroup” table).

Users have multiple UserGroups (one of type band, musician, label, distributor). TrackGroups can be either playlists or albums. But! A TrackGroup belongs to a UserGroup (eg. an album belongs to a band). However, a Playlist would / should belong to a User, not a UserGroup. This wasn’t a problem before because we didn’t really distinguish between Users and UserGroups. Everyone was a potential artist / band / label / distributor.

I’m kind of seeing three ways forward.

  1. Create a second model Playlist. We’d have to change the import script to split out playlists and not-playlists during import. Not that big of a deal. Semantically I think this is my preference because Playlists are just such a different concept in a music player. This would probably also argue some of the ambiguity we currently have about it not being clear what TrackGroup a Track currently originally belongs to.
  2. Create a column on the TrackGroup called userId, which is different from the creatorId column. Playlists would fill the userId column and Trackgroups would fill the creatorId column. While running the import script we’d have to decide which one to fill dependent on the type of TrackGroup.
  3. Create a new UserGroup for “listeners”, which looks like it was the original intent of the database design, but in this case I’m not sure I see the point of there being a separate Role (member, artist, admin, superadmin) table as well. However, as far as I can tell the migration from Wordpress to user-api didn’t do this, only creating UserGroups for musicians (ie creators of tracks). Again this would require a migration and also potentially another pass over the WordPress data to import it.

I originally posted this in the Mattermost chat and got some responses from @matt_burnett @piper and @Hakanto

The general so far seems to be leaning towards splitting up the TrackGroup table into a Playlist primarily for Users and TrackGroup table for UserGroups.

Posting it here for transparency and also to get some more input!

4 Likes

After a couple of folks pitched in on Mattermost I’m going to go ahead and create a Playlist model!

4 Likes