Back to Logbook
Apr 20, 2026 Project: #Biznetrix

Code Re-Evaluation Pass 2 — Token Prefix and Social Ad Spend

methodical

Second code re-evaluation pass. Added API token prefix column to users — allows the auth filter to do a prefix-indexed lookup instead of scanning the full token table. Social ad spend table added. Normalised email column on leads for deduplication across channels.

Small migrations, but each one addresses a real scalability concern. The token prefix approach means auth lookups stay fast even as the user table grows. Normalised email on leads means we never create duplicate lead records from the same email arriving through different channels.

Lessons Learned

Deduplication keys (normalised email, token prefix index) should be added before the table gets large. Adding an index to a million-row table is painful; adding it at 100 rows is free.