XF 2.0 Length-limited MYSQL request?

TrayHard

New member
Hello! I have an issue here. Here is my code for Setup.php:

PHP:
<?php

namespace Tray\League;

use XF\AddOn\AbstractSetup;
use XF\Db\Schema\Alter;
use XF\Db\Schema\Create;

class Setup extends AbstractSetup
{
    use \XF\AddOn\StepRunnerInstallTrait;
    use \XF\AddOn\StepRunnerUninstallTrait;
    use \XF\AddOn\StepRunnerUpgradeTrait;
 
    public function installStep1()
    {
        $this->schemaManager()->createTable('tray_league_matches', function(Create $table)
        {
            $table->addColumn('match_id', 'int');
            $table->addPrimaryKey('match_id');
            $table->addColumn('match_type', 'string');
            $table->addColumn('opp1_id', 'int');
            $table->addColumn('opp2_id', 'int');
        });
    }
}

So when I try to exec it through this line:
php cmd.php xf-addon:install-step Tray/League 1

I got such error:
error.webp

It ends on 'INT UNSIGNED NOT N...' like the string was trimmed to such state, like there is some limit for it. If it's correct - how can I avoid such limit and resolve this issue? If it's not about limits - what is the problem then?

Environment: Debian 9, lighttpd, php7.0-fpm, XenForo 2.0.7
 
The cutoff is done by the mysql error handler to not show too much query when showing an error.

The error in this case seems to be the col type string that is no valid mysql type. varchar or text it should be. 😊
 
Last edited:
The cutoff is done by the mysql error handler to not show too much query when showing an error.

The error in this case seems to be the col type string that is no valid mysql type. varchar or text it should be. 😊
Oh, thanks a lot! And could you please let me know, how to make varchar row properly? Since I have such error:

Jh48YzM.png


With such code:
PHP:
public function installStep2()
    {
        $this->schemaManager()->alterTable('tray_league_matches', function(Alter $table)
        {
            $table->addColumn(`match_type`, 'varchar');
            $table->addColumn('opp1_id', 'int');
            $table->addColumn('opp2_id', 'int');
        });
    }

UPD: Okay, just enough to determine its length after comma:
$table->addColumn('match_type', 'varchar', 255);

But still I have a question:
Could you tell me please, where can I find full documentation for all such functions and supported types? I haven't found it in Manual here
 
Last edited:
Top Bottom