Add unique constraints to prevent person_documnt and accompanyingcourse_document with duplicated object_id

This change ensures `object_id` uniqueness within `person_document` and `accompanyingcourse_document` tables. It includes migration scripts and entity annotations to enforce these constraints. This helps maintain data integrity and consistency across the database.
This commit is contained in:
2024-11-19 10:50:46 +01:00
parent 9a44cf060f
commit 4be6c09d4d
4 changed files with 44 additions and 0 deletions

View File

@@ -40,6 +40,7 @@ class Document implements TrackCreationInterface, TrackUpdateInterface
#[Assert\Valid]
#[Assert\NotNull(message: 'Upload a document')]
#[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
#[ORM\JoinColumn(name: 'object_id', referencedColumnName: 'id')]
private ?StoredObject $object = null;
#[ORM\ManyToOne(targetEntity: DocGeneratorTemplate::class)]