-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6924 from ORCID/8906-panoply-its-unable-to-retrie…
…ve-information-from-dwevent-and-dweventpublicpage fix: Add missing `last_modified` in events view so panoply can run su…
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 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
43 changes: 43 additions & 0 deletions
43
orcid-persistence/src/main/resources/db/updates/dw_alter_event.xml
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,43 @@ | ||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd"> | ||
|
||
<changeSet id="ALTER-DW-EVENT-VIEW-GROUP-BY-DAY-CLIENT_ID-AND-EVENT_TYPE" author="Daniel Palafox" dbms="postgresql"> | ||
<dropView viewName="dw_event"/> | ||
|
||
<createView viewName="dw_event"> | ||
SELECT event_type, client_id, COUNT(id), DATE_TRUNC('day', date_created), DATE_TRUNC('day', date_created) as last_modified | ||
FROM event | ||
WHERE event_type != 'Public-Page' | ||
GROUP BY event_type, client_id, DATE_TRUNC('day', date_created) | ||
ORDER BY DATE_TRUNC('day', date_created) DESC; | ||
</createView> | ||
</changeSet> | ||
|
||
<changeSet id="GRANT-READ-TO-DW_USER-TO-DW_EVENT-VIEW" author="Daniel Palafox" dbms="postgresql"> | ||
<preConditions> | ||
<sqlCheck expectedResult="1">SELECT 1 FROM pg_roles WHERE rolname='dw_user'</sqlCheck> | ||
</preConditions> | ||
<sql>GRANT SELECT ON TABLE dw_event to dw_user;</sql> | ||
</changeSet> | ||
|
||
<changeSet id="ALTER-DW-EVENT-VIEW-GROUP-BY-PUBLIC-PAGE" author="Daniel Palafox" dbms="postgresql"> | ||
<dropView viewName="dw_event_public_page"/> | ||
|
||
<createView viewName="dw_event_public_page"> | ||
SELECT event_type, public_page, COUNT(id), DATE_TRUNC('day', date_created), DATE_TRUNC('day', date_created) as last_modified | ||
FROM event | ||
WHERE event_type = 'Public-Page' | ||
GROUP BY event_type, public_page, DATE_TRUNC('day', date_created) | ||
ORDER BY DATE_TRUNC('day', date_created) DESC; | ||
</createView> | ||
</changeSet> | ||
|
||
<changeSet id="GRANT-READ-TO-DW-EVENT-VIEW-GROUP-BY-PUBLIC-PAGE" author="Daniel Palafox" dbms="postgresql"> | ||
<preConditions> | ||
<sqlCheck expectedResult="1">SELECT 1 FROM pg_roles WHERE rolname='dw_user'</sqlCheck> | ||
</preConditions> | ||
<sql>GRANT SELECT ON TABLE dw_event_public_page to dw_user;</sql> | ||
</changeSet> | ||
|
||
</databaseChangeLog> |