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?
Bug Report
Error in unique constraint definition
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.Am I doing something wrong, or is it expected behavior?