mysql - Database structure suggestion (serialization or separate table) -
i making database, , truth told i'm not @ (kinda being forced it). game database, , have table called game_table use storing game sessions users create.
the question is, best way store list of invited users, requested users, confirmed users, declined users , pending users? serializing user ids (e.g. invited users = "11235|2510|34630|45715|64530"). however, main problem field becomes not searchable, , becomes problem if want retrieve list of games user invited to. solve problem, store separate field in user_table invited_games (also serialized game ids).
the problem that, is getting hard maintain whenever want add new features, , easy make mistakes keeping serialized data in sync. better have separate tables like:
invited_users_table
game_id | user_id 51 | 5193 51 | 10458 51 | 235 901 | 1536 901 | 4573
or there other better way of storing these types of data? please help, , thanks!
from say, sounds need 1 table 3 columns:
- gameid
- userid
- usertype
the latter take on values such "invited", "confirmed", "requested" , on.
you want separate tables if had more information different groups. instance, might have "who invited" column invited users, or "confirmation time" confirmed users. if number of specific columns needed different groups large-ish, might want think more complex data structure. if there handful of such columns, can add them table described above.
Comments
Post a Comment