CREATE TABLE IF NOT EXISTS newsletter.email_events (
  event_type    LowCardinality(String),
  tenant_id     String,
  campaign_id   UUID,
  recipient_hash String,
  timestamp     DateTime64(3, 'UTC'),
  metadata      Map(String, String)
)
ENGINE = MergeTree()
PARTITION BY toYYYYMM(timestamp)
ORDER BY (tenant_id, campaign_id, event_type, timestamp);
