<?php

use yii\db\Migration;

class m160516_095943_init extends Migration
{
    public function up()
    {
        $tableOptions = null;

        if ($this->db->driverName === 'mysql') {
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
        }

        $this->createTable('{{%Cart}}', [
            'sessionId' => $this->string(),
            'cartData' => $this->text(),
            'PRIMARY KEY (`sessionId`)'
        ], $tableOptions);
    }

    public function down()
    {
        $this->dropTable('{{%Cart}}');
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}

<?php

use yii\db\Migration;

class m160516_095943_init extends Migration
{
    public function up()
    {
        $tableOptions = null;

        if ($this->db->driverName === 'mysql' || $this->db->driverName === 'mariadb') {
            
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
            
            $this->createTable('{{%Cart}}', [
            'sessionId' => $this->string(),
            'cartData' => 'longtext',
            'PRIMARY KEY (`sessionId`)'
            ], $tableOptions);
            
        }else{
            
            $this->createTable('{{%Cart}}', [
            'sessionId' => $this->string(),
            'cartData' => $this->text(),
            'PRIMARY KEY (`sessionId`)'
            ], $tableOptions);
        }

        
    }

    public function down()
    {
        $this->dropTable('{{%Cart}}');
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}

Use longtext instead of text in mysql and mariadb
Use longtext instead of text in mysql and mariadb

Text is too short for some objects .. so this pull request is a proposal to use longtext instead of text in mysql and mariadb