19.0.4 to 20.0.2 upgrade: table oc_direct_edit missing

Support intro

I tried to upgrade from 19.0.4 to 20.0.2 using the web updater.

First problem was similar to the one described here: https://github.com/nextcloud/server/issues/13732

I was able to solve it by following the suggestions given there.

New attempt to upgrade resulted in this error:

Preparing update
Set log level to debug
Turned on maintenance mode
Repair step: Repair MySQL collation
Repair info: All tables already have the correct collation -> nothing to do
Repair step: Repair SQLite autoincrement
Repair step: Copy data from accounts table when migrating from ownCloud
Repair step: Drop account terms table when migrating from ownCloud
Updating database schema
Doctrine\DBAL\Schema\SchemaException: There is no table with name 'nextcloud.oc_direct_edit' in the schema.

So there I am. I guess the table oc_direct_edit needs to be created, but I don’t have the table schema.

Nextcloud version: 19.0.4
Operating system and version: Ubuntu Server 18.04
Apache version: Server version: Apache/2.4.29 (Ubuntu); Server built: 2020-08-12T21:33:25
PHP version: PHP 7.4.12 (cli) (built: Oct 31 2020 17:04:09)

The issue you are facing:
Doctrine\DBAL\Schema\SchemaException: There is no table with name ‘nextcloud.oc_direct_edit’ in the schema.

Is this the first time you’ve seen this error?: Y

Steps to replicate it:

  1. run the web updater

The output of your Nextcloud log in Admin > Logging: Can’t login

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'ocabcdefghij',
  'passwordsalt' => '...',
  'secret' => '...',
  'trusted_domains' =>
  array (
    0 => 'nc.example.org',
    1 => '1.2.3.4',
    2 => 'localhost',
    3 => '192.168.0.101',
    4 => '192.168.3.11',
  ),
  'trusted_proxies' =>
  array (
    0 => '192.168.3.11',
  ),
  'datadirectory' => '/media/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '19.0.4.2',
  'overwrite.cli.url' => 'https://nc.example.org',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => 'secret',
  'installed' => true,
  'maintenance' => true,
  'theme' => '',
  'loglevel' => 2,
  'overwritehost' => 'nc.example.org',
  'overwriteprotocol' => 'https',
  'overwritecondaddr' => '^192\\.168\\.3\\.11',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'app_install_overwrite' =>
  array (
    0 => 'mindmap_app',
  ),
  'mysql.utf8mb4' => true,
  'updater.secret' => '...',
);

The problem has already been reported but unfortunately a fix hasn’t been provided yet:

First you should try to run the “occ maintenance:repair ...” command and check if the missing table is created.

If this didn’t work, you can wait until a new Nextcloud release is being published which fixes the issue or try to add the table manually. Keep in mind to create backups of your data before you directly edit the database structure :wink:

> describe oc_direct_edit;
+-----------+---------------------+------+-----+---------+----------------+
| Field     | Type                | Null | Key | Default | Extra          |
+-----------+---------------------+------+-----+---------+----------------+
| id        | bigint(20)          | NO   | PRI | NULL    | auto_increment |
| editor_id | varchar(64)         | NO   |     | NULL    |                |
| token     | varchar(64)         | NO   | MUL | NULL    |                |
| file_id   | bigint(20)          | NO   |     | NULL    |                |
| user_id   | varchar(64)         | YES  |     | NULL    |                |
| share_id  | bigint(20)          | YES  |     | NULL    |                |
| timestamp | bigint(20) unsigned | NO   |     | NULL    |                |
| accessed  | tinyint(1)          | YES  |     | 0       |                |
| file_path | varchar(4000)       | YES  |     | NULL    |                |
+-----------+---------------------+------+-----+---------+----------------+

Thanks – I was able to solve this by issuing:

CREATE TABLE oc_direct_edit (id BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY, editor_id VARCHAR(64) NOT NULL, token VARCHAR(64) NOT NULL, file_id BIGINT NOT NULL, user_id VARCHAR(64) DEFAULT NULL, share_id BIGINT DEFAULT NULL, timestamp BIGINT UNSIGNED NOT NULL, accessed TINYINT(1) DEFAULT '0', file_path VARCHAR(4000) DEFAULT NULL);

and

ALTER TABLE oc_direct_edit ADD INDEX(token);
1 Like