File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,14 @@ do $$ begin
24
24
check (char_length(token_hash) > 0 )
25
25
);
26
26
27
- create index if not exists one_time_tokens_token_hash_hash_idx on {{ index .Options " Namespace" }}.one_time_tokens using hash (token_hash);
28
- create index if not exists one_time_tokens_relates_to_hash_idx on {{ index .Options " Namespace" }}.one_time_tokens using hash (relates_to);
27
+ begin
28
+ create index if not exists one_time_tokens_token_hash_hash_idx on {{ index .Options " Namespace" }}.one_time_tokens using hash (token_hash);
29
+ create index if not exists one_time_tokens_relates_to_hash_idx on {{ index .Options " Namespace" }}.one_time_tokens using hash (relates_to);
30
+ exception when others then
31
+ -- Fallback to btree indexes if hash creation fails
32
+ create index if not exists one_time_tokens_token_hash_hash_idx on {{ index .Options " Namespace" }}.one_time_tokens using btree (token_hash);
33
+ create index if not exists one_time_tokens_relates_to_hash_idx on {{ index .Options " Namespace" }}.one_time_tokens using btree (relates_to);
34
+ end;
35
+
29
36
create unique index if not exists one_time_tokens_user_id_token_type_key on {{ index .Options " Namespace" }}.one_time_tokens (user_id, token_type);
30
37
end $$;
You can’t perform that action at this time.
0 commit comments