ADR-0001: P1 is a generated column
Status: Accepted
Superseded by: —
Context
Section titled “Context”P1 is deal progression probability. It is locked to sales step (1–2 → 30, 3–4 → 60, 5–6 → 90, 7 closed). If application code could write P1, it would drift from step. Historical forecast analysis needs the number the rep actually saw.
Decision
Section titled “Decision”opportunities.p1 is a Postgres generated always column derived from step. Application code, including the admin console, never writes it. Changing the mapping is a migration, not a config edit. stage_history and sessions snapshot step and P1 at the time of change.
Consequences
Section titled “Consequences”Doctrine is enforced by the database. A mapping change is visible in schema history. Agents must propose a step change (or P1 which middleware resolves to a step), never UPDATE opportunities SET p1.