https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42218

--- Comment #10 from Clemens Tubach <[email protected]> ---
Created attachment 209151
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209151&action=edit
Bug 42218: Remove erm_usage_yus and replace with an SQL view

erm_usage_yus becomes a view that sums erm_usage_mus per year, grouped on
every key column (usage object, provider, year, metric type, access type,
yop and report type). A re-harvest updates the monthly rows and the yearly
totals follow; rows cannot duplicate.

Dropping the table loses no data: every row in it was written from the
non-zero monthly rows of the same COUNTER file, so the view rebuilds the
same totals, corrected where files overlapped.

The view is defined in kohastructure.sql next to the tables it reads, so a
fresh install, the KTD dbic helper and misc4dev all create it. The
atomicupdate drops the table when it is still a base table and creates the
view with CREATE OR REPLACE, so it can run more than once.

MIN(monthly_usage_summary_id) gives each row a stable key for DBIC.

Assisted-by: Sonnet 5 (Anthropic)
Signed-off-by: Clemens Tubach <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to