- Affected version
- 2.1.1
On testing the XF2 upgrade process for spacebattles, I hit this error;
The column
The SQL it tries to run is;
Code:
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/xf2.spacebattles.com/html/src/XF/Db/AbstractStatement.php:217
XF\Db\AbstractStatement->getException() at /var/www/sites/xf2.spacebattles.com/html/src/XF/Db/Mysqli/Statement.php:196
XF\Db\Mysqli\Statement->getException() at /var/www/sites/xf2.spacebattles.com/html/src/XF/Db/Mysqli/Statement.php:77
XF\Db\Mysqli\Statement->execute() at /var/www/sites/xf2.spacebattles.com/html/src/XF/Db/AbstractAdapter.php:94
XF\Db\AbstractAdapter->query() at /var/www/sites/xf2.spacebattles.com/html/src/XF/Db/Schema/AbstractDdl.php:151
XF\Db\Schema\AbstractDdl->apply() at /var/www/sites/xf2.spacebattles.com/html/src/XF/Db/SchemaManager.php:149
XF\Db\SchemaManager->alterTable() at /var/www/sites/xf2.spacebattles.com/html/src/XF/Install/InstallHelperTrait.php:594
XF\Install\Upgrade\AbstractUpgrade->alterTable() at /var/www/sites/xf2.spacebattles.com/html/src/XF/Install/Upgrade/2010010-210a.php:665
XF\Install\Upgrade\Version2010010->step43() at /var/www/sites/xf2.spacebattles.com/html/src/XF/Cli/Command/Upgrade.php:134
XF\Cli\Command\Upgrade->execute() at /var/www/sites/xf2.spacebattles.com/html/src/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/sites/xf2.spacebattles.com/html/src/vendor/symfony/console/Application.php:953
Symfony\Component\Console\Application->doRunCommand() at /var/www/sites/xf2.spacebattles.com/html/src/vendor/symfony/console/Application.php:248
Symfony\Component\Console\Application->doRun() at /var/www/sites/xf2.spacebattles.com/html/src/vendor/symfony/console/Application.php:148
Symfony\Component\Console\Application->run() at /var/www/sites/xf2.spacebattles.com/html/src/XF/Cli/Runner.php:63
XF\Cli\Runner->run() at /var/www/sites/xf2.spacebattles.com/html/cmd.php:15
Code:
public function step43()
{
if (!$this->schemaManager()->columnExists('xf_user', 'like_count'))
{
// column is gone, so assume this has been run
return;
}
$this->alterTable('xf_user', function (Alter $table)
{
$table->changeColumn('like_count')->renameTo('reaction_score')->unsigned(false);
$table->dropIndexes('like_count');
$table->addKey('reaction_score');
});
}
The column
like_count
has the definition;
Code:
`like_count` int(10) unsigned NOT NULL DEFAULT 0
The SQL it tries to run is;
SQL:
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: