Skip to content

Commit

Permalink
fix: change phone constraint to per user (#1713)
Browse files Browse the repository at this point in the history
## What kind of change does this PR introduce?

Currently, the phone constraint only allows for one phone number across
all users. Changes to make phone numbers unique per user.

Also renames the constraint on phone factors to reflect that it applies
to all factors rather than verified factors.
  • Loading branch information
J0 authored Aug 7, 2024
1 parent 92409ea commit b9bc769
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
alter table {{ index .Options "Namespace" }}.mfa_factors drop constraint if exists mfa_factors_phone_key;
do $$
begin
if exists (
select 1
from pg_indexes
where indexname = 'unique_verified_phone_factor'
and schemaname = '{{ index .Options "Namespace" }}'
) then
execute 'alter index {{ index .Options "Namespace" }}.unique_verified_phone_factor rename to unique_phone_factor_per_user';
end if;
end $$;

0 comments on commit b9bc769

Please sign in to comment.