Purge all information in all calendars or selected calendars

To enable calendar in our production server we need to ensure that we can purge all data from our systems in case we need it (for GPRD requirements)

(edit 2023-05-24 extend proposal with @tcit advices)

I’ve tried a couple of methods:

  1. A user can delete all its information just removing the calendar (it will remain on trash bin)
  2. An admin can purge al calendar information of a user using occ dav:remove-calendar uid name (use --force to avoid trash bin)
  3. An admin can purge all information of user including calendars removing the user itself
  4. Finally, I’ve tested to truncate all calendar related tables from database. Even with deck & calendars active, method seems to work fine and is able to recreate Deck cards dates. (extended with @tcit advices)
truncate table oc_calendar_appt_configs;
truncate table oc_calendar_appt_bookings;
truncate table oc_calendar_invitations;
truncate table oc_calendar_reminders;
truncate table oc_calendar_resources;
truncate table oc_calendar_resources_md;
truncate table oc_calendar_rooms;
truncate table oc_calendar_rooms_md;
truncate table oc_calendarchanges;
truncate table oc_calendarobjects;
truncate table oc_calendarobjects_props;
truncate table oc_calendars;
truncate table oc_calendarsubscriptions;
truncate table oc_schedulingobjects;
delete from oc_properties where propertypath like 'calendars/%';
delete from oc_dav_shares where type = 'calendar';
delete from oc_preferences where appid = 'dav';
delete from oc_preferences where appid = 'calendar';
delete from oc_activity where app = 'dav';
delete from oc_activity_mq where amq_appid = 'dav';
delete from oc_activity_mq where amq_appid = 'calendar';

Is method 4 a safe way to purge all calendar data? Is there any other deep way to drop/truncate tables and recreates structures?

Note: unless specific app settings, this will put the calendar in the trashbin (where it will stay for 30 days).

This command has a --force option to bypass the trashbin.

This should indeed remove everything.

You can add oc_schedulingobjects that holds calendar invitations (iMip)

There’s also oc_dav_shares that holds calendar shares (AND addressbook shares - filter on the type column) and oc_properties that holds DAV properties (so WebDAV and CardDAV as well as CalDAV, filter on propertypath prefix).

A few user settings can be found in oc_preferences:

SELECT * FROM oc_preferences WHERE appid = 'dav';
SELECT * FROM oc_preferences WHERE appid = 'calendar';

Finally, the activity log is available in oc_activity, where you can filter on app='dav'. oc_activity_mq can have pending emails data as well.

Otherwise, this should be fine.

Thanks @tcit! Good to see you again! (You helped me on a similar issue on Deck).

I will extend my first post with your kindly advice to help any other interested on this topic.

Regards