Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unique constraint definition #11711

Open
klosto opened this issue Nov 11, 2024 · 0 comments
Open

Unique constraint definition #11711

klosto opened this issue Nov 11, 2024 · 0 comments

Comments

@klosto
Copy link

klosto commented Nov 11, 2024

Bug Report

Error in unique constraint definition

Q A
Version 2.13.0

Summary

When I tried to define unique constraint in ORM\Table() annotation, it didn't even created any setting in migration. Then I tried to define it in separated annotation like #[ORM\UniqueConstraint] and it worked.

#[ORM\Table(
    name: 'address',
    uniqueConstraints: [
        new ORM\UniqueConstraint(name: 'UNIQUE_id_public', fields: ['id_public']),              // Doesn't work
        new ORM\UniqueConstraint(name: 'UNIQUE_primary', fields: ['id', 'primary'])
    ]
)]
#[ORM\UniqueConstraint(name:'UNIQUE_id_public', fields: ['publicId'])]                          // Works

Am I doing something wrong, or is it expected behavior?

@ostrolucky ostrolucky transferred this issue from doctrine/DoctrineBundle Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant