Finalizing the Design of Data Model
Let's take a look at interactions between tables to make changes to the data model.
We'll cover the following...
Interactions between tables
Let’s do the last pass and see if the interactions between the tables look good. In particular, we’re looking for any implicit assumptions that should either be eliminated or made explicit. We also want to avoid duplication of data where possible. That sort of analysis here might reveal a few insights.
Hard-coded fields
First, we see that three languages are hard-coded into the data schema in the user model with the num_en
, num_fr
, and num_es
fields. Any sort of hard coding carries with it some implicit assumptions that changes will be rare. Conceptually, these counts are part of a one-to-many relationship. That is, a single user could have games in zero, one, or many languages. There are a few options we have:
-
The full-strength solution for this is to make a separate table that tracks each language as a separate row and then to link between the tables using id fields. This is a valid solution, but for only three distinct subfields that will possibly never be changed, it’s a lot of schema details to manage. ...