It would be helpful if libraries could specify the action of entries in the action_logs table to purge. Use case: Libraries with a patron import overwriting patron records several times a day will likely want to truncate member 'create' entries from the action_logs tables, whilst retaining other patron action_logs entries, like below: ./cleanup_database.pl --logs 30 --log-module=MEMBERS --log-action=CREATE --confirm
*** Bug 32480 has been marked as a duplicate of this bug. ***
Created attachment 145499 [details] [review] Bug 32686: Specify action of action_logs to purge Add --log-action parameter to cleanup_database.pl Test plan: 1. Apply patch 2. Enable cataloguing and borrowers log 3. Make some changes to borrowers, create some borrowers, and edit some biblio records 4. Change the action_logs.timestamp for all action_logs entries to 367 days ago 5. Run cleanup_database.pl with --logs 365 --log-module=MEMBERS --log-action=CREATE --confirm 6. Confirm only the borrowers creation action_logs entries are removed 7. Run cleanup_database.pl with --logs 365 8. Confirm all action_logs entries are removed Sponsored-By: Toi Ohomai Institute of Technology, New Zealand
Created attachment 145781 [details] [review] Bug 32686: Specify action of action_logs to purge Add --log-action parameter to cleanup_database.pl Test plan: 1. Apply patch 2. Enable cataloguing and borrowers log 3. Make some changes to borrowers, create some borrowers, and edit some biblio records 4. Change the action_logs.timestamp for all action_logs entries to 367 days ago 5. Run cleanup_database.pl with --logs 365 --log-module=MEMBERS --log-action=CREATE --confirm 6. Confirm only the borrowers creation action_logs entries are removed 7. Run cleanup_database.pl with --logs 365 8. Confirm all action_logs entries are removed Sponsored-By: Toi Ohomai Institute of Technology, New Zealand Signed-off-by: David Nind <david@davidnind.com>
Testing notes (using koha-testing-docker): 1. Step 4 SQL query to update the timestamp: . koha-mysql kohadev . update action_logs set timestamp = "2022-01-01 01:00:00"; 2. Step 6 SQL query - ran before and after step 6 (number should reduce by the number of new patrons you created): . select * from action_logs where module = "MEMBERS"; 3. Step 8 SQL query - should be no rows: select * from action_logs;
Created attachment 147583 [details] [review] Bug 32686: Specify action of action_logs to purge Add --log-action parameter to cleanup_database.pl Test plan: 1. Apply patch 2. Enable cataloguing and borrowers log 3. Make some changes to borrowers, create some borrowers, and edit some biblio records 4. Change the action_logs.timestamp for all action_logs entries to 367 days ago 5. Run cleanup_database.pl with --logs 365 --log-module=MEMBERS --log-action=CREATE --confirm 6. Confirm only the borrowers creation action_logs entries are removed 7. Run cleanup_database.pl with --logs 365 8. Confirm all action_logs entries are removed Sponsored-By: Toi Ohomai Institute of Technology, New Zealand Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Works (including multiple --log-action), QA script happy, code looks good, passing QA :)
Please rebase.
Created attachment 147671 [details] [review] Bug 32686: Specify action of action_logs to purge Add --log-action parameter to cleanup_database.pl Test plan: 1. Apply patch 2. Enable cataloguing and borrowers log 3. Make some changes to borrowers, create some borrowers, and edit some biblio records 4. Change the action_logs.timestamp for all action_logs entries to 367 days ago 5. Run cleanup_database.pl with --logs 365 --log-module=MEMBERS --log-action=CREATE --confirm 6. Confirm only the borrowers creation action_logs entries are removed 7. Run cleanup_database.pl with --logs 365 8. Confirm all action_logs entries are removed Sponsored-By: Toi Ohomai Institute of Technology, New Zealand Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
(In reply to Tomás Cohen Arazi from comment #7) > Please rebase. Attached rebased patch, setting back to it's previous status of 'Passed QA', please change the status if that is incorrect. Thanks
Pushed to master for 23.05. Nice work everyone, thanks!
Enhancement - not backporting to 22.11.x Nice work everyone!