Vijay Gupta
Vijay Gupta

Reputation: 95

Tinytext issue on Upgrade magento to 2.3.0

In Magento my website 's current version is magento 2.2.5 . Now i have updated it to latest version magento 2.3.0 . But there i am getting error when i run

php bin/magento setup:upgrade

I got this error

Cannot process definition to array for type tinytext

Please suggest me solution. Thank You

Upvotes: 3

Views: 4617

Answers (4)

Nangyial Ahmad
Nangyial Ahmad

Reputation: 116

Open file

/vendor/magento/framework/Setup/Declaration/Schema/Db/DefinitionAggregator.php

Replace function fromDefinition: With:

public function fromDefinition(array $data)
{

$type = $data['type'];

if(in_array($type, ["tinytext", "enum"])){
    $data['type'] = 'text';
    $type = 'text';
}

if(in_array($type, ['time', 'mediumint'])){
    $data['type'] = 'datetime';
    $type = 'datetime';
}

if(in_array($type, ['mediumint'])){
    $data['type'] = 'int';
    $type = 'int';
}

if (!isset($this->definitionProcessors[$type])) {
    throw new \InvalidArgumentException(
        sprintf("Cannot process definition to array for type %s", $type)
    );
}

$definitionProcessor = $this->definitionProcessors[$type];
return $definitionProcessor->fromDefinition($data);
}   

Upvotes: 2

Aasim Goriya
Aasim Goriya

Reputation: 184

You are getting this error because "data type" of any third party extension's table's column is tinytext.

So you need to find out column name using debug in following file.

Open this file /vendor/magento/framework/Setup/Declaration/Schema/Db/DefinitionAggregator.php and check this fromDefinition() method and then add debug code to find column name.

public function fromDefinition(array $data)
    {
        $type = $data['type'];
        if (!isset($this->definitionProcessors[$type])) {

            /* Add Code for Debug */

            echo "<pre>";
            print_r($data); exit();

            /* Code End */

            throw new \InvalidArgumentException(
                sprintf("Cannot process definition to array for type %s", $type)
            );
        }

        $definitionProcessor = $this->definitionProcessors[$type];
        return $definitionProcessor->fromDefinition($data);
    }

After that please run setup:upgrade command and you will get array of column data in console. so from this array you will get name of column from your third party extension table.

Now from that table please change column's data type "tinytext" to "text" and issue will be fixed.

Note : You might also get issues from ENUM and MEDIUMINT data type as well, so do the same steps if get any other data type issue.

Upvotes: 7

user72833
user72833

Reputation: 11

Yes it is because of some extensions.I just exported the database and search for keywords tinytext , found a table which use this format, I changed it to TEXT and the problem solved.

Upvotes: 1

Javier
Javier

Reputation: 39

You might want to check your extensions. I debugged this error for myself and it originated from an extension which was included with a theme purchased, but not updated.

Upvotes: 0

Related Questions