Read and tick the following checkbox after you have created the issue or place an x inside the brackets ;)
I reset the Nextcloud News App as it shown in the FAQ
DELETE FROM oc_appconfig WHERE appid = 'news';
DROP TABLE oc_news_items;
DROP TABLE oc_news_feeds;
DROP TABLE oc_news_folders;
After I reinstalled the app, it no longer loads. Only the following error message in the logs:
Error | index | Doctrine\DBAL\Exception\TableNotFoundException:聽An exception occurred while executing 'SELECT COUNT(*) AS size FROM oc_news_items items JOIN oc_news_feeds feeds ON feeds.id = items.feed_id AND feeds.deleted_at = 0 AND feeds.user_id = ? AND items.starred = ? LEFT OUTER JOIN oc_news_folders folders ON folders.id = feeds.folder_id WHERE feeds.folder_id = 0 OR folders.deleted_at = 0' with params ["leo", true]: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_news_items' doesn't exist
-- | -- | --
Run ./occ maintenance:repair news
maintenance repair don鈥檛 work, see output:
sudo -u www-data ./occ maintenance:repair news
_Too many arguments, expected arguments "command".
maintenance:repair [--include-expensive]_
Try to run just ./occ maintenance:repair (without news)
Yes, of course I've already tried that. It looks like the app won't create new entries on reinstallation after deleting the database. I upgraded Nextcloud from 19.0.4 RC1 to Nextcloud 20. All without any problems. Since the database of the news app was so big, I wanted to reset it as described in the FAQ.
Hmm what you might try in additon to your steps:
Have a look at table oc_jobs. There should be a line called OCA\News\Cron\Updater. Delete it.
Maybe this bring back the News app working?!
I removed this table. Unfortunately it doesn't work. OCA\News\Cron\Updater is newly created and the same error message appears in the Nextcloud log.
You removed the whole table oc_jobs instead of just the line?
Have you tried manually rebuilding the oc_news_... tables?
No, i removed only the Line OCA\News\Cron\Updater. How can i rebuild manually? CREATE TABLE oc_news_items; ? Is this right?
Yeah, more or less - you need to also to rebuild the whole table structure and also the other tables.
Try running a migration of the news app, that should create the tables again.
Try running a migration of the news app, that should create the tables again.
I did that according to the FAQ. The tables were not created. I don't trust myself to create it manually.
Same here. I expected occ app:remove to make a clean uninstall but quickly found out that it's not that simple. Tried to remove those three tables manually as well as the cache and config folders and now fresh installs don't create those tables.
Not sure if it's related but I did migrate to Nextcloud 20 yesterday and the first attempt failed on the news app with some errors regarding constraint violations or duplicate indices (I don't remember clearly, saw similar messages in one of the pull requests and decided to wait it out). It left Nextcloud in the maintenance mode and I had to finish migration manually via occ. Everything seems to work now, except the news app. It started to show me the news I already read and I thought that the easiest and surest way to make sure everything is OK is to export my feeds and to do a clean reinstall. Well, it wasn't a good idea apparently =)
I can also confirm this issue. I had the cron bug #819 and I though resetting would help. Big mistake, now the news app doesn't work. It won't create the DB entries or the config files. I tried doing a migration and installing the 14 version and it still won't create the tables.
When installing I get the following errors(I removed my user name):
[index] Error: Doctrine\DBAL\Exception\TableNotFoundException: An exception occurred while executing 'SELECT * FROMoc_news_foldersWHEREuser_id= ? ANDdeleted_at` = 0' with params [""]:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_news_folders' doesn't exist at <
GET /apps/news/folders
from 187.227.169.49 by at 2020-10-04T00:34:15+00:00`
[index] Error: Doctrine\DBAL\Exception\TableNotFoundException: An exception occurred while executing 'SELECT * FROMoc_news_foldersWHEREuser_id= ? ANDdeleted_at` = 0' with params [""]:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_news_folders' doesn't exist at <
GET /apps/news/folders
from 187.227.169.49 by at 2020-10-04T00:34:15+00:00`
which simply tells me the tables are not created.
I encountered the same issue. I could resolve it by resetting it as described by the reporter and doing the following steps afterwards
Not sure why that FAQ item was there, it's terrible advice. It doesn't really reset anything as much as completely deleting all data and leaving news in a broken state. You need to figure out how to redo an old (14.2.0) news database migration to fix this. I made a pull request to remove the advice.
Not sure why that FAQ item was there, it's terrible advice. It doesn't really reset anything as much as completely deleting all data and leaving news in a broken state. You need to figure out how to redo an old (14.2.0) news database migration to fix this. I made a pull request to remove the advice.
But what's holding back the database creation? I deleted the app completely and still fails. The only log I get is the app trying to use the database but not creating them when I try to install it again.
What does ./occ migrations:status news report?
What does
./occ migrations:status newsreport?
In AppLocator.php line 48:
App not found
The app is not installed and after installing from the app store I get:
>> App: news
>> Version Table Name: oc_migrations
>> Migrations Namespace: OCA\News\Migration
>> Migrations Directory: /var/www/html/nextcloud/apps/news/lib/Migration
>> Previous Version: 0
>> Current Version: 140200Date20200824201413
>> Next Version: Already at latest migration step
>> Latest Version: 140200Date20200824201413
>> Executed Migrations: 1
>> Executed Unavailable Migrations: 1
>> Available Migrations: 1
>> New Migrations: 1
>> Pending Migrations: None
I'm also getting this error while installing. I didn't see it before because it's at Info level:
[no app in context] Info: Deprecated event type for OCA\Files::loadAdditionalScripts: Symfony\Component\EventDispatcher\GenericEvent is used
GET /apps/files
And of course the same no database table errors
You need to clean the news migration from the oc_migrations table, since the updated structure really can't deal with people editing the database. After that this should report a pending migration, and executing it will recreate the database.
You need to clean the news migration from the
oc_migrationstable, since the updated structure really can't deal with people editing the database. After that this should report a pending migration, and executing it will recreate the database.
Thanks, that fix it. I still got the Info error but the app is working. I used "DELETE FROM oc_migrations WHERE app = 'news';" for those having this issue.
We could just add DELETE FROM oc_migrations WHERE app = 'news'; to the existing removal instructions?
You don't really need to do that on normal removals AFAIK.
Can confirm, dropping migrations worked for me. @SMillerDev thanks for the advice!
@wolflarson yea, that would be nice since Nextcloud platform provides no way of doing clean removals: (https://github.com/nextcloud/server/issues/5539). This issue is pretty old and it seems like there is no internal motivation to implement clean removals universally across the platform and this change is also too consequential to expect that the outside contributors would send a patch (hope I'm wrong here). That fact partially justifies the FAQ entry: some people might want to do that for various reasons and there are no cleaner ways to do that.
Some users may want to de-clutter their instances and there is nothing wrong with it. Unfortunately, it's not that easy but at least they have the "manual" option. That's better than no options IMO.
Closing this since it's not actually supported and has a fix
Most helpful comment
Thanks, that fix it. I still got the Info error but the app is working. I used "DELETE FROM oc_migrations WHERE app = 'news';" for those having this issue.