Bug 24541 - Database cleanups, purge messages
Summary: Database cleanups, purge messages
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: didier
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-30 09:03 UTC by didier
Modified: 2020-07-27 13:05 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 24541: Purge old messages (3.80 KB, patch)
2020-01-30 10:09 UTC, didier
Details | Diff | Splinter Review
Attachment to Bug 24541 - Database cleanups, purge messages (3.77 KB, patch)
2020-03-24 08:50 UTC, didier
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
Details | Diff | Splinter Review
Bug 24541: Purge old messages (4.23 KB, patch)
2020-07-27 13:03 UTC, didier
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description didier 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 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 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 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 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 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 2020-07-27 13:05:48 UTC
use Koha::Patron::Messages->filter_by_last_update