Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6818923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:14:14+00:00 2026-05-26T21:14:14+00:00

I am trying to create User, Group and Membership tables as follows. A User

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:14:15+00:00Added an answer on May 26, 2026 at 9:14 pm

    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
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem when trying to create a membership for users based on
I have 3 tables: user_transaction, transaction and users I am trying to create a
I am trying to create a script to batch mark a group of users
I have 4 models, Message, Group, User, Membership class Group < ActiveRecord::Base has_many :memberships
I'm trying to create a Christmas user group on my forums, and would like
I have a basic Users / Memberships / Groups I want a user to
I'm trying to create user group for registered in SQL Server 2008. This is
I'm trying to create user profiles for my site where the URL is something
I'm trying to create User Control which will work like a rich button. It's
Im trying to create a user control menu where links to a page's usercontrols

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.