Skip to content

Commit 1c7202f

Browse files
authored
fix: revert fallback on btree indexes when hash is unavailable (#1858)
Reverts #1856. We plan to roll this out in the next version (v2.166.0) as per internal discussion
1 parent 307d6ee commit 1c7202f

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

migrations/20240427152123_add_one_time_tokens_table.up.sql

+2-9
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,7 @@ do $$ begin
2424
check (char_length(token_hash) > 0)
2525
);
2626

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-
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);
3629
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);
3730
end $$;

0 commit comments

Comments
 (0)