myparcelnl / prestashop

PrestaShop module to integrate with MyParcel NL and BE
https://developer.myparcel.nl/nl/documentatie/11.prestashop.html
10 stars 5 forks source link

Error 'Unknown column type "tinyint" requested' while upgrading PrestaShop #221

Closed arisschl closed 9 months ago

arisschl commented 1 year ago

Module version

1.8.2

PrestaShop version

1.7.8.8

PHP version

7.4

What went wrong?

Updating PrestaShop to version 1.7.8.9 fails due to an error while updating the database schema.

The error says:

Error thrown while running command "prestashop:schema:update-without-foreign --env=prod". Message: "Unknown column type "tinyint" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType().

This is because the Doctrine entity definition contains an invalid column type in /src/Entity/MyparcelOrderLabel.php:

/**
     * @var int
     *
     * @ORM\Column(name="is_return", type="tinyint")
     */
    private $isReturn;

The correct type here would be "boolean", which is mapped to a TINYINT with a length of 1 (in a MySql database).

Reproduction steps

Use the PrestaShop 1-Click upgrade module to upgrade PrestaShop and to reproduce the error, or trigger the schema update manually using the console: bin/console prestashop:schema:update-without-foreign --env=prod

Relevant log output

2023-05-16 16:52:22] Updating database schema...
[2023-05-16 16:52:22] 16:52:20 ERROR     [console] Error thrown while running command "prestashop:schema:update-without-foreign --env=prod". Message: "Unknown column type "tinyint" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database introspection then you might have forgotten to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information."
[2023-05-16 16:52:22] Error during database upgrade. You may need to restore your database.
[2023-05-16 16:52:22] Error upgrading Doctrine schema

Additional context

No response

EdieLemoine commented 9 months ago

This bug does not occur anymore in v2.0.0-beta.1.

Please read this issue for more information and how to report bugs in the new version.