Posted: August 21, 2019 at 5:10 am
Here is the situation:
After 6 months, new tickets and datetimes will be added to the 300+ events for the upcoming season. However, in order to keep this clean and structured as well as reduce the redundant work of creating new datetimes and tickets (those have description, role check etc.), I would like to clear the system of all previous registrations and its related transactions. After that, I would just change the datetimes and ticketdates to the new season dates.
Is that a viable approach or would you recommend deleting the datetimes and related tickets, too?
What needs to be deleted from the DB? Registrations, transactions, tickets and relations? Anything else?
Obviously, one could delete the transactions and registrations via the front end. However, I would do that whole procedure rather programmatically. Are there any functions, methods, classes that you already coded that would help in this endevour?
To delete a registration you need to remove the payments related to its transaction and EE can’t do ‘cascade deletion’ right now. Meaning you can’t click to delete the registration and have EE automatically delete everything that is needed from the payments etc and then delete the registration and transactions for you, then update the datetime/ticket sold values etc.
All of that means that the answer to this:
Is, in short, no.
You’d need to build most of that functionality out, remove all of the relations from the transaction, registrations etc from scratch. There are methods to do each task individually but if it were as simple as just listing out some methods we’d already have this in EE 🙂
If your keeping the datetime/tickets you’d also need to update the sold values on those.
Attempting to delete this data from within the database is complex and there’s a lot of relationships you need to take into consideration, for those reasons we recommend you don’t do it this way.
What we’ve seen other users do is use a separate clean install on subdirectory for each year/season. So each season is effectively a new site with a fresh start.
That is still going to be a lot of work creating the events each year, and if you don’t need to keep the registration data you could basically just reset EE4 back to default on the current site and set it back up as a clean install if doing that.
Another option is to leave all of the data as is, go through each event, change the slug to use the previous date or something and then duplicate the events you need, setting the correct slug and dates as you go.
Say you have Event A with slug
Change that to Event A (2018) and the slug to
The duplicate event you can then set to be Event A and /events/event-a again.
That’s still going to be a lot of work with 300 events, but much less error-prone than manually deleting all of the registration/transactions/payment/relationships and updating values within the DB manually.
The support post ‘Best approach to delete all registrations and transactions’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.