mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-20 04:02:50 +00:00
Enforce filename uniqueness in StoredObjectVersion
with partial unique index...
This commit is contained in:
@@ -23,10 +23,14 @@ use Random\RandomException;
|
||||
* Store each version of StoredObject's.
|
||||
*
|
||||
* A version should not be created manually: use the method @see{StoredObject::registerVersion} instead.
|
||||
*
|
||||
* Each filename must be unique within the same StoredObject. We add a condition on id to apply this condition only for
|
||||
* newly created versions when this new index is applied.
|
||||
*/
|
||||
#[ORM\Entity]
|
||||
#[ORM\Table('chill_doc.stored_object_version')]
|
||||
#[ORM\UniqueConstraint(name: 'chill_doc_stored_object_version_unique_by_object', columns: ['stored_object_id', 'version'])]
|
||||
#[ORM\UniqueConstraint(name: 'chill_doc_stored_object_version_unique_by_filename', columns: ['filename'], options: ['where' => '(id > 0)'])]
|
||||
class StoredObjectVersion implements TrackCreationInterface
|
||||
{
|
||||
use TrackCreationTrait;
|
||||
|
Reference in New Issue
Block a user