News: Installation fails on Nextcloud 20.0.2 (News 15.0.6) missing column 'unread'

Created on 25 Nov 2020  ·  11Comments  ·  Source: nextcloud/news

IMPORTANT

Read and tick the following checkbox after you have created the issue or place an x inside the brackets ;)

  • [x ] I have read the CONTRIBUTING.md and followed the provided tips
  • [x ] I accept that the issue will be closed without comment if I do not check here
  • [x ] I accept that the issue will be closed without comment if I don not fill out all items in the issue template.

Explain the Problem

When I try to install the news app I encounter the following error:

An error occured during the request. Unable to proceed.
An exception occurred while executing 'UPDATE `oc_news_items` SET `unread` = ((`status` & 2) = 2), `starred` = ((`status` & 4) = 4)': SQLSTATE[42S22]: Column not found: 1054 Unknown column 'unread' in 'field list'

Steps to Reproduce

The error occurs when I try to install news over the web interface.

System Information

  • News app version: 15.0.6
  • Nextcloud version: 20.0.2 (also tested with 20.0.1 and 19.0.5)
  • Cron type: crontab
  • PHP version: 7.3.19
  • Database and version: MariaDB 10.3.25
  • Browser and version: Firefox 83.0 (64bit)
  • Distribution and version: Raspian Buster

Contents of nextcloud/data/nextcloud.log

{"reqId":"XT3r7uBGWB8p2Fo3WBTJ","level":3,"time":"2020-11-25T20:12:51+00:00","remoteAddr":"2a03:567:1::12","user":"<changed>","app":"settings","method":"POST","url":"/nextcloud/index.php/settings/apps/enable","message":{"Exception":"Doctrine\\DBAL\\Exception\\InvalidFieldNameException","Message":"An exception occurred while executing 'UPDATE `oc_news_items` SET `unread` = ((`status` & 2) = 2), `starred` = ((`status` & 4) = 4)':\n\nSQLSTATE[42S22]: Column not found: 1054 Unknown column 'unread' in 'field list'","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php","line":169,"function":"convertException","class":"Doctrine\\DBAL\\Driver\\AbstractMySQLDriver","type":"->","args":["An exception occurred while executing 'UPDATE `oc_news_items` SET `unread` = ((`status` & 2) = 2), `starred` = ((`status` & 4) = 4)':\n\nSQLSTATE[42S22]: Column not found: 1054 Unknown column 'unread' in 'field list'",{"errorInfo":["42S22",1054,"Unknown column 'unread' in 'field list'"],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"}]},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php","line":145,"function":"wrapException","class":"Doctrine\\DBAL\\DBALException","type":"::","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDOMySql\\Driver"},{"errorInfo":["42S22",1054,"Unknown column 'unread' in 'field list'"],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"},"An exception occurred while executing 'UPDATE `oc_news_items` SET `unread` = ((`status` & 2) = 2), `starred` = ((`status` & 4) = 4)':\n\nSQLSTATE[42S22]: Column not found: 1054 Unknown column 'unread' in 'field list'"]},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Statement.php","line":162,"function":"driverExceptionDuringQuery","class":"Doctrine\\DBAL\\DBALException","type":"::","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDOMySql\\Driver"},{"errorInfo":["42S22",1054,"Unknown column 'unread' in 'field list'"],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"},"UPDATE `oc_news_items` SET `unread` = ((`status` & 2) = 2), `starred` = ((`status` & 4) = 4)",[]]},{"file":"/var/www/html/nextcloud/apps/news/lib/Migration/MigrateStatusFlags.php","line":60,"function":"execute","class":"Doctrine\\DBAL\\Statement","type":"->","args":[]},{"file":"/var/www/html/nextcloud/lib/private/Repair.php","line":103,"function":"run","class":"OCA\\News\\Migration\\MigrateStatusFlags","type":"->","args":[{"__class__":"OC\\Repair"}]},{"file":"/var/www/html/nextcloud/lib/private/legacy/OC_App.php","line":976,"function":"run","class":"OC\\Repair","type":"->","args":[]},{"file":"/var/www/html/nextcloud/lib/private/Installer.php","line":160,"function":"executeRepairSteps","class":"OC_App","type":"::","args":["news",{"step":"OCA\\News\\Migration\\MigrateStatusFlags"}]},{"file":"/var/www/html/nextcloud/apps/settings/lib/Controller/AppSettingsController.php","line":447,"function":"installApp","class":"OC\\Installer","type":"->","args":["news"]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":170,"function":"enableApps","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->","args":[["news"],[]]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":100,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\AppSettingsController"},"enableApps"]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/App.php","line":137,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\AppSettingsController"},"enableApps"]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Settings\\Controller\\AppSettingsController","enableApps",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"settings.AppSettings.enableApps"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"_route":"settings.AppSettings.enableApps"}]},{"file":"/var/www/html/nextcloud/lib/private/Route/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"_route":"settings.AppSettings.enableApps"}]},{"file":"/var/www/html/nextcloud/lib/base.php","line":1010,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/settings/apps/enable"]},{"file":"/var/www/html/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php","Line":60,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDOException","Message":"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'unread' in 'field list'","Code":"42S22","Trace":[{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Statement.php","line":153,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDOStatement","type":"->","args":[null]},{"file":"/var/www/html/nextcloud/apps/news/lib/Migration/MigrateStatusFlags.php","line":60,"function":"execute","class":"Doctrine\\DBAL\\Statement","type":"->","args":[]},{"file":"/var/www/html/nextcloud/lib/private/Repair.php","line":103,"function":"run","class":"OCA\\News\\Migration\\MigrateStatusFlags","type":"->","args":[{"__class__":"OC\\Repair"}]},{"file":"/var/www/html/nextcloud/lib/private/legacy/OC_App.php","line":976,"function":"run","class":"OC\\Repair","type":"->","args":[]},{"file":"/var/www/html/nextcloud/lib/private/Installer.php","line":160,"function":"executeRepairSteps","class":"OC_App","type":"::","args":["news",{"step":"OCA\\News\\Migration\\MigrateStatusFlags"}]},{"file":"/var/www/html/nextcloud/apps/settings/lib/Controller/AppSettingsController.php","line":447,"function":"installApp","class":"OC\\Installer","type":"->","args":["news"]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":170,"function":"enableApps","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->","args":[["news"],[]]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":100,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\AppSettingsController"},"enableApps"]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/App.php","line":137,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\AppSettingsController"},"enableApps"]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Settings\\Controller\\AppSettingsController","enableApps",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"settings.AppSettings.enableApps"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"_route":"settings.AppSettings.enableApps"}]},{"file":"/var/www/html/nextcloud/lib/private/Route/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"_route":"settings.AppSettings.enableApps"}]},{"file":"/var/www/html/nextcloud/lib/base.php","line":1010,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/settings/apps/enable"]},{"file":"/var/www/html/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php","Line":119,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'unread' in 'field list'","Code":"42S22","Trace":[{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php","line":117,"function":"execute","class":"PDOStatement","type":"->","args":[null]},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Statement.php","line":153,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDOStatement","type":"->","args":[null]},{"file":"/var/www/html/nextcloud/apps/news/lib/Migration/MigrateStatusFlags.php","line":60,"function":"execute","class":"Doctrine\\DBAL\\Statement","type":"->","args":[]},{"file":"/var/www/html/nextcloud/lib/private/Repair.php","line":103,"function":"run","class":"OCA\\News\\Migration\\MigrateStatusFlags","type":"->","args":[{"__class__":"OC\\Repair"}]},{"file":"/var/www/html/nextcloud/lib/private/legacy/OC_App.php","line":976,"function":"run","class":"OC\\Repair","type":"->","args":[]},{"file":"/var/www/html/nextcloud/lib/private/Installer.php","line":160,"function":"executeRepairSteps","class":"OC_App","type":"::","args":["news",{"step":"OCA\\News\\Migration\\MigrateStatusFlags"}]},{"file":"/var/www/html/nextcloud/apps/settings/lib/Controller/AppSettingsController.php","line":447,"function":"installApp","class":"OC\\Installer","type":"->","args":["news"]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":170,"function":"enableApps","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->","args":[["news"],[]]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":100,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\AppSettingsController"},"enableApps"]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/App.php","line":137,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Settings\\Controller\\AppSettingsController"},"enableApps"]},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Settings\\Controller\\AppSettingsController","enableApps",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"settings.AppSettings.enableApps"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"_route":"settings.AppSettings.enableApps"}]},{"file":"/var/www/html/nextcloud/lib/private/Route/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"_route":"settings.AppSettings.enableApps"}]},{"file":"/var/www/html/nextcloud/lib/base.php","line":1010,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/settings/apps/enable"]},{"file":"/var/www/html/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php","Line":117}},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0","version":"19.0.5.2"}

Contents of Browser Error Console


Object { apps: Getter & Setter, categories: Getter & Setter, updateCount: Getter & Setter, loading: Getter & Setter, loadingList: Getter & Setter, … }

Object { appId: "news", error: Error }
apps.js:39:10


0. Needs triage API bug

Most helpful comment

Well the steps above installed the app but it was still not working, I needed to:

  • Remove the all oc_migrations with a mysql statement DELETE FROM oc_migrations WHERE app = 'news';
  • run ./occ migrations:migrate news

All 11 comments

Did you have an existing news install in this database at any time before?

No. I tried to install it for the first time.

Is there a way for you to check in the database what the oc_news_items table looks like?

DESCRIBE oc_news_items; gives:

MariaDB [nextcloud]> describe oc_news_items;
+----------------+---------------------+------+-----+---------+----------------+
| Field          | Type                | Null | Key | Default | Extra          |
+----------------+---------------------+------+-----+---------+----------------+
| id             | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| guid_hash      | varchar(32)         | NO   | MUL | NULL    |                |
| fingerprint    | varchar(32)         | YES  | MUL | NULL    |                |
| rtl            | tinyint(1)          | NO   |     | 0       |                |
| search_index   | longtext            | YES  |     | NULL    |                |
| guid           | longtext            | NO   |     | NULL    |                |
| url            | longtext            | YES  |     | NULL    |                |
| title          | longtext            | YES  |     | NULL    |                |
| author         | longtext            | YES  |     | NULL    |                |
| pub_date       | bigint(20) unsigned | YES  |     | NULL    |                |
| body           | longtext            | YES  |     | NULL    |                |
| enclosure_mime | longtext            | YES  |     | NULL    |                |
| enclosure_link | longtext            | YES  |     | NULL    |                |
| feed_id        | bigint(20) unsigned | NO   | MUL | NULL    |                |
| status         | bigint(20)          | NO   |     | 0       |                |
| last_modified  | bigint(20) unsigned | YES  |     | 0       |                |
+----------------+---------------------+------+-----+---------+----------------+

You're missing about half the columns that should be in there. Could you run ./occ migrations:status news to see if you're missing any migrations and if that's not the case, remove the oc_news_items table and try again?

./occ migrations:status news results in "App not found".

I dropped the table oc_news_items and tried to reinstall the news app over the webinterface. This now throws this error:

An exception occurred while executing 'UPDATE oc_news_items SET unread = ((status & 2) = 2), starred = ((status & 4) = 4)': SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_news_items' doesn't exist

I tried ./occ migrations:status news again:

root@rpibuster:/var/www/html/nextcloud# sudo -u www-data php occ migrations:status news
    >> App:                                                news
    >> Version Table Name:                                 oc_migrations
    >> Migrations Namespace:                               OCA\News\Migration
    >> Migrations Directory:                               /var/www/html/nextcloud/apps/news/lib/Migration
    >> Previous Version:                                   140200Date20200824201413
    >> Current Version:                                    150004Date20201009183830
    >> Next Version:                                       Already at latest migration step
    >> Latest Version:                                     150004Date20201009183830
    >> Executed Migrations:                                2
    >> Executed Unavailable Migrations:                    2
    >> Available Migrations:                               2
    >> New Migrations:                                     2
    >> Pending Migrations:                                 None

I'm stuck at excatly the same state. When I download and enable the news app in nc 19.0.4, I get 1146 Table 'nextcloud.oc_news_items' doesn't exist

I got it working with (see https://github.com/nextcloud/news/issues/838):

DELETE FROM oc_appconfig WHERE appid = 'news';
DROP TABLE oc_news_items;
DROP TABLE oc_news_feeds;
DROP TABLE oc_news_folders;

And then dowload and enable the news app again.

Well the steps above installed the app but it was still not working, I needed to:

  • Remove the all oc_migrations with a mysql statement DELETE FROM oc_migrations WHERE app = 'news';
  • run ./occ migrations:migrate news

@varac

Thanks for sharing your solution. It also worked for me.

Was this page helpful?
0 / 5 - 0 ratings