-
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.
- Loading branch information
Showing
10 changed files
with
76 additions
and
31 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
15 changes: 15 additions & 0 deletions
15
src/main/resources/changelog/changes/v4.0/sql/check-merge-completed-status-function.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,15 @@ | ||
CREATE OR REPLACE FUNCTION check_merge_completed_status() | ||
RETURNS BOOLEAN AS | ||
$$ | ||
DECLARE | ||
result BOOLEAN; | ||
BEGIN | ||
SELECT count(1) = 3 | ||
INTO result | ||
FROM reindex_status | ||
WHERE entity_type IN ('ITEM', 'INSTANCE', 'HOLDINGS') | ||
AND status = 'MERGE_COMPLETED'; | ||
|
||
RETURN result; | ||
END; | ||
$$ LANGUAGE plpgsql; |
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions
27
src/main/resources/changelog/changes/v4.0/sql/update-reindex-status-trigger.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,27 @@ | ||
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(); |
22 changes: 0 additions & 22 deletions
22
src/main/resources/changelog/changes/v4.0/update-reindex-status-trigger.sql
This file was deleted.
Oops, something went wrong.