action-scheduler
action-scheduler copied to clipboard
Problems when db user cannot create or alter tables
Hi there
Some of my Wordpress sites didn't have admin rights on the SQL user side when I upgraded Woocommerce.
I now have fatal errors because the "priority" column in the wp_actionscheduler_actions table was not created when I updated Woocommerce (and therefore ActionScheduler).
How can I manually replay the last two ActionScheduler core updates please?
Manual creation using the sql command given on another workstation doesn't work:
ALTER TABLE wp_actionscheduler_actions
ADD priority
TINYINT(3) UNSIGNED NOT NULL DEFAULT '10' AFTER extended_args
;
And I want to repatch the whole thing. I don't have access to WP CLI.
Thanks for your help, I've already spent many hours
I finally success to install WP CLI and run the command for manually update ActionScheduler : and everything works !!
Same here. My whole WP site was down because the SQL trying inserting a new row with field priority
but the column was not added yet.
It seems no straightforward way to fix it, including disabling all plugin and installing Action Scheduler plugin directly.
But I finally got it fixed by running a manual DB DDL (actually just alter table add column
). If you have privilege to run DDL you might try this way.
I finally success to install WP CLI and run the command for manually update ActionScheduler : and everything works !!
Hi @thomasgaillard would you mind sharing the CLI command to do the manual update? I believe it would be very helpful.
Manual creation using the sql command given on another workstation doesn't work: ALTER TABLE wp_actionscheduler_actions ADD priority TINYINT(3) UNSIGNED NOT NULL DEFAULT '10' AFTER extended_args;
Also I'm a little bit curious why the alter table
is not working for you. In my case, it solve the problem as well. Just FYI.
Helo @ULHI-xin,
I had an sql error while running the command alter table
.. and I don't know if this "Priority column" was the only one missing
So the idea was to manually update/repair with these following commands :
- Ssh connexion
- WP CLi install
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
- Fix things in database for Action Scheduler with this command
wp action-scheduler fix-schema
Have a good day
We still need to address this issue for folks who don't have WP CLI.
The backtrace in the original comment shows WooCommerce is present (which itself periodically ships schema updates). I'm curious why Action Scheduler's updates in particular aren't sticking.
zd-6568129 and 6613737
I'm still having issues after going into ssh as domain user and applying the fix.
[root@user1 /]# su user1 [user1@user1 /]$ home/user1/public_html [user1@user1 /]$ cd /home/user1/public_html [user1@user1 public_html]$ wp action-scheduler fix-schema Success: Registered schema for ActionScheduler_LoggerSchema Success: Registered schema for ActionScheduler_StoreSchema
I don't think it worked, there's no priority column in the db for wp_actionscheduler_actions. I'm only going by what I've read on here and the replies to my topic on WordPress forum. Can't enable WooCommerce and some other plugins without critical error related to action scheduler.
Unfortunately, wp action-scheduler fix-schema
will report success even if it did not manage to actually update the schemas.
My guess here is that your database user has not been granted the privileges it requires to modify existing tables. Do you have a hosting provider you can turn to for help with this, or are you self-hosting (if so, the references below might be useful)?
@barryhughes I have root access..
Usually I'd do the db and WordPress from scratch, this time Softaculous.
I checked the database user permissions. SELECT | INSERT | UPDATE | DELETE
Gave the user full permissions and ran wp action-scheduler fix-schema again.
Priority column appears in the database, WooCommerce enables without error.
Thanks a lot.
zd-6656890
zd-6600327
Related reports:
- https://github.com/woocommerce/action-scheduler/issues/958 (closed in favor of this one)
- https://github.com/woocommerce/action-scheduler/issues/856 (not identical, but has some cross-over)
zd-6693507
zd-6707173
zd-6746361
Another report: https://github.com/woocommerce/action-scheduler/issues/986
Heads up that in #1000 we have merged some more defensive error handling to ensure that if we can't update the schema, we don't bubble up that error to produce fatal errors on the site but instead log to the error log. This is a first step to handling this situation, future work might include additional strategies.
Possible instance of this in 7781794-zen - I've asked them to try the wp action-scheduler fix-schema
method but if not then maybe one of the additional contributions in this thread can help:
https://wordpress.org/support/topic/fatal-error-missing-column-priority/
The merchant in 7781794-zen shared the following as their non-CLI fix - they simply created the priority column that the site was clamouring for:
I found the solution as this:
https://wordpress.org/support/topic/fatal-error-missing-column-priority/
I ran SQL query to add priority column to wp_actionscheduler_actions table and that's it - update database looked working and the prompt to update is gone.
No fatal errors from the log.
What do you think about that approach?
Yep ... that's a perfectly reasonable approach (in fact, it is essentially what Action Scheduler tries to do, except in various cases it does not have permission).