Magento 2.x – Cannot process definition to array for type tinytext

I faced issue while setup:upgrade in magento 2 instance. I fixed this issue in three steps as below.

Step 1: I open this file : /vendor/magento/framework/Setup/Declaration/Schema/Db/DefinitionAggregator.php

Find this function and replace code:

   public function fromDefinition(array $data)
    {
        $type = $data['type'];
        if (!isset($this->definitionProcessors[$type])) {
            echo "<pre>"; print_r($data); exit();
            throw new \InvalidArgumentException(
                sprintf("Cannot process definition to array for type %s", $type)
            );
        }
        $definitionProcessor = $this->definitionProcessors[$type];
        return $definitionProcessor->fromDefinition($data);
    }

Step 2 : Run setup upgrade and you will find out column name and it’s details. Now login in to mysql console and replace invoiceNumber by column which we found in last step. You will get all table information.

SELECT table_name, column_name from information_schema.columns WHERE column_name LIKE '%invoiceNumber%';

Step 3: Now update that column using below command. Run again setup:upgrade

ALTER TABLE TableName MODIFY InvoiceNumber VARCHAR(250);

1 thought on “Magento 2.x – Cannot process definition to array for type tinytext”

Leave a Reply

%d bloggers like this: