-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: CLIN-2173 removed unique index
- Loading branch information
Ethienne Roy
committed
Aug 24, 2023
1 parent
8da9ffe
commit 41fd1c3
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- Up Migration | ||
drop index idx_unique_saved_filters; | ||
|
||
drop function get_filter_uniqueness_date(); | ||
-- Down Migration | ||
CREATE OR REPLACE FUNCTION get_filter_uniqueness_date() RETURNS timestamp AS $$ | ||
declare run_on_date timestamp; | ||
BEGIN | ||
SELECT run_on into run_on_date | ||
FROM pgmigrations | ||
WHERE name = '1688561786592_update-saved-filter'; | ||
|
||
RETURN run_on_date; | ||
END | ||
$$ LANGUAGE plpgsql | ||
IMMUTABLE;; | ||
|
||
CREATE UNIQUE INDEX idx_unique_saved_filters | ||
ON saved_filters (title, keycloak_id, type) | ||
WHERE creation_date > get_filter_uniqueness_date(); |
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