Events and Registrations Records - How to remove past events and registrations

  • David Unwin
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
2 years 8 months ago #146317 by David Unwin
Over the years we have had lots of events and registrations. These are all stored in our Joomla data base. 
We now want to look at clearing out the old data. The way I see it there are 2 things you need to do:
1. Export the events and registrations you don't need anymore (for backup and analysis)
2. Select and delete all events and registrations that you do not need any

The problem is I can't' see an easy way to select the events and registrations I want to delete. For use we would like to delete all events and registrations more than 3 months old
For Events, there is no selection based on date i.e. select all events between January 1 and March 31.
For registrations there is a date selector, but I can't see what date is uses is it Event Date or Registration date?
Any thoughts on how we could achieve this?
Also are there any other things I should do apart from deleting the event and registration records as they are in different tables?
 

Please Log in or Create an account to join the conversation.

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
2 years 8 months ago #146318 by Tuan Pham Ngoc
We do not have a build-in function to allow doing this easily, so you will need to run SQL commands below to delete the data (as usual, remember to make a backup of the database before running)
Code:
DELETE FROM jos_eb_events WHERE event_date <= "2021-06-07"; DELETE FROM jos_eb_registrants WHERE event_id NOT IN (SELECT id FROM jos_eb_events); DELETE FROM jos_eb_field_valuesWHERE registrant_id NOT IN (SELECT id FROM jos_eb_registrants);

Regards,

Tuan
The following user(s) said Thank You: David Unwin

Please Log in or Create an account to join the conversation.

  • David Unwin
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
2 years 8 months ago #146319 by David Unwin
Hi Tuan, 
Thanks for this.
There is one small error in Sql. 3rd line, there should be a space between jos_eb_values and WHERE
I ran a simulation query against the data base. The 1st two commands produced results, but the 3rd one no rows matched. Is this correct?
See screen shot attached
 
Attachments:

Please Log in or Create an account to join the conversation.

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
2 years 8 months ago #146323 by Tuan Pham Ngoc
It is normal in case you do not use any other custom fields (except the core fields) for the deleted events

Tuan
The following user(s) said Thank You: David Unwin

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc