Need some help with the schema for "card game as a service"
Specifically, I'm working on a Cards Against Humanity "as a service" project. So in theory, I have the follow tables/models
teams
players
games
cards
some unknown model that is the pivot between players/games and cards
What I'm struggling with is how to maintain deck integrity. Meaning, there can be multiple concurrent games existing at the same time, each getting their own complete set of cards (a deck). Within each active game, it's important to make sure that the functionality is similar to a single, physical deck, where you can't have (for example) two King of Hearts show up.
The above logic leads to a schema similar to this
My issue is that when you start write the code for the above, "decks" stops making sense. ie A player has many decks. wha?
From your schema i dont see the direct relationship between team and deck. A player plays in a team and a team plays a game. Would create a table for gamedeckcard. The pk is game id deck id and card id and has a played attribute. You can then update this table with the used and available cards
Also i hope its a cards against humanity like game and your not just copying the content as that is very ropey on a copyright front!