Skip to content

Unique constraint definition #11711

Open
Open
@klosto

Description

@klosto

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?

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