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 relationship between User and Group table is maintained using Membership table. I would like to maintain Membership status (approved/pending/something-else??) and Membership approver information as well. The membership approver will be one of the user in the admin group. Following is a rough schema that I have in my mind. I am new to database modeling and would like to get some feedback on following implementation. In particular I am not sure whether Membership table should have 'approved_by' column using 'user_id' FK or should I create a separate table for maintaining MembershipStatus(id, membership_id, status, approved_by)?? I am guessing having a separate table MembershipStatus is more appropriate here but not sure about it. Also, I am planning to use ActiveRecord as an ORM in this application. I appreciate any comments or suggestions in implementing this design/schema.
User:
id, Primary Key
userid, Integer, Unique
username, String, Unique
email, String, Unique
created_at, DateTime
updated_at, DateTime
Group:
id, Primary Key
groupid, Integer, Unique
groupname, String, Unique
created_at, DateTime
updated_at, DateTime
Membership:
PK(user_id, group_id)
status, String
approved_by, user_id FK to User table
created_at, DateTime
updated_at, DateTime
MembershipStatus
id
membership_id FK to Membership table
status, String
approved_by, user_id FK to User table
created_at, DateTime
updated_at, DateTime
-thanks