Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown column 'next_update_time' in 'field list' #3048

Closed
3 tasks done
nocin opened this issue Jan 14, 2025 · 7 comments
Closed
3 tasks done

Unknown column 'next_update_time' in 'field list' #3048

nocin opened this issue Jan 14, 2025 · 7 comments
Labels

Comments

@nocin
Copy link

nocin commented Jan 14, 2025

IMPORTANT

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

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

Explain the Problem

What problem did you encounter?

Since update to version 25.2.0, feeds are not pulled anymore and the following error message appears in the Nextcloud log:

 DbalException An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'next_update_time' in 'field list'
Error while running background job OCA\News\Cron\UpdaterJob (id: 33551, arguments: null) 

Image

System Information

  • News app version: 25.2.0
  • Nextcloud version: 29.0.10
  • Cron type: (system cron/python updater/...) Using the Nextcloud Cron Docker Container
  • PHP version: 8.2.27
  • Database and version: mysql 10.5.27
@nocin nocin added the bug label Jan 14, 2025
@SMillerDev
Copy link
Contributor

Do you have database migrations that still need to be performed? Because that's a new column

@nocin
Copy link
Author

nocin commented Jan 14, 2025

That could be, but Nextcloud doesn't tell me anything about a database migration.
Image

Is there an occ command I can run to trigger a DB migration?

@Grotax
Copy link
Member

Grotax commented Jan 14, 2025

No migrations are executed automatically when nextcloud updates the app.

Only if you set nextxloud to debug mode you can execute some migration commands.

I'm not really sure what the concept is for the situation that an update was executed but the migration was not executed successfully, every now and then people have issues like this, missing migrations in their database.

It's not an issue with news though.

@Grotax
Copy link
Member

Grotax commented Jan 14, 2025

You will need SQL access to your Database.

  1. check if the migrations table is at least up to date
SELECT * from oc_migrations where app='news';


+------+--------------------------+
| app  | version                  |
+------+--------------------------+
| news | 140200Date20200824201413 |
| news | 150004Date20201009183830 |
| news | 150005Date20201009192341 |
| news | 150200Date20210118190652 |
| news | 150203Date20210204203051 |
| news | 150302Date20210312231251 |
| news | 150400Date20210318215425 |
| news | 250000Date20240817095614 |
| news | 250200Date20241219085150 |
+------+--------------------------+

Version 250200Date20241219085150 is important here.

Then you can try to apply the change manually:

ALTER TABLE oc_news_feeds
ADD COLUMN IF NOT EXISTS next_update_time BIGINT(20) NULL;
COMMIT;

But I have to say that it is experimental, it's not part of the concept for apps to run queries manually.
Maybe also check your logs if something went wrong when you updated the News app, that could help to identify the issue.

@Grotax Grotax added support and removed bug labels Jan 14, 2025
@nocin
Copy link
Author

nocin commented Jan 15, 2025

Thank you for your explanation and the workaround! It seems that it worked! There is no error in the logs, and some feeds were updated after cron ran.
I'm running MariaDB in a Docker Container and was able to add the column using the following commands:

# Access mariadb container
docker exec -it nextcloud-db bash 
# Access MariaDB inside the container
mysql -u root -p
# Display database 
SHOW DATABASES;
# select the nextcloud database
use nextcloud;
# check if the migrations table is at least up to date
SELECT * from oc_migrations where app='news';
# run the command to add the missing column
ALTER TABLE oc_news_feeds
    -> ADD COLUMN IF NOT EXISTS next_update_time BIGINT(20) NULL;

Query OK, 0 rows affected (0.038 sec)
Records: 0  Duplicates: 0  Warnings: 0

# run commit
COMMIT;

Query OK, 0 rows affected (0.001 sec)

# exit MariaDB
exit;
# exit docker container
exit

@nocin nocin closed this as completed Jan 15, 2025
@nocin
Copy link
Author

nocin commented Jan 15, 2025

Just one addition, when I was running the nextcloud repair command

docker exec --user www-data nextcloud-app php /var/www/html/occ maintenance:mode --on
docker exec --user www-data nextcloud-app php /var/www/html/occ maintenance:repair
docker exec --user www-data nextcloud-app php /var/www/html/occ maintenance:mode --off

I saw in the result, that an update Job related to News got deleted. Perhaps this was the job that should have triggered the db migration?!

Image

Before I posted here, I also downgraded the news app and then triggered the news app update once more from the WebUI, but I got the same missing column error.

@Grotax
Copy link
Member

Grotax commented Jan 15, 2025

That repair step is to remove an old no longer used update job, since those are not automatically removed by Nextcloud.

You simply ran into the issue that Nextcloud updated the app and did all the steps except actually adjusting the DB schema, since Nextcloud recorded the migration already it will not try to run the migration again.

DB Schemas and data stays when you delete an app at least that is the case for News.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants