Compare commits

...

1 Commits

Author SHA1 Message Date
Cal Herries
96cebe43db Add view_count to report_card and report_dashboard
Adds a `view_count` column to both `report_card` and `report_dashboard`.
2024-04-25 18:07:55 +01:00

View File

@@ -6577,7 +6577,94 @@ databaseChangeLog:
changes:
- sql:
sql: >
DELETE FROM data_permissions where perm_type = 'perms/data-access' OR perm_type = 'perms/native-query-editing';
DELETE FROM data_permissions where perm_type = 'perms/data-access' OR perm_type =
'perms/native-query-editing';
- changeSet:
id: v50.2024-04-25T16:29:31
author: calherries
comment: Add report_card.view_count
changes:
- addColumn:
columns:
- column:
name: view_count
type: integer
defaultValueNumeric: 0
remarks: Count of views the card has had
constraints:
nullable: false
tableName: report_card
- changeSet:
id: v50.2024-04-25T16:29:32
author: calherries
comment: Add report_dashboard.view_count
changes:
- addColumn:
columns:
- column:
name: view_count
type: integer
defaultValueNumeric: 0
remarks: Count of views the card has had
constraints:
nullable: false
tableName: report_dashboard
- changeSet:
id: v50.2024-04-25T16:29:32
author: calherries
comment: Populate report_card.view_count
changes:
- sql:
dbms: postgresql,h2
sql: >-
UPDATE report_card c
SET c.view_count = (
SELECT COUNT(*)
FROM view_log v
WHERE v.model = 'card'
AND v.model_id = c.id
);
- sql:
dbms: postgresql,h2
sql: >-
UPDATE report_card c
SET view_count = (
SELECT count(*)
FROM view_log v
WHERE v.model = 'card'
AND v.model_id = c.id
);
rollback: # nothing to do, since view_count didn't exist in v49
- changeSet:
id: v50.2024-04-25T16:29:33
author: calherries
comment: Populate report_dashboard.view_count
changes:
- sql:
dbms: postgresql,h2
sql: >-
UPDATE report_dashboard c
SET c.view_count = (
SELECT COUNT(*)
FROM view_log v
WHERE v.model = 'card'
AND v.model_id = c.id
);
- sql:
dbms: postgresql,h2
sql: >-
UPDATE report_dashboard c
SET view_count = (
SELECT count(*)
FROM view_log v
WHERE v.model = 'card'
AND v.model_id = c.id
);
rollback: # nothing to do, since view_count didn't exist in v49
# >>>>>>>>>> DO NOT ADD NEW MIGRATIONS BELOW THIS LINE! ADD THEM ABOVE <<<<<<<<<<