Fixed Upgrading Media Gallery

Kirux

Member
After uploading the upgrade files and going into admin panel to upgrade, I get these errors after clicking upgrade in the add on sections. How do I fix this? I have tried reloading upgrade files several times. I was also upgrading Xenforo from 1.2 to 2.04 if that has anything to do with these errors. Appreciate any help.

Code:
InvalidArgumentException: Column definition 'media_privacy' does not exist therefore it cannot be changed. in src/XF/Db/Schema/Column.php at line 414
XF\Db\Schema\Column->getDefinition() in src/XF/Db/Schema/Alter.php at line 230
XF\Db\Schema\Alter->getQueries() in src/XF/Db/Schema/AbstractDdl.php at line 147
XF\Db\Schema\AbstractDdl->apply() in src/XF/Db/SchemaManager.php at line 143
XF\Db\SchemaManager->alterTable() in src/addons/XFMG/Setup.php at line 146
XFMG\Setup->upgrade2000070Step3() in src/XF/AddOn/StepRunnerUpgradeTrait.php at line 122
XFMG\Setup->upgradeStepRunner() in src/XF/AddOn/StepRunnerUpgradeTrait.php at line 71
XFMG\Setup->upgrade() in src/XF/Admin/Controller/AddOn.php at line 449
XF\Admin\Controller\AddOn->actionUpgrade() in src/XF/Mvc/Dispatcher.php at line 249
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 89
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 41
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1891
XF\App->run() in src/XF.php at line 328
XF::runApp() in admin.php at line 13
 
I can confirm a bug in the installer.

To get past it, the following lines need changing inside src/addons/XFMG/Setup.php:

This line:
PHP:
$table->addColumn('media_privacy', 'enum')->values(['private', 'public', 'shared', 'members', 'followers'])->setDefault('public')->after('album_id');

Needs changing to:
PHP:
$table->addColumn('media_privacy', 'enum')->values(['private', 'public', 'shared', 'members', 'followed', 'category'])->setDefault('public')->after('album_id');

This line:
PHP:
$table->changeColumn('media_privacy')->values(['private', 'public', 'shared', 'members', 'followed', 'category']);
Needs to just be removed entirely.

The slightly ironic thing is, that this part of the setup adds that field, and is later dropped entirely, because we don't use it anymore :)
 
Back
Top Bottom