feat(db): migration 0022 — add response tracking to lead_forwards

Adds status_updated_at, supplier_note, and cta_token columns to the
lead_forwards table. cta_token gets a unique partial index for fast
one-click email CTA lookups.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Deeman
2026-02-25 09:31:14 +01:00
parent d5947af8d4
commit c84a5ffdd1

View File

@@ -0,0 +1,12 @@
"""Migration 0022: Add response tracking columns to lead_forwards."""
FORWARD_STATUSES = ["sent", "viewed", "contacted", "quoted", "won", "lost", "no_response"]
def up(conn) -> None:
conn.execute("ALTER TABLE lead_forwards ADD COLUMN status_updated_at TEXT")
conn.execute("ALTER TABLE lead_forwards ADD COLUMN supplier_note TEXT")
conn.execute("ALTER TABLE lead_forwards ADD COLUMN cta_token TEXT")
conn.execute(
"CREATE UNIQUE INDEX IF NOT EXISTS idx_lead_forwards_cta_token ON lead_forwards(cta_token) WHERE cta_token IS NOT NULL"
)