SQL

CREATE TABLE notifications_log  (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  event_id TEXT NOT NULL,
  notification_hash TEXT NOT NULL,
  telegram_chat_id TEXT,
  telegram_message_id TEXT,
  first_sent_at DATETIME DEFAULT CURRENT_TIMESTAMP
)

+ Add column

Columns

Column Data type Allow null Primary key Actions
id INTEGER Rename | Drop
event_id TEXT Rename | Drop
notification_hash TEXT Rename | Drop
telegram_chat_id TEXT Rename | Drop
telegram_message_id TEXT Rename | Drop
first_sent_at DATETIME Rename | Drop

+ Add index

Indexes

Name Columns Unique SQL Drop?
idx_notifications_event event_id SQL
CREATE INDEX idx_notifications_event
ON notifications_log(event_id)
Drop
idx_notifications_hash
  • notification_hash
  • first_sent_at
SQL
CREATE INDEX idx_notifications_hash
ON notifications_log(notification_hash, first_sent_at)
Drop