This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch postgresql
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 442305327a7e96ec7f6d01709ec6fd21904389fd
Author: Quan Tran <[email protected]>
AuthorDate: Wed Feb 7 15:16:46 2024 +0700

    JAMES-2586 SQL script to clean outdated vacation notifications
---
 server/apps/postgres-app/README.adoc  | 3 ++-
 server/apps/postgres-app/clean_up.sql | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/server/apps/postgres-app/README.adoc 
b/server/apps/postgres-app/README.adoc
index 219d276b29..f30f9c4851 100644
--- a/server/apps/postgres-app/README.adoc
+++ b/server/apps/postgres-app/README.adoc
@@ -131,4 +131,5 @@ docker compose -f docker-compose-distributed.yml up -d
 To clean up some specific data, that will never be used again after a long 
time, you can execute the SQL queries `clean_up.sql`.
 The never used data are:
 - mailbox_change
-- email_change
\ No newline at end of file
+- email_change
+- vacation_notification_registry
\ No newline at end of file
diff --git a/server/apps/postgres-app/clean_up.sql 
b/server/apps/postgres-app/clean_up.sql
index cee84dce80..c0f8f0b843 100644
--- a/server/apps/postgres-app/clean_up.sql
+++ b/server/apps/postgres-app/clean_up.sql
@@ -17,5 +17,10 @@ $$
         DELETE
         FROM email_change
         WHERE date < current_timestamp - interval '1 day' * days_to_keep;
+
+        -- Delete outdated vacation notifications (older than the current UTC 
timestamp)
+        DELETE
+        FROM vacation_notification_registry
+        WHERE expiry_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC';
     END
 $$;
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to