Skip to content

Commit

Permalink
fix: update mfa phone migration to be idempotent (supabase#1687)
Browse files Browse the repository at this point in the history
## What kind of change does this PR introduce?

- Add `if not exists` so the migration is idempotent
- Also drops the partial unique constraint on phone factors to avoid
potential database bloat
  • Loading branch information
J0 authored Jul 31, 2024
1 parent 3d448fa commit fdff1e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion migrations/20240729123726_add_mfa_phone_config.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ alter table {{ index .Options "Namespace" }}.mfa_challenges add column if not ex

create index if not exists idx_sent_at on {{ index .Options "Namespace" }}.mfa_challenges(sent_at);

create unique index unique_verified_phone_factor on {{ index .Options "Namespace" }}.mfa_factors (user_id, phone) where status = 'verified';
create unique index if not exists unique_verified_phone_factor on {{ index .Options "Namespace" }}.mfa_factors (user_id, phone);

0 comments on commit fdff1e7

Please sign in to comment.