Doesn't exist column "auto_id" in "oc_files_trash" table

We detected in nextcloud web interface, in “dashboard” the messsage “Error occurred while checking server setup”

If we check cloud_ssl_error.log file, we found te message "“There is no column with name ‘auto_id’ on table 'oc_files_trash”.

How can we fix it?

Thanks in advance,

What NC version?

Can you provide the entire log entry (which includes a stack trace)?

setup warnings point you to the docs how to fix the issue.

This is the log entry:

{“reqId”:“7dEJR84SRLfBmdu7zR0r”,“level”:3,“time”:“2023-07-04T09:42:18+02:00”,“remoteAddr”:“[ORIGIN_IP]”,“user”:“[USER]”,“app”:“index”,“method”:“GET”,“url”:“/index.php/settings/ajax/checksetup”,“message”:“There is no column with name ‘auto_id’ on table ‘oc_files_trash’.”,“userAgent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36”,“version”:“25.0.8.2”,“exception”:{“Exception”:“Doctrine\\DBAL\\Schema\\SchemaException”,“Message”:“There is no column with name ‘auto_id’ on table ‘oc_files_trash’.”,“Code”:30,“Trace”:[{“file”:“/var/www/cloud/3rdparty/doctrine/dbal/src/Schema/Table.php”,“line”:771,“function”:“columnDoesNotExist”,“class”:“Doctrine\\DBAL\\Schema\\SchemaException”,“type”:“::”},{“file”:“/var/www/cloud/apps/settings/lib/Controller/CheckSetupController.php”,“line”:795,“function”:“getColumn”,“class”:“Doctrine\\DBAL\\Schema\\Table”,“type”:“->”},{“file”:“/var/www/cloud/apps/settings/lib/Controller/CheckSetupController.php”,“line”:897,“function”:“hasBigIntConversionPendingColumns”,“class”:“OCA\\Settings\\Controller\\CheckSetupController”,“type”:“->”},{“file”:“/var/www/cloud/lib/private/AppFramework/Http/Dispatcher.php”,“line”:225,“function”:“check”,“class”:“OCA\\Settings\\Controller\\CheckSetupController”,“type”:“->”},{“file”:“/var/www/cloud/lib/private/AppFramework/Http/Dispatcher.php”,“line”:133,“function”:“executeController”,“class”:“OC\\AppFramework\\Http\\Dispatcher”,“type”:“->”},{“file”:“/var/www/cloud/lib/private/AppFramework/App.php”,“line”:172,“function”:“dispatch”,“class”:“OC\\AppFramework\\Http\\Dispatcher”,“type”:“->”},{“file”:“/var/www/cloud/lib/private/Route/Router.php”,“line”:298,“function”:“main”,“class”:“OC\\AppFramework\\App”,“type”:“::”},{“file”:“/var/www/cloud/lib/base.php”,“line”:1048,“function”:“match”,“class”:“OC\\Route\\Router”,“type”:“->”},{“file”:“/var/www/cloud/index.php”,“line”:36,“function”:“handleRequest”,“class”:“OC”,“type”:“::”}],“File”:“/var/www/cloud/3rdparty/doctrine/dbal/src/Schema/SchemaException.php”,“Line”:87,“CustomMessage”:“–”}}

Did you run these occ commands?

occ db:add-missing-columns
occ db:add-missing-indices

and if that doesn’t work

occ maintenance:repair --include-expensive

(Just a guess)

1 Like

I’ve executed all the commands you told us, but the error still persist :frowning:

Any other suggestion?

You [sh/c]ould lookup if the “auto_id” column in the “oc_files_trash” table exists and - if not - create it:

I do not know what database Backend you are using.

This would be the query in MySQL/MariaDB:

-- Check if the column exists in the table
SELECT COUNT(*)
FROM information_schema.columns
WHERE table_schema = 'nextcloud'
AND table_name = 'oc_files_trash'
AND column_name = 'auto_id';

-- If the column doesn't exist, create it
ALTER TABLE oc_files_trash
ADD COLUMN IF NOT EXISTS auto_id BIGINT;

and this for PostgreSQL:

-- Check if the column exists in the table
SELECT EXISTS (
    SELECT 1
    FROM information_schema.columns
    WHERE table_name = 'oc_files_trash'
    AND column_name = 'auto_id'
) AS column_exists;

-- If the column doesn't exist, create it
ALTER TABLE oc_files_trash
ADD COLUMN IF NOT EXISTS auto_id BIGINT;

So once again, here some echoes from my console on MySQL/MariaDB:

MariaDB [nextcloud]> SELECT DATA_TYPE
    -> FROM information_schema.columns
    -> WHERE table_schema = 'nextcloud'
    -> AND table_name = 'oc_files_trash'
    -> AND column_name = 'auto_id';
+-----------+
| DATA_TYPE |
+-----------+
| bigint    |
+-----------+
1 row in set (0.001 sec)

MariaDB [nextcloud]> SELECT EXISTS (
    ->     SELECT 1
    ->     FROM information_schema.columns
    ->     WHERE table_name = 'oc_files_trash'
    ->     AND column_name = 'auto_id'
    -> ) AS column_exists;
+---------------+
| column_exists |
+---------------+
|             1 |
+---------------+
1 row in set (0.002 sec)

and from PostgreSQL:

nextcloud=> SELECT EXISTS (
    SELECT 1
    FROM information_schema.columns
    WHERE table_name = 'oc_files_trash'
    AND column_name = 'auto_id'
) AS column_exists;
 column_exists
---------------
 t
(1 row)

I hope this helps you, much luck!