MG 2.1 MySQL statement prepare error [1054]: Unknown column 'like_users' in 'where clause' src/XF/Db/AbstractStatement.php:217

KSA

Well-known member
Trying to upgrade to the latest release and I get this error.

  • MySQL statement prepare error [1054]: Unknown column 'like_users' in 'where clause'
  • src/XF/Db/AbstractStatement.php:217
UPDATE xf_mg_comment SET like_users = ? WHERE like_users = ?
------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL statement...', 1054, '42S22')
#1 src/XF/Db/Mysqli/Statement.php(39): XF\Db\Mysqli\Statement->getException('MySQL statement...', 1054, '42S22')
#2 src/XF/Db/Mysqli/Statement.php(54): XF\Db\Mysqli\Statement->prepare()
#3 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#4 src/XF/Db/AbstractAdapter.php(326): XF\Db\AbstractAdapter->query('UPDATE `xf_mg_...', Array)
#5 src/XF/Install/InstallHelperTrait.php(85): XF\Db\AbstractAdapter->update('xf_mg_comment', Array, 'like_users = ?', Array)
#6 src/XF/Install/InstallHelperTrait.php(43): XF\AddOn\AbstractSetup->tableColumnsToJson('xf_mg_comment', Array, Array, 0, Array, false, '^([abCdioOsS]:|...', 1000)
#7 src/addons/XFMG/Setup.php(2426): XF\AddOn\AbstractSetup->entityColumnsToJson('XFMG:Comment', Array, 0, Array)
#8 src/XF/AddOn/StepRunnerUpgradeTrait.php(122): XFMG\Setup->upgrade902010010Step3(Array)
#9 src/XF/AddOn/StepRunnerUpgradeTrait.php(71): XFMG\Setup->upgradeStepRunner(902010010, 3, Array, NULL)
#10 src/XF/Job/AddOnInstallBatch.php(293): XFMG\Setup->upgrade(Array)
#11 src/XF/Job/AddOnInstallBatch.php(86): XF\Job\AddOnInstallBatch->stepAction(Object(XF\Timer))
#12 src/XF/Job/Manager.php(253): XF\Job\AddOnInstallBatch->run(G)
#13 src/XF/Job/Manager.php(195): XF\Job\Manager->runJobInternal(Array, G)
#14 src/XF/Job/Manager.php(111): XF\Job\Manager->runJobEntry(Array, G)
#15 src/XF/Admin/Controller/Tools.php(120): XF\Job\Manager->runByIds(Array, 8)
#16 src/XF/Mvc/Dispatcher.php(321): XF\Admin\Controller\Tools->actionRunJob(Object(XF\Mvc\ParameterBag))
#17 src/XF/Mvc/Dispatcher.php(248): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'RunJob', Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Tools), NULL)
#18 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Tools), NULL)
#19 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#20 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()
#21 src/XF.php(390): XF\App->run()
#22 admin.php(13): XF::runApp('XF\\Admin\\App')
#23 {main}
 
The upgrade is not completed.

Here what it says

One or more add-ons currently have actions pending and may be in an inconsistent state. Because of this, some errors may be suppressed and unexpected behavior may occur. If this does not change shortly, please contact the add-on author for guidance.
 
The error suggests that either this upgrade step has been run before or something went wrong before this and it attempted to re-do work it had already done, or an add-on has interfered somehow with the data in the past and the expected columns are now missing.

You can try re-adding that missing column:
SQL:
ALTER TABLE xf_mg_comment ADD COLUMN like_users BLOB DEFAULT NULL
And then re-running the upgrade. You may run into other issues though.

If you do, you probably need to submit a ticket from your customer area with PhpMyAdmin access (or similar) and an Admin CP login so we can take a closer look.
 
The error suggests that either this upgrade step has been run before or something went wrong before this and it attempted to re-do work it had already done, or an add-on has interfered somehow with the data in the past and the expected columns are now missing.

You can try re-adding that missing column:
SQL:
ALTER TABLE xf_mg_comment ADD COLUMN like_users BLOB DEFAULT NULL
And then re-running the upgrade. You may run into other issues though.

If you do, you probably need to submit a ticket from your customer area with PhpMyAdmin access (or similar) and an Admin CP login so we can take a closer look.

Just attempted to do that and ran the upgrade again, still same issue.

Should delete XFMG running below sql be possible and try to run the upgrade again?

SQL:
SELECT addon_id
FROM xf_addon
WHERE is_processing = 1
 
Just attempted to do that and ran the upgrade again, still same issue.
Actually, it was a different issue. It was the same error message, but the stack trace was subtly different.

I've applied a similar change to the xf_mg_media_item table now and it looks like the upgrade has completed.
 
  • Like
Reactions: KSA
Top Bottom