-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update fuzzey match migration
- Loading branch information
Showing
1 changed file
with
9 additions
and
6 deletions.
There are no files selected for viewing
15 changes: 9 additions & 6 deletions
15
repositories/migrations/20250117095221_fuzzy_match_on_case_name.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
-- +goose NO TRANSACTION | ||
-- +goose Up | ||
-- +goose StatementBegin | ||
CREATE EXTENSION pg_trgm; | ||
ALTER DATABASE marble SET pg_trgm.similarity_threshold = 0.1; | ||
CREATE INDEX trgm_cases_on_name ON cases USING GIN (name gin_trgm_ops); | ||
-- +goose StatementEnd | ||
CREATE INDEX CONCURRENTLY trgm_cases_on_name ON cases USING GIN (name gin_trgm_ops); | ||
CREATE INDEX CONCURRENTLY case_org_id_idx_2 ON cases(org_id, created_at DESC) INCLUDE(inbox_id, status, name); | ||
DROP INDEX CONCURRENTLY IF EXISTS case_org_id_idx; | ||
DROP INDEX CONCURRENTLY IF EXISTS case_status_idx; | ||
|
||
-- +goose Down | ||
-- +goose StatementBegin | ||
DROP INDEX trgm_cases_on_name; | ||
CREATE INDEX CONCURRENTLY case_status_idx ON cases(org_id, status, created_at DESC); | ||
CREATE INDEX CONCURRENTLY case_org_id_idx ON cases(org_id, created_at DESC); | ||
DROP INDEX CONCURRENTLY IF EXISTS case_org_id_idx_2; | ||
DROP INDEX CONCURRENTLY IF EXISTS trgm_cases_on_name; | ||
DROP EXTENSION pg_trgm; | ||
-- +goose StatementEnd |