• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed Duplicate key media_date when upgrading from versions prior to XFMG 1.1.12


Active member
XF\Db\Exception: MySQL query error [1061]: Duplicate key name 'media_date' in src/XF/Db/AbstractStatement.php at line 183
XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 66
XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 67
XF\Db\AbstractAdapter->query() in src/XF/Db/Schema/AbstractDdl.php at line 137
XF\Db\Schema\AbstractDdl->apply() in src/XF/Db/SchemaManager.php at line 128
XF\Db\SchemaManager->alterTable() in src/addons/XFMG/Setup.php at line 608
XFMG\Setup->upgrade901011270Step1() in src/XF/AddOn/StepRunnerUpgradeTrait.php at line 143
XFMG\Setup->upgradeStepRunner() in src/XF/AddOn/StepRunnerUpgradeTrait.php at line 79
XFMG\Setup->upgrade() in src/XF/Admin/Controller/AddOn.php at line 424
XF\Admin\Controller\AddOn->actionUpgrade() in src/XF/Mvc/Dispatcher.php at line 232
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 85
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 41
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1771
XF\App->run() in src/XF.php at line 319
XF::runApp() in admin.php at line 13

Chris D

XenForo developer
Staff member
That does appear to be a genuine bug which we're just looking into.

If you haven't cancelled the entire process and you're able to just refresh the page then run this query first:
ALTER TABLE xengallery_media DROP INDEX media_date
That should continue where it left off.

If that doesn't work and you're now in a situation where it's talking about missing tables and things then the recommendation now is that you'll likely need to restore your test install back to its original XF 1.5 state by restoring your backup and start the process again. Before you start the upgrade again make sure the above query is run and it should all run through smoothly.