SQL

CREATE TABLE agent_notifications  (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  agent_id INTEGER NOT NULL,
  notification_type TEXT NOT NULL CHECK (notification_type IN ('voucher_sold', 'payment_received', 'balance_updated', 'request_approved', 'request_rejected', 'registration_success', 'registration_approved', 'registration_rejected')),
  title TEXT NOT NULL,
  message TEXT NOT NULL,
  is_read INTEGER DEFAULT 0,
  created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
  FOREIGN KEY (agent_id) REFERENCES agents(id) ON DELETE CASCADE
)

+ Add column

Columns

Column Data type Allow null Primary key Actions
id INTEGER Rename | Drop
agent_id INTEGER Rename | Drop
notification_type TEXT Rename | Drop
title TEXT Rename | Drop
message TEXT Rename | Drop
is_read INTEGER Rename | Drop
created_at DATETIME Rename | Drop

Foreign Keys

Column Destination
agent_id agents.id

+ Add index

Indexes

Name Columns Unique SQL Drop?
idx_agent_notifications_agent_id agent_id SQL
CREATE INDEX idx_agent_notifications_agent_id
ON agent_notifications(agent_id)
Drop
idx_agent_notifications_is_read is_read SQL
CREATE INDEX idx_agent_notifications_is_read
ON agent_notifications(is_read)
Drop