Skip to content

Syntax error or access violation: 1059 Identifier name '...' is too long #965

@loevgaard

Description

@loevgaard

Sylius version affected: 1.*

Description
The maximum length of identifiers in mysql is 64 (https://dev.mysql.com/doc/refman/8.4/en/identifier-length.html). Inside the https://github.com/Sylius/SyliusResourceBundle/blob/1.13/src/Bundle/EventListener/ORMTranslatableListener.php, a unique constraint is created:

$constraints[$metadata->getTableName() . '_uniq_trans'] = [
    'columns' => $columns,
];

This adds 11 characters to the table name and uses that as the unique constraint.

Steps to reproduce
Create a translatable resource with a long table name (54+ characters)

Possible Solution
Use random index names like Doctrine does out of the box or just shorten the constraint name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions