Skip to content

MySQL 8.4: 6125 (HY000) at line 1197: Failed to add the foreign key constraint. Missing unique key for constraint #1052

@finpension-aless

Description

@finpension-aless

With the newest image available on DockerHub (mysql:8) we run into an issue when we run our migration scripts for our tests.

We get the error "ERROR 6125 (HY000) at line 1197: Failed to add the foreign key constraint. Missing unique key for constraint 'tbl_temp_transactions_currency_foreign' in the referenced table 'tbl_currencies'"

image

image

When using the docker image mysql:8.3 this error does not happen. We didn't change any MySQL configuration ourselves.

Adding an unique-key on 'to_currency' is not possible for us, since it's not a unique column. According to the MySQL documentation that shouldn't be an issue though since we use InnoDB which allows it. I also tried to add a simple index on 'to_currency' but it didn't help.

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