Skip to content

Commit

Permalink
Add problem(external_id) database index.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Feb 18, 2022
1 parent 5a68f8b commit 5eb5d1e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions bin/update-schema
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ else {
# (assuming schema change files are never half-applied, which should be the case)
sub get_db_version {
return 'EMPTY' if ! table_exists('problem');
return '0076' if index_exists('problem_external_id_idx');
return '0075' if column_exists('alert', 'parameter3');
return '0074' if index_exists('users_fulltext_idx');
return '0073' if index_exists('problem_fulltext_idx');
Expand Down
2 changes: 2 additions & 0 deletions db/downgrade_0076---0075.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DROP INDEX problem_external_id_idx;

1 change: 1 addition & 0 deletions db/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ create table problem (
);
create index problem_state_latitude_longitude_idx on problem(state, latitude, longitude);
create index problem_user_id_idx on problem ( user_id );
create index problem_external_id_idx on problem(external_id);
create index problem_external_body_idx on problem(lower(external_body));
create index problem_radians_latitude_longitude_idx on problem(radians(latitude), radians(longitude));
create index problem_bodies_str_array_idx on problem USING gin(regexp_split_to_array(bodies_str, ','));
Expand Down
1 change: 1 addition & 0 deletions db/schema_0076-add-index-problem-external_id.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE INDEX CONCURRENTLY problem_external_id_idx on problem(external_id);

0 comments on commit 5eb5d1e

Please sign in to comment.