Clan with members and admins Database Design

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 ?


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.

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *