Skip to content

Schema Design Comments (Alfred Madere) #26

Description

@AlfredMadere
  1. Change name and email in the users table to be non-nullable to ensure every user has this essential information.
  2. Add a unique constraint to the email field in the users table to avoid duplicate email addresses.
  3. Change name in the groups table to be non-nullable to ensure every group has a name.
  4. In the group_members table, remove the identity property from group_id and make group_id and user_id both foreign keys to their respective tables.
  5. Add a unique constraint on (group_id, user_id) in group_members to prevent duplicate memberships.
  6. Change description and payer_id in shopping_trips to non-nullable if these fields are always expected.
  7. Make price and quantity non-nullable in trip_line_items and set default values if appropriate.
  8. expense_id in trip_line_items should not be an identity; it should be a foreign key to shopping_trips.
  9. In trip_item_members, user_id should not have the identity property; it should be a foreign key to users.
  10. Make description and expense_id non-nullable in transactions if they are always required.
  11. The transaction_ledger table lacks a primary key. Consider adding a unique identifier as a primary key or using (transaction_id, from_id, to_id) as a composite key.
  12. Ensure each field uses the most appropriate data type. For instance, if price in trip_line_items will not have fractional cents, consider using decimal instead of real for more precise financial calculations.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions