Modeling User, Group and Membership database tables

前端 未结 1 932
攒了一身酷
攒了一身酷 2021-01-15 04:15

I am trying to create User, Group and Membership tables as follows. A User may belong to one or many groups and a Group may have one or many users. The many-to-many relation

1条回答
  •  伪装坚强ぢ
    2021-01-15 04:38

    looks pretty good.

    You show approved_by in 2 tables. If you keep the MembershipStatus table, then that is where is should belong. also -the name 'approved_by' implies the status of 'approved' which may or may not exist. you might think of another name...

    you should also have a table probably that identified which Users are admins for which groups. that way you can code up database side security for who is allowed to approve as well as store who actually did approve.

    also, I am not a big fan of storing audit history in the table as you are showing. Either use the database built in audit, or pull that out to another table to record audit history.

    finally, id, and userid seem redundant. go with userid. (similar on other tables)

    0 讨论(0)
提交回复
热议问题