Calendar app database

Hello !

I made a mistake. I deleted the tables of the calendar app in my database. I cannot find how to re-import them. I tried to remove/install calendar but that doesn’t work. Now I cannot update NextCloud to 18 because I have this error :
An exception occurred while executing ‘UPDATE oc_calendars SET components = ? WHERE uri = ?’ with params [“VEVENT”, “contact_birthdays”]: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘cloud.oc_calendars’ doesn’t exist

Anyone that as this apps and give me the code create for all the tables of calendar app please ? :cry:

have you tried to deinstall and install the calendar app right after you’ve dropped all calendar related tables? Usually I would expect that all these tables are recreated once the app is installed again.

BTW, it is always worse to create regular backups of your database and personal data :wink:

Yep I know but I didn’t make a backup before. It doesn’t create the tables again. Maybe, if you have a nextcloud server, can you install this app and export the code create of these tables ? :slight_smile:

I hope this helps:

> describe oc_calendars;
+---------------+---------------------+------+-----+---------+----------------+
| Field         | Type                | Null | Key | Default | Extra          |
+---------------+---------------------+------+-----+---------+----------------+
| id            | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| principaluri  | varchar(255)        | YES  | MUL | NULL    |                |
| displayname   | varchar(255)        | YES  |     | NULL    |                |
| uri           | varchar(255)        | YES  |     | NULL    |                |
| synctoken     | int(10) unsigned    | NO   |     | 1       |                |
| description   | varchar(255)        | YES  |     | NULL    |                |
| calendarorder | int(10) unsigned    | NO   |     | 0       |                |
| calendarcolor | varchar(255)        | YES  |     | NULL    |                |
| timezone      | longtext            | YES  |     | NULL    |                |
| components    | varchar(64)         | YES  |     | NULL    |                |
| transparent   | smallint(6)         | NO   |     | 0       |                |
+---------------+---------------------+------+-----+---------+----------------+
1 Like

Calendar app is “only” a client (like DAVx5) for caldav. Nextcloud itself acts as webdav / carddav / caldav server hence the tables are part of Nextcloud and always there.

@j-ed The error for this table is gone, but now the problem is the table oc_calendarobjects. Maybe can you export all the table that are related to this app ?

> describe oc_calendar_invitations;
+--------------+---------------------+------+-----+---------+----------------+
| Field        | Type                | Null | Key | Default | Extra          |
+--------------+---------------------+------+-----+---------+----------------+
| id           | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| uid          | varchar(255)        | NO   |     | NULL    |                |
| recurrenceid | varchar(255)        | YES  |     | NULL    |                |
| attendee     | varchar(255)        | NO   |     | NULL    |                |
| organizer    | varchar(255)        | NO   |     | NULL    |                |
| sequence     | bigint(20) unsigned | YES  |     | NULL    |                |
| token        | varchar(60)         | NO   | MUL | NULL    |                |
| expiration   | bigint(20) unsigned | NO   |     | NULL    |                |
+--------------+---------------------+------+-----+---------+----------------+

> describe oc_calendar_reminders;
+-------------------------+---------------------+------+-----+---------+----------------+
| Field                   | Type                | Null | Key | Default | Extra          |
+-------------------------+---------------------+------+-----+---------+----------------+
| id                      | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| calendar_id             | bigint(20)          | NO   |     | NULL    |                |
| object_id               | bigint(20)          | NO   | MUL | NULL    |                |
| is_recurring            | smallint(6)         | NO   |     | NULL    |                |
| uid                     | varchar(255)        | NO   | MUL | NULL    |                |
| recurrence_id           | bigint(20) unsigned | YES  |     | NULL    |                |
| is_recurrence_exception | smallint(6)         | NO   |     | NULL    |                |
| event_hash              | varchar(255)        | NO   |     | NULL    |                |
| alarm_hash              | varchar(255)        | NO   |     | NULL    |                |
| type                    | varchar(255)        | NO   |     | NULL    |                |
| is_relative             | smallint(6)         | NO   |     | NULL    |                |
| notification_date       | bigint(20) unsigned | NO   |     | NULL    |                |
| is_repeat_based         | smallint(6)         | NO   |     | NULL    |                |
+-------------------------+---------------------+------+-----+---------+----------------+

> describe oc_calendar_resources;
+--------------------+---------------------+------+-----+---------+----------------+
| Field              | Type                | Null | Key | Default | Extra          |
+--------------------+---------------------+------+-----+---------+----------------+
| id                 | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| backend_id         | varchar(64)         | YES  | MUL | NULL    |                |
| resource_id        | varchar(64)         | YES  |     | NULL    |                |
| email              | varchar(255)        | YES  | MUL | NULL    |                |
| displayname        | varchar(255)        | YES  | MUL | NULL    |                |
| group_restrictions | varchar(4000)       | YES  |     | NULL    |                |
+--------------------+---------------------+------+-----+---------+----------------+

> describe oc_calendar_resources_md;
+-------------+---------------------+------+-----+---------+----------------+
| Field       | Type                | Null | Key | Default | Extra          |
+-------------+---------------------+------+-----+---------+----------------+
| id          | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| resource_id | bigint(20) unsigned | NO   | MUL | NULL    |                |
| key         | varchar(255)        | NO   |     | NULL    |                |
| value       | varchar(4000)       | YES  |     | NULL    |                |
+-------------+---------------------+------+-----+---------+----------------+

> describe oc_calendar_rooms;
+--------------------+---------------------+------+-----+---------+----------------+
| Field              | Type                | Null | Key | Default | Extra          |
+--------------------+---------------------+------+-----+---------+----------------+
| id                 | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| backend_id         | varchar(64)         | YES  | MUL | NULL    |                |
| resource_id        | varchar(64)         | YES  |     | NULL    |                |
| email              | varchar(255)        | YES  | MUL | NULL    |                |
| displayname        | varchar(255)        | YES  | MUL | NULL    |                |
| group_restrictions | varchar(4000)       | YES  |     | NULL    |                |
+--------------------+---------------------+------+-----+---------+----------------+

> describe oc_calendar_rooms_md;
+---------+---------------------+------+-----+---------+----------------+
| Field   | Type                | Null | Key | Default | Extra          |
+---------+---------------------+------+-----+---------+----------------+
| id      | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| room_id | bigint(20) unsigned | NO   | MUL | NULL    |                |
| key     | varchar(255)        | NO   |     | NULL    |                |
| value   | varchar(4000)       | YES  |     | NULL    |                |
+---------+---------------------+------+-----+---------+----------------+

> describe oc_calendarchanges;
+--------------+---------------------+------+-----+---------+----------------+
| Field        | Type                | Null | Key | Default | Extra          |
+--------------+---------------------+------+-----+---------+----------------+
| id           | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| uri          | varchar(255)        | YES  |     | NULL    |                |
| synctoken    | int(10) unsigned    | NO   |     | 1       |                |
| calendarid   | bigint(20)          | NO   | MUL | NULL    |                |
| operation    | smallint(6)         | NO   |     | NULL    |                |
| calendartype | int(11)             | NO   |     | 0       |                |
+--------------+---------------------+------+-----+---------+----------------+

> describe oc_calendarobjects;
+----------------+---------------------+------+-----+---------+----------------+
| Field          | Type                | Null | Key | Default | Extra          |
+----------------+---------------------+------+-----+---------+----------------+
| id             | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| calendardata   | longblob            | YES  |     | NULL    |                |
| uri            | varchar(255)        | YES  |     | NULL    |                |
| calendarid     | bigint(20) unsigned | NO   | MUL | NULL    |                |
| lastmodified   | int(10) unsigned    | YES  |     | NULL    |                |
| etag           | varchar(32)         | YES  |     | NULL    |                |
| size           | bigint(20) unsigned | NO   |     | NULL    |                |
| componenttype  | varchar(8)          | YES  |     | NULL    |                |
| firstoccurence | bigint(20) unsigned | YES  |     | NULL    |                |
| lastoccurence  | bigint(20) unsigned | YES  |     | NULL    |                |
| uid            | varchar(255)        | YES  |     | NULL    |                |
| classification | int(11)             | YES  |     | 0       |                |
| calendartype   | int(11)             | NO   |     | 0       |                |
+----------------+---------------------+------+-----+---------+----------------+

> describe oc_calendarobjects_props;
+--------------+---------------------+------+-----+---------+----------------+
| Field        | Type                | Null | Key | Default | Extra          |
+--------------+---------------------+------+-----+---------+----------------+
| id           | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| calendarid   | bigint(20)          | NO   | MUL | 0       |                |
| objectid     | bigint(20) unsigned | NO   | MUL | 0       |                |
| name         | varchar(64)         | YES  | MUL | NULL    |                |
| parameter    | varchar(64)         | YES  |     | NULL    |                |
| value        | varchar(255)        | YES  | MUL | NULL    |                |
| calendartype | int(11)             | NO   |     | 0       |                |
+--------------+---------------------+------+-----+---------+----------------+

> describe oc_calendars;
+---------------+---------------------+------+-----+---------+----------------+
| Field         | Type                | Null | Key | Default | Extra          |
+---------------+---------------------+------+-----+---------+----------------+
| id            | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| principaluri  | varchar(255)        | YES  | MUL | NULL    |                |
| displayname   | varchar(255)        | YES  |     | NULL    |                |
| uri           | varchar(255)        | YES  |     | NULL    |                |
| synctoken     | int(10) unsigned    | NO   |     | 1       |                |
| description   | varchar(255)        | YES  |     | NULL    |                |
| calendarorder | int(10) unsigned    | NO   |     | 0       |                |
| calendarcolor | varchar(255)        | YES  |     | NULL    |                |
| timezone      | longtext            | YES  |     | NULL    |                |
| components    | varchar(64)         | YES  |     | NULL    |                |
| transparent   | smallint(6)         | NO   |     | 0       |                |
+---------------+---------------------+------+-----+---------+----------------+

> describe oc_calendarsubscriptions;
+------------------+---------------------+------+-----+---------+----------------+
| Field            | Type                | Null | Key | Default | Extra          |
+------------------+---------------------+------+-----+---------+----------------+
| id               | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| uri              | varchar(255)        | YES  |     | NULL    |                |
| principaluri     | varchar(255)        | YES  | MUL | NULL    |                |
| displayname      | varchar(100)        | YES  |     | NULL    |                |
| refreshrate      | varchar(10)         | YES  |     | NULL    |                |
| calendarorder    | int(10) unsigned    | NO   |     | 0       |                |
| calendarcolor    | varchar(255)        | YES  |     | NULL    |                |
| striptodos       | smallint(6)         | YES  |     | NULL    |                |
| stripalarms      | smallint(6)         | YES  |     | NULL    |                |
| stripattachments | smallint(6)         | YES  |     | NULL    |                |
| lastmodified     | int(10) unsigned    | YES  |     | NULL    |                |
| synctoken        | int(10) unsigned    | NO   |     | 1       |                |
| source           | longtext            | YES  |     | NULL    |                |
+------------------+---------------------+------+-----+---------+----------------+

Thanks ! The problem to do the update is now solved.
I’m now on Nextcloud 18.1 (the lastest) but I cannot access to the application menu (/index.php/settings/apps), it’s automatically redirected to /index.php. The settings menu works perfectly. That’s really strange.
By the way, an error is spamed in the logs : http://prntscr.com/qykktb

I upgraded from PHP 7.3 to PHP 7.4 and nothing change