-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MSEARCH-794: fix status setting query
- Loading branch information
1 parent
1e55259
commit 09f8fe5
Showing
6 changed files
with
46 additions
and
17 deletions.
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
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
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
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
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
22 changes: 22 additions & 0 deletions
22
src/main/resources/changelog/changes/v4.0/update-reindex-status-trigger-fix.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
CREATE OR REPLACE FUNCTION update_reindex_status_trigger() | ||
RETURNS TRIGGER AS $$ | ||
BEGIN | ||
-- update status and end time for merge | ||
IF OLD.status = 'MERGE_IN_PROGRESS' and NEW.total_merge_ranges = NEW.processed_merge_ranges | ||
THEN NEW.status = 'MERGE_COMPLETED'; NEW.end_time_merge = current_timestamp; | ||
ELSE | ||
-- update status and end time for upload | ||
IF OLD.status = 'UPLOAD_IN_PROGRESS' and NEW.total_upload_ranges = NEW.processed_upload_ranges | ||
THEN NEW.status = 'UPLOAD_COMPLETED'; NEW.end_time_upload = current_timestamp; | ||
END IF; | ||
END IF; | ||
RETURN NEW; | ||
END; | ||
$$ LANGUAGE plpgsql; | ||
|
||
DROP TRIGGER IF EXISTS reindex_status_updated_trigger ON reindex_status CASCADE; | ||
CREATE TRIGGER reindex_status_updated_trigger | ||
BEFORE UPDATE OF processed_merge_ranges, processed_upload_ranges | ||
ON reindex_status | ||
FOR EACH ROW | ||
EXECUTE FUNCTION update_reindex_status_trigger(); |