Skip to content

Festival phase: migration + admin phase override #139

Description

@chiptus

Parent

Epic #126 — Festival phases. PRD: docs/prd/festival-phases/3-post-festival.md.

What to build

The epic's single migration plus the Core-Team escape hatch for wrong derived phases. This ticket owns the one schema change for the whole epic — it adds both the set_ratings table (consumed later by #TBD-rating) and the phase-override column — and wires the override into the derivation seam so a delayed, cancelled, or mis-dated festival can be corrected.

  • One migration (in supabase/migrations/, timestamp-prefixed — do NOT run supabase db push / db reset):
    • Nullable phase_override column on the edition holding an optional forced phase (pre-schedule | planning | live | post-festival, or null). Null ⇒ use derived.
    • set_ratings table (created here so the rating ticket can build on it): one rating per (user_id, set_id) unique constraint, distinct from votes. RLS mirrors votes (a user manages their own; visibility follows the same rules votes use, incl. group context). Match what votes does rather than inventing a new policy shape.
  • Effective phase = override ?? derived — extend the getFestivalPhase seam (or its caller) from Festival phase: derivation core + useFestivalPhase hook #136 so a non-null override wins over every derived case and null falls through to the derived value. Keep this the single rule; do not scatter override checks across consumers.
  • Core-Team override control — a control in the edition admin area to set/clear the override, beside the existing ScheduleRevealControl under src/pages/admin/festivals/. Clearing returns the edition to automatic (derived) behavior.

The override is a minimal escape hatch (one optional forced phase), not a scheduling system.

Acceptance criteria

  • One migration adds the nullable phase_override column and the set_ratings table; set_ratings has a unique (user_id, set_id) constraint and RLS mirroring votes.
  • effective phase = override ?? derived is unit-tested extending the Festival phase: derivation core + useFestivalPhase hook #136 seam: a non-null override wins over every derived case; null falls through to the derived value (now injected).
  • The override rule lives in one place; consumers read effective phase, not scattered override checks.
  • Core Team can set and clear the override from the edition admin area beside the reveal-level control; clearing restores derived behavior.
  • No supabase db push / db reset run; migration is timestamp-prefixed in supabase/migrations/.

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions