From 0ac003819629138073fb144cb3eb927b39c3a41d Mon Sep 17 00:00:00 2001 From: Marcos Prieto Date: Tue, 5 Sep 2023 10:05:23 +0200 Subject: [PATCH] Include the imported column on the reporting annotations table --- .../create_from_scratch/03_annotations/01_create_table.sql | 3 ++- .../create_from_scratch/03_annotations/02_initial_fill.sql | 5 +++-- h/data_tasks/report/refresh/01_annotations_refresh.sql | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/h/data_tasks/report/create_from_scratch/03_annotations/01_create_table.sql b/h/data_tasks/report/create_from_scratch/03_annotations/01_create_table.sql index b9a9868e6e3..f2e5c637b8c 100644 --- a/h/data_tasks/report/create_from_scratch/03_annotations/01_create_table.sql +++ b/h/data_tasks/report/create_from_scratch/03_annotations/01_create_table.sql @@ -14,5 +14,6 @@ CREATE TABLE report.annotations ( anchored BOOLEAN NOT NULL, size INT, parent_uuids UUID[], - tags TEXT[] + tags TEXT[], + imported BOOLEAN NOT NULL ); diff --git a/h/data_tasks/report/create_from_scratch/03_annotations/02_initial_fill.sql b/h/data_tasks/report/create_from_scratch/03_annotations/02_initial_fill.sql index 613f600f50d..513e22db21b 100644 --- a/h/data_tasks/report/create_from_scratch/03_annotations/02_initial_fill.sql +++ b/h/data_tasks/report/create_from_scratch/03_annotations/02_initial_fill.sql @@ -12,7 +12,7 @@ INSERT INTO report.annotations ( user_id, group_id, document_id, authority_id, created, updated, deleted, shared, anchored, size, - parent_uuids, tags + parent_uuids, tags, imported ) SELECT annotation.id as uuid, @@ -29,7 +29,8 @@ SELECT JSONB_ARRAY_LENGTH(target_selectors) <> 0 AS anchored, LENGTH(text) AS size, "references", - tags + tags, + coalesce(extra ->'extra'->>'source' = 'import', false) FROM annotation JOIN "user" users ON users.authority = SPLIT_PART(annotation.userid, '@', 2) diff --git a/h/data_tasks/report/refresh/01_annotations_refresh.sql b/h/data_tasks/report/refresh/01_annotations_refresh.sql index 6559c6d9726..84796043e96 100644 --- a/h/data_tasks/report/refresh/01_annotations_refresh.sql +++ b/h/data_tasks/report/refresh/01_annotations_refresh.sql @@ -18,7 +18,7 @@ INSERT INTO report.annotations ( user_id, group_id, document_id, authority_id, created, updated, deleted, shared, anchored, size, - parent_uuids, tags + parent_uuids, tags, imported ) SELECT annotation.id as uuid, @@ -33,7 +33,8 @@ SELECT JSONB_ARRAY_LENGTH(target_selectors) <> 0 AS anchored, LENGTH(text) AS size, "references", - tags + tags, + coalesce(extra ->'extra'->>'source' = 'import', false) FROM annotation JOIN "user" users ON users.authority = SPLIT_PART(annotation.userid, '@', 2)