Fixed XF2.1 upgrade error


Well-known member
Affected version
On testing the XF2 upgrade process for spacebattles, I hit this error;
Running upgrade to 2.1.0 Alpha, step 43...
In AbstractStatement.php line 217:

  [XF\Db\Exception (1264)]
  xf_user: MySQL query error [1264]: Out of range value for column 'reaction_score' at row 99

Exception trace:
() at /var/www/sites/
XF\Db\AbstractStatement->getException() at /var/www/sites/
XF\Db\Mysqli\Statement->getException() at /var/www/sites/
XF\Db\Mysqli\Statement->execute() at /var/www/sites/
XF\Db\AbstractAdapter->query() at /var/www/sites/
XF\Db\Schema\AbstractDdl->apply() at /var/www/sites/
XF\Db\SchemaManager->alterTable() at /var/www/sites/
XF\Install\Upgrade\AbstractUpgrade->alterTable() at /var/www/sites/
XF\Install\Upgrade\Version2010010->step43() at /var/www/sites/
XF\Cli\Command\Upgrade->execute() at /var/www/sites/
Symfony\Component\Console\Command\Command->run() at /var/www/sites/
Symfony\Component\Console\Application->doRunCommand() at /var/www/sites/
Symfony\Component\Console\Application->doRun() at /var/www/sites/
Symfony\Component\Console\Application->run() at /var/www/sites/
XF\Cli\Runner->run() at /var/www/sites/

public function step43()
   if (!$this->schemaManager()->columnExists('xf_user', 'like_count'))
      // column is gone, so assume this has been run

   $this->alterTable('xf_user', function (Alter $table)

The column like_count has the definition;
`like_count` int(10) unsigned NOT NULL DEFAULT 0

The SQL it tries to run is;
ALTER TABLE `xf_user`
CHANGE COLUMN `like_count` `reaction_score` INT NOT NULL DEFAULT '0',
DROP INDEX `like_count`,
ADD KEY `reaction_score` (`reaction_score`)
Last edited:


Well-known member
I see the issue, someone was smart and modified a user record (cia admincp) with +3 billion likes (specifically to π, with a bunch digits), meaning changing from an unsigned to a signed integer error'ed.
Last edited:

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.2).

Change log:
Prevent an out of range MySQL error when upgrading to XF 2.1.
Any changes made as a result of this issue being resolved may not be rolled out here until later.