0

I want to create some clans in my game... And they can have some admins with some privileges...

Am I need to create 2 tables one of them for clan info and one of them for clan members ?

  • Yes, that would be the minimum you would need. The clan members table would basically be the many to many table (logically) in between the clan table and the user table. – Adam Zuckerman Aug 15 '16 at 22:17
  • Why not adding a "Clan" column and "Clan_Privilege" column to users table? – M4HdYaR Aug 15 '16 at 22:20
  • You can do as you suggest, but if you add some referential integrity, you could delete a clan and automatically remove any clan members. The clan members table will allow the flexibility for your users to be members of multiple clans. – Adam Zuckerman Aug 15 '16 at 22:26
1

I would create a table for Clans that would include all of the relevant information for that clan. I would also create a many to many table between the Clans and Users tables. Add foreign key references to both tables to limit data issues. You will need to see if your database supports cascading deletes (I think MySQL does). That will allow your admin/clan leader to delete a clan, automatically removing all of the clan members.

If you later decide to allow your users to be a member of multiple clans, you have already built the framework to support it.

Alternatively, you can extend your existing User table to include the clan membership for the user. This will work if you only ever want the user to be a member of 1 clan. It will make removing the clan members a little more difficult than using the cascading deletes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.