core PK: id 12 required 1 unique

Description

Stores notification records delivered to users via push, email, or SMS channels, tracking delivery status, read state, and scenario-driven triggers across the Meander platform.

21
Attributes
7
Indexes
7
Validation Rules
17
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key
PKrequiredunique
user_id uuid Recipient user reference
required
organization_id uuid Organization context for tenant isolation
required
channel enum Delivery channel used for this notification
required
type enum Notification category/scenario type
required
title string Short notification headline shown in inbox or push banner
required
body text Full notification message body
required
data json Arbitrary payload for deep-link routing (entity type, entity id, action)
-
scenario_id uuid FK to notification_scenarios if this was triggered by a scenario engine rule; null for direct notifications
-
status enum Current delivery status
required
is_read boolean Whether the recipient has opened/acknowledged the notification
required
read_at datetime Timestamp when user marked as read
-
sent_at datetime Timestamp when notification was dispatched to provider
-
delivered_at datetime Timestamp of confirmed delivery from provider
-
failed_at datetime Timestamp of delivery failure
-
failure_reason string Provider error message if delivery failed
-
retry_count integer Number of delivery attempts made
required
provider_message_id string External provider reference ID (FCM message id, email provider id, etc.)
-
expires_at datetime When this notification should no longer be shown/delivered (for time-sensitive alerts)
-
created_at datetime Record creation timestamp
required
updated_at datetime Last modification timestamp
required

Database Indexes

idx_notifications_user_id
btree

Columns: user_id

idx_notifications_user_is_read
btree

Columns: user_id, is_read

idx_notifications_user_created
btree

Columns: user_id, created_at

idx_notifications_status
btree

Columns: status

idx_notifications_organization_id
btree

Columns: organization_id

idx_notifications_scenario_id
btree

Columns: scenario_id

idx_notifications_created_at
btree

Columns: created_at

Validation Rules

valid_channel error

Validation failed

title_not_empty error

Validation failed

body_not_empty error

Validation failed

valid_user_reference error

Validation failed

read_at_only_when_read error

Validation failed

expires_at_future warning

Validation failed

data_valid_json warning

Validation failed

Business Rules

respect_user_preferences
on_create

A notification must not be sent via a channel the user has disabled in their notification_preferences. Check preferences before dispatch.

tenant_isolation
always

Users may only read notifications belonging to their own organization. organization_id must match the requesting user's org context.

scenario_triggered_deduplication
on_create

For a given scenario_id + user_id combination, do not create a duplicate notification within the scenario's cooldown window.

expiry_enforcement
on_create

Notifications past their expires_at timestamp must not be delivered and should be auto-cancelled if still pending.

max_retry_limit
on_update

Failed delivery must not be retried more than 3 times. After 3 failures set status to 'failed'.

read_timestamp_on_mark_read
on_update

When is_read is set to true, read_at must be populated with the current timestamp.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
by_date
Retention
archive_after_1year