-
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.
- Loading branch information
Showing
2 changed files
with
20 additions
and
15 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
18 changes: 18 additions & 0 deletions
18
src/main/resources/db/migration/v10_latest_harvester_run_view.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,18 @@ | ||
alter table SEMANTIC_CONTENT_STATS | ||
modify ISSUED_ON timestamp null; | ||
|
||
alter table SEMANTIC_CONTENT_STATS | ||
modify MODIFIED_ON timestamp null; | ||
|
||
CREATE VIEW LATEST_HARVESTER_RUN_BY_YEAR AS | ||
WITH LATEST_RUN_BY_YEAR AS (SELECT REPOSITORY_ID, | ||
YEAR(STARTED) AS YEAR, | ||
MAX(STARTED) AS LATEST_STARTED | ||
FROM HARVESTER_RUN | ||
GROUP BY REPOSITORY_ID, YEAR(STARTED)) | ||
SELECT HR.* | ||
FROM HARVESTER_RUN HR | ||
JOIN LATEST_RUN_BY_YEAR LRBY | ||
ON HR.REPOSITORY_ID = LRBY.REPOSITORY_ID | ||
AND YEAR(HR.STARTED) = LRBY.YEAR | ||
AND HR.STARTED = LRBY.LATEST_STARTED; |