Skip to main content

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.sql portion of the filename.

DateMigrationWhat changed
2026-04_supabase_verifyJWT verification + asymmetric signing key rollout (enables getClaims() in middleware).
2026-04_campaign_team_sets, _campaign_policiesNew campaign_team_sets table + RLS policies. Foundation for the get-permissions-snapshot campaign branch.
2026-04_drop_old_campaign_permission_tableRemoves the legacy campaign-permission table superseded by the snapshot edge function.
2026-04_drop_campaign_constraints_with_campaign_idCleans up legacy FK constraints.
2026-04_new_constraintsNew constraints to enforce data integrity around the refactored permission tables.
2026-03_redis_sync_function_trig_droppedDrops the Postgres trigger that called sync-to-redis automatically. Sync now happens from app code.
2026-03_rates_constraintTightens rate uniqueness constraints (one active rate per circulator/campaign).
2026-03_note_fieldAdds note field used across forms.
2026-03_rates_fixBugfix on rate ladder.
2026-03_regionsRegion (sub-area) refinements.
2026-02_regions_tableInitial regions schema.
2026-02_rates_campaign, _tran_campaignCampaign-scoped rates and transactions tables + indexes.
2026-02_campaigns-tableUpdates to the campaigns base table.
2026-02_capaign_statusAdds campaign status enum + lifecycle.
2026-02_roles_fix, _roles_fix2, _roles_memebers_circulatorsRole refactor — adds hierarchy_level, scopes, and member/circulator distinction.
2026-02_roles_groupRoles grouping.
2026-02_permission_set_tablePermission-sets ("Responsibilities") table.
2026-01_turn-in-tables, _turn-in-updateTurn-in tracking + status updates.
2026-01_rate-table-updateRate ladder columns.
2025-12_charts-table (×2)Configurable charts feeding the dashboard builder.
2025-12_remote_schemaInitial baseline pulled from the remote project.

Conventions

  • Use IF EXISTS / IF NOT EXISTS guards 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-snapshot function — it owns the canonical resolution rules.