Skip to main content

Database Tables

notification_services

This table stores information about the different notification services available in the system. Each service represents a source or category of notifications (e.g. Rating, Waitlist).

ColumnTypeConstraintsDescription
idintegerPrimary Key, Auto-generatedUnique identifier for the service
namevarchar(255)Not nullName of the notification service
created_attimestampAuto-generatedTimestamp when the record was created
updated_attimestampAuto-generatedTimestamp when the record was last updated
created_byintegerForeign Key (customer), nullableAdmin Customer who created the service
updated_byintegerForeign Key (customer), nullableAdmin Customer who last updated the service

notification_preferences

This table stores each customer's preferences for notifications. It tracks whether a customer has opted in or opted out of specific notification types (Email, SMS) for particular services.

ColumnTypeConstraintsDescription
idintegerPrimary Key, Auto-generatedUnique identifier for the preference
customer_idintegerForeign Key (customer), Not nullCustomer to whom this preference belongs
notification_service_idintegerForeign Key (notification_services), Not nullRelated notification service
notification_typeenumNot null (values: 'email', 'sms')Type of notification channel
reasonvarchar/textNullableOptional reason for opt-in or opt-out
statusenumNot null (values: 'opted_in', 'opted_out')Current status of the preference
created_attimestampAuto-generatedTimestamp when the record was created
updated_attimestampAuto-generatedTimestamp when the record was last updated

Constraints

  • Unique constraint on (customer_id, notification_service_id, notification_type) to prevent duplicate preferences for the same customer, service, and notification type combination.

customer

This table represents the end users who receive notifications. It is referenced by both the notification_services and notification_preferences tables.


Summary

  • The notification_services table defines all available notification services.
  • The notification_preferences table links customers to their opt-in/opt-out choices per service and notification channel.
  • These tables work together to allow the system to efficiently check and respect users' notification preferences before sending any messages.