Migrations
SQL migrations live under supabase/migrations/ and are applied via the Supabase CLI. Each file is timestamped (YYYYMMDDHHMMSS_short_name.sql).
How to add a new migration
# from repo root
supabase migration new short_descriptive_name
# edit the new file under supabase/migrations/
supabase db push # apply locally
Once merged to main, deploy via:
supabase db push --linked
Notable migration history
Latest at the top. Names reflect the
_short_name.sqlportion of the filename.
| Date | Migration | What changed |
|---|---|---|
| 2026-04 | _supabase_verify | JWT verification + asymmetric signing key rollout (enables getClaims() in middleware). |
| 2026-04 | _campaign_team_sets, _campaign_policies | New campaign_team_sets table + RLS policies. Foundation for the get-permissions-snapshot campaign branch. |
| 2026-04 | _drop_old_campaign_permission_table | Removes the legacy campaign-permission table superseded by the snapshot edge function. |
| 2026-04 | _drop_campaign_constraints_with_campaign_id | Cleans up legacy FK constraints. |
| 2026-04 | _new_constraints | New constraints to enforce data integrity around the refactored permission tables. |
| 2026-03 | _redis_sync_function_trig_dropped | Drops the Postgres trigger that called sync-to-redis automatically. Sync now happens from app code. |
| 2026-03 | _rates_constraint | Tightens rate uniqueness constraints (one active rate per circulator/campaign). |
| 2026-03 | _note_field | Adds note field used across forms. |
| 2026-03 | _rates_fix | Bugfix on rate ladder. |
| 2026-03 | _regions | Region (sub-area) refinements. |
| 2026-02 | _regions_table | Initial regions schema. |
| 2026-02 | _rates_campaign, _tran_campaign | Campaign-scoped rates and transactions tables + indexes. |
| 2026-02 | _campaigns-table | Updates to the campaigns base table. |
| 2026-02 | _capaign_status | Adds campaign status enum + lifecycle. |
| 2026-02 | _roles_fix, _roles_fix2, _roles_memebers_circulators | Role refactor — adds hierarchy_level, scopes, and member/circulator distinction. |
| 2026-02 | _roles_group | Roles grouping. |
| 2026-02 | _permission_set_table | Permission-sets ("Responsibilities") table. |
| 2026-01 | _turn-in-tables, _turn-in-update | Turn-in tracking + status updates. |
| 2026-01 | _rate-table-update | Rate ladder columns. |
| 2025-12 | _charts-table (×2) | Configurable charts feeding the dashboard builder. |
| 2025-12 | _remote_schema | Initial baseline pulled from the remote project. |
Conventions
- Use
IF EXISTS/IF NOT EXISTSguards to keep migrations idempotent. - Every new table needs Row-Level Security (RLS) enabled and at least one policy.
- Permission/role-related schema changes should be coordinated with the
get-permissions-snapshotfunction — it owns the canonical resolution rules.