Home > Mobile >  How to better organise database table structure design like this?
How to better organise database table structure design like this?

Time:10-25

I have the following tables structure for my database:

users
event_user
events
event_user_histories
event_user_reviews
locations

My business rules are:

  1. User can select and join many events, and an event can be joined by many users.
  2. User will need to pick an event and a location to participate in the event. The event_id, location_id, user_id, status, related data etc. will be stored in event_user. And this table will has primary key to link with event_user_histories and event_user_reviews.
  3. After that, user will need to submit review content and waiting to be approved, which the data will be stored in event_user_reviews.
  4. There will be status change record in event_user_histories when user submit the review content, status like content submitted, pending for review, review in progress, etc.

May I know am I doing correctly for my database design, or any suggestions to simplify it? Any advice would be appreciated.

CodePudding user response:

I think you not need event_user_histories and event_user_reviews

You can store review content and status to event_user table. Because 1 user and 1 event have only 1 record

CodePudding user response:

I think you can re-arange your tables in this order so that the User, Event and Locations will be as parrent tables to be accessible by those tables that needs the foreignKeys!

users
events
locations
event_user
event_user_histories
event_user_reviews
  • Related