stats table
This table includes a user’s stats. The stats table is defined as follows:
| id | wonGames | lostGames | scoredGoals | receivedGoals | userId |
|---|---|---|---|---|---|
| 1 | 3 | 1 | 8 | 4 | 3 |
| 2 | 7 | 4 | 3 | 10 | 2 |
| 3 | 1 | 5 | 4 | 20 | 12 |
- All stats are
0by default. - userId: the id of the user these stats correspond to.
- The
statstable and theusertable have a bi-directional OneToOne relation. - The
statstable is the “owner” of the relation, therefore it shows theuserIdcolumn. Even if the stats are not visible on theusertable, they are accessible asuser.statsbecause the stats are eagerly loaded byuserRepository’sfindmethods. - Every user has a corresponding stats row, and every stats row has a corresponding user.
- If a user is deleted, its stats are automatically deleted, but not the other way around.
- The