Duplicate Error upgrading to 2.0.4 from 1.1.6

Jake B.

Well-known member
Affected version
2.0.4
XF\Db\InvalidQueryException: MySQL statement prepare error [1101]: BLOB, TEXT, GEOMETRY or JSON column 'view_user_groups' can't have a default value in src/XF/Db/AbstractStatement.php at line 212
  1. XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 196
  2. XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 39
  3. XF\Db\Mysqli\Statement->prepare() in src/XF/Db/Mysqli/Statement.php at line 54
  4. XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 79
  5. XF\Db\AbstractAdapter->query() in src/XF/Db/Schema/AbstractDdl.php at line 151
  6. XF\Db\Schema\AbstractDdl->apply() in src/XF/Db/SchemaManager.php at line 143
  7. XF\Db\SchemaManager->alterTable() in src/addons/XFMG/Setup.php at line 644
  8. XFMG\Setup->upgrade902000010Step3() in src/XF/AddOn/StepRunnerUpgradeTrait.php at line 122
  9. XFMG\Setup->upgradeStepRunner() in src/XF/AddOn/StepRunnerUpgradeTrait.php at line 71
  10. XFMG\Setup->upgrade() in src/XF/Admin/Controller/AddOn.php at line 449
  11. XF\Admin\Controller\AddOn->actionUpgrade() in src/XF/Mvc/Dispatcher.php at line 249
  12. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 88
  13. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 41
  14. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1894
  15. XF\App->run() in src/XF.php at line 328
  16. XF::runApp() in admin.php at line 13

Seems to be coming from this portion:
PHP:
if (!$sm->columnExists('view_user_groups', 'xf_mg_category'))
{
   $sm->alterTable('xf_mg_category', function(Alter $table)
   {
      $table->addColumn('view_user_groups', 'blob')->setDefault('a:1:{i:0;i:-1;}')->after('category_description');
   });
}

AFAIK blob fields cannot be assigned a default value, and removing that default value seems to resolve the issue
 
Back
Top Bottom