How to force database upgrade

How can I force phpList to (re-)run a database upgrade (idempotently)?

I recently upgraded phpList. After logging-in, I kicked-off the DB Upgrade in the WUI. Unfortunately, though it said success on the bottom of the page after it attempted an upgrade, there were actually several errors in it.

upgrade to UTF-8, done
Database error 1142 while doing query ALTER command denied to user 'phplist_user'@'localhost' for table `phplist_db`.`phplist_user_user_attribute`
Database error 1142 while doing query ALTER command denied to user 'phplist_user'@'localhost' for table `phplist_db`.`phplist_message`
Database error 1142 while doing query ALTER command denied to user 'phplist_user'@'localhost' for table `phplist_db`.`phplist_message`
Database error 1142 while doing query ALTER command denied to user 'phplist_user'@'localhost' for table `phplist_db`.`phplist_messagedata`
Giving a UUID to your subscribers and campaigns. If you have a lot of them, this may take a while. If the page times out, you can reload. Or otherwise try to run the upgrade from commandline instead. More information
Database error 1142 while doing query ALTER command denied to user 'phplist_user'@'localhost' for table `phplist_db`.`phplist_message`
Database error 1142 while doing query ALTER command denied to user 'phplist_user'@'localhost' for table `phplist_db`.`phplist_message`
Database error 1142 while doing query ALTER command denied to user 'phplist_user'@'localhost' for table `phplist_db`.`phplist_template`
Database error 1054 while doing query Unknown column 'template_text' in 'field list'
Database error 1142 while doing query ALTER command denied to user 'phplist_user'@'localhost' for table `phplist_db`.`phplist_admin`
Database error 1142 while doing query ALTER command denied to user 'phplist_user'@'localhost' for table `phplist_db`.`phplist_urlcache`

After adjusting the DB user’s permissions, I tried to revisit the upgrade page in the WUI via System → Upgrade phpList Database (/lists/admin/?page=upgrade), I saw no Upgrade button and instead phpList said

Your database version: 3.6.13
Your database is already the correct version, there is no need to upgrade 

As I saw no method to force the upgrade again, I tried from the CLI

$ /usr/bin/php /var/www/html/phplist/public_html/lists/admin/index.php -c /var/www/html/phplist/config.php -pupgrade"
starting admin/index.php
phpList - phpList version 3.6.13 (c) 2000-2023 phpList Ltd, https://www.phplist.com

Your database version: 3.6.13
Your database is already the correct version, there is no need to upgrade
$

Unfortunately the CLI said the same thing.

How can I force phpList to re-run the (idempotent?) DB upgrade?

@maltfield You can try forcing an upgrade by adding &force to the URL of the upgrade page or adding -f to the command line.

1 Like

That worked perfect, thanks!

It might be a good idea to adjust the command-line output from

Your database is already the correct version, there is no need to upgrade

to

Your database is already the correct version, there is no need to upgrade

You can force an upgrade with -f