Bug 24541 - Database clean-up: purge messages
Summary: Database clean-up: purge messages
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Didier Gautheron
QA Contact: Testopia
URL:
Keywords: Manual
Depends on:
Blocks: 18081
  Show dependency treegraph
 
Reported: 2020-01-30 09:03 UTC by Didier Gautheron
Modified: 2021-05-27 09:16 UTC (History)
9 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Adds a new option to the cleanup_database.pl cron job to schedule deletion of messages added to patron accounts.
Version(s) released in:
21.05.00,20.11.02


Attachments
Bug 24541: Purge old messages (3.80 KB, patch)
2020-01-30 10:09 UTC, Didier Gautheron
Details | Diff | Splinter Review
Attachment to Bug 24541 - Database cleanups, purge messages (3.77 KB, patch)
2020-03-24 08:50 UTC, Didier Gautheron
Details | Diff | Splinter Review
Bug 24541: Purge old messages (3.86 KB, patch)
2020-03-24 11:22 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 24541: Purge old messages (3.92 KB, patch)
2020-07-25 10:38 UTC, Didier Gautheron
Details | Diff | Splinter Review
Bug 24541: Purge old messages (4.23 KB, patch)
2020-07-27 13:03 UTC, Didier Gautheron
Details | Diff | Splinter Review
Bug 24541: Purge old messages (4.37 KB, patch)
2020-11-03 15:13 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 24541: Purge old messages (4.43 KB, patch)
2020-12-27 23:03 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Didier Gautheron 2020-01-30 09:03:08 UTC
misc/cronjobs/cleanup_database.pl provides some database cleanup.
Yet some tables that could need cleanup are not in this script.

Purge messages older than day (default 365).
Comment 1 Didier Gautheron 2020-01-30 10:09:06 UTC
Created attachment 98152 [details] [review]
Bug 24541: Purge old messages

misc/cronjobs/cleanup_database.pl provides some database cleanup.

This patch adds cleanup for messages table.

Test plan :
- Count messages : select count(*),date(message_date) from  messages group by date(message_date);
- Run cleanup : misc/cronjobs/cleanup_database.pl -v --messages 365
- Recount messages
Comment 2 Bernardo Gonzalez Kriegel 2020-03-21 20:27:41 UTC
Please rebase
Comment 3 Didier Gautheron 2020-03-24 08:50:38 UTC
Created attachment 101509 [details] [review]
Attachment to Bug 24541 - Database cleanups, purge messages

Bug 24541: Purge old messages

misc/cronjobs/cleanup_database.pl provides some database cleanup.

This patch adds cleanup for messages table.

Test plan :
- Count messages : select count(*),date(message_date) from  messages group by date(message_date);
- Run cleanup : misc/cronjobs/cleanup_database.pl -v --messages 365
- Recount messages
Comment 4 Bernardo Gonzalez Kriegel 2020-03-24 11:22:32 UTC
Created attachment 101541 [details] [review]
Bug 24541: Purge old messages

misc/cronjobs/cleanup_database.pl provides some database cleanup.

This patch adds cleanup for messages table.

Test plan :
- Count messages : select count(*),date(message_date) from  messages group by date(message_date);
- Run cleanup : misc/cronjobs/cleanup_database.pl -v --messages 365
- Recount messages

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works Ok, no errors.
Comment 5 Jonathan Druart 2020-03-25 10:45:57 UTC
I have a patch that is enhancing greatly this script. By any chances could base yours on top of it?

See bug 24153.
Comment 6 Jonathan Druart 2020-03-25 10:46:26 UTC
(In reply to Jonathan Druart from comment #5)
> I have a patch that is enhancing greatly this script. By any chances could
> base yours on top of it?
> 
> See bug 24153.

Nevermind, I will do it later.
Comment 7 Didier Gautheron 2020-07-25 10:38:43 UTC
Created attachment 107369 [details] [review]
Bug 24541: Purge old messages

misc/cronjobs/cleanup_database.pl provides some database cleanup.

This patch adds cleanup for messages table.

Test plan :
- Count messages : select count(*),date(message_date) from  messages group by date(message_date);
- Run cleanup : misc/cronjobs/cleanup_database.pl -v --confirm --messages 365
- Recount messages
Comment 8 Didier Gautheron 2020-07-25 10:40:35 UTC
rebase and follow --confirm flag
Comment 9 Jonathan Druart 2020-07-27 08:46:06 UTC
Didier, please use Koha::Patron::Messages->filter_by_last_update
See the occurrences of 'filter_by_last_update' in this script.
Comment 10 Didier Gautheron 2020-07-27 13:03:23 UTC
Created attachment 107415 [details] [review]
Bug 24541: Purge old messages

misc/cronjobs/cleanup_database.pl provides some database cleanup.

This patch adds cleanup for messages table.

Test plan :
- Count messages : select count(*),date(message_date) from  messages group by date(message_date);
- Run cleanup : misc/cronjobs/cleanup_database.pl -v --confirm --messages 365
- Recount messages
Comment 11 Didier Gautheron 2020-07-27 13:05:48 UTC
use Koha::Patron::Messages->filter_by_last_update
Comment 12 Séverine Queune 2020-11-03 15:13:28 UTC
Created attachment 112933 [details] [review]
Bug 24541: Purge old messages

misc/cronjobs/cleanup_database.pl provides some database cleanup.

This patch adds cleanup for messages table.

Test plan :
- Count messages : select count(*),date(message_date) from  messages group by date(message_date);
- Run cleanup : misc/cronjobs/cleanup_database.pl -v --confirm --messages 365
- Recount messages

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 13 Séverine Queune 2020-11-03 15:14:25 UTC
Works fine and respects the use of 'confirm' flag.
Nice one :)
Comment 14 Victor Grousset/tuxayo 2020-12-27 23:03:45 UTC
Created attachment 114711 [details] [review]
Bug 24541: Purge old messages

misc/cronjobs/cleanup_database.pl provides some database cleanup.

This patch adds cleanup for messages table.

Test plan :
- Count messages : select count(*),date(message_date) from  messages group by date(message_date);
- Run cleanup : misc/cronjobs/cleanup_database.pl -v --confirm --messages 365
- Recount messages

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 15 Victor Grousset/tuxayo 2020-12-27 23:03:57 UTC
Works as expected, QA script ok, code ok.
Comment 16 Jonathan Druart 2021-01-04 15:34:07 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 17 Fridolin Somers 2021-01-07 14:25:43 UTC
Small enhancement, I choose to backport.

Pushed to 20.11.x for 20.11.02
Comment 18 Andrew Fuerste-Henry 2021-01-12 14:37:02 UTC
Enhancement, not backporting to 20.05. Please ask if needed