saayam-for-all / database

Both saaaym-web and saayam-mobile apps would use a common DB. This repo contains all DB specific code and content.
0 stars 1 forks source link

Enhancements and Clarifications for Database Schema Design #8

Open FPeng2288 opened 3 weeks ago

FPeng2288 commented 3 weeks ago

Issue Description:

Based on our ongoing development and understanding of the project's requirements, I have a few suggestions and clarifications needed regarding the database schema design. Below are the points organized by the relevant tables and fields, along with the rationale for each suggestion.

Consultations

  1. Email Uniqueness

    • Rationale: To ensure the integrity and uniqueness of user identification through email.
    • Question: Should the email field in the users table be unique?
  2. RequestStatus, RequestPriority, RequestType, RequestCategory Tables

    • Rationale: To simplify the schema and potentially reduce redundancy.
    • Question: Should the description field be removed from these tables?
  3. submission_time Foreign Key Relationship

    • Rationale: To maintain data integrity and enforce relational constraints.
    • Question: Should submission_time have a foreign key relationship with RequestStatus?
  4. leadVolunteerUserId

    • Rationale: To understand the relationships and data integrity constraints.
    • Question: What is the leadVolunteerUserId field? Should there be a volunteer table to relate this field to?
  5. lastUpdateDate

    • Rationale: To ensure consistency and data accuracy in tracking updates.
    • Questions:
      • Should lastUpdateDate be linked to the most recent update time in RequestStatus, RequestPriority, RequestType, and RequestCategory?
      • Should submission_date, serviced_date, and last_update_date be non-nullable?
      • Should the submission_date, serviced_date and last_update_date be changed from submission_date to submission_time .etc?
  6. User Name Fields

    • Rationale: To maintain logical consistency in the user data.
    • Questions:
      • Why is full_name non-nullable while last_name and first_name are nullable? Should full_name be removed and generated from first_name and last_name?
  7. user_category

    • Rationale: To clarify the intended use and structure of the user category data.
    • Questions:
      • What are the specific enum values for user_category?
      • Should the description field be removed, or is it intended as a memo for admin use?
  8. user_status

    • Rationale: To understand the role and necessity of user status.
    • Questions:
      • What is the purpose of user_status? How does it control or signify user actions in relation to the requests?
  9. Inconsistent Naming Conventions

    • Rationale: To maintain a standard naming convention for clarity and consistency.
    • Question: Should we standardize table names to either all singular or all plural?

Thank you for considering these suggestions. I believe addressing these points will help in refining our database schema and ensuring it aligns with our project requirements and best practices.

FPeng2288 commented 2 weeks ago

Issue: Database Design and Timestamp Recording Logic

Issues Identified:

Many-to-One Relationship Constraints:

Timestamp Recording Issue:

Default Value Issue:

MVP Principle and Practicality:

Current Approach and Justification:

Discussion: