CREATE TABLE IF NOT EXISTS emails (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  to_address TEXT NOT NULL,
  from_address TEXT,
  subject TEXT,
  text_body TEXT,
  html_body TEXT,
  raw_size INTEGER,
  received_at TEXT NOT NULL
);

CREATE INDEX IF NOT EXISTS idx_to_address ON emails (to_address);
CREATE INDEX IF NOT EXISTS idx_received_at ON emails (received_at);
