• Resolved De Belser Arne

    (@arnedb)


    Hello there,

    When trying to migrate a website I came across the following error which caused the migration to fail:

    error while creating the table wp_aelia_exchange_rates_history. The key was too long. MAX key length is 767 bytes

    I came to think that this is something caused by this plugin, do you have any idea how I can update the database schema to allow for more key length?

    Kind Regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Diego

    (@daigo75)

    That message could be due to the fact that the MySQL database uses the utf8mb4 encoding, which needs 4 bytes per character. The key for table aelia_exchange_rates_history uses field provider_name, which is 200 characters long. The utf8mb4 encoding would need 800 bytes, which are too many.

    To check if this is correct, you can try the following:
    1. Open file woocommerce-eu-vat-assistant/src/lib/classes/install/aelia-wc-eu-vat-assistant-install.php.
    2. At line ~152, change provider_name varchar(200) NOT NULL to `provider_name varchar(180) NOT NULL.
    3. Save the file.
    4. Try to repeat the installation.

    If my hypothesis is correct, the installation should now succeed. In that case, I will ask to release a patch to reduce the size of the column. After all, 180 characters for the name of an exchange rates provider should more than enough.

    Plugin Author Diego

    (@daigo75)

    @arnedb I can confirm that the issue was due to the size of the provider_name column. In MySQL 5.6 and earlier, using the InnoDB engine, an index can have a maximum size of 767 bytes. A column of 200 characters, using 4 bytes per character, would use 800 bytes, and it would be too large. This issue doesn’t occur in MySQL 5.7 and alternative databases (MariaDB, Percona), as they can handle a larger index.

    We have reduced the size of the provider_name column in EU VAT Assistant 1.9.12.190516. That should be sufficient to solve the issue.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Problem while migrating site’ is closed to new replies.