Delete an Team's Calendar event from Confluence Data Center using database query
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
The steps outlined on this article are provided AS-IS. This means we've had reports of them working for some customers — under certain circumstances — yet are not officially supported, nor can we guarantee they'll work for your specific scenario.
You may follow through and validate them on your own non-prod environments prior to production or fall back to supported alternatives if they don't work out.
We also invite you to reach out to our Community for matters that fall beyond Atlassian's scope of support!
Summary
The knowledge base article is relevant only if you are unable to delete a Teams Calendar entry from the Confluence Data Center UI that was imported via an external .iCal file
Diagnosis
You may encounter errors similar to the following in the atlassian.confluence.log file when attempting to delete a Calendar entry through the Confluence UI.
grep -i "calendar3.error.deleteevents.notexist" atlassian.confluence.log
Com.atlassian.confluence.extra.calendar3.exception.CalendarException: calendar3.error.deleteevents.notexist
at com.atlassian.confluence.extra.calendar3.DefaultCalendarManager.removeEvent(DefaultCalendarManager.java:1354)
at com.atlassian.confluence.extra.calendar3.rest.resources.EventResource.deleteEvent(EventResource.java:367)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
Caused by: java.lang.NullPointerException
Solution
Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
Below queries have been tested with PostgreSQL Database. Please modify the queries if required as per your database syntax.
Step 1: Execute the below query replacing <Calendar name> ,<Summary> and <Description> of the calendar.
SELECT ID, SC."NAME" FROM "AO_950DC3_TC_EVENTS" E JOIN "AO_950DC3_TC_SUBCALS" SC
ON E."SUB_CALENDAR_ID" = SC."ID"
WHERE SC."NAME" = '<Calendar name>'
AND E."SUMMARY" = '<Summary>'
AND E."DESCRIPTION" LIKE '%<Description>!%';
Step 2: Please Note down ID values from the results of the above query, we would require them for the next step
Step 3: Execute the below query to delete the event replacing <id1> values
delete from "AO_950DC3_TC_EVENTS" where "ID" IN ('<id1>','<id2>','<id3>',...);
Step 4: Execute the below select query to verify if the events are deleted for above <id1>
select * from "AO_950DC3_TC_EVENTS" where "ID" IN ('<id1>','<id2>','<id3>',...);
This process requires the use of direct database manipulation and is not part of Confluence's intended functionality. As such, this process is not covered under the Atlassian Support Offerings and the information on this page is provided as-is. It should be thoroughly tested in a development or staging environment before implementing any changes in your production instance.