From 3fab198c0412d09a585dac1756b1fa7b8d3fb599 Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Sun, 2 May 2021 15:48:06 +0000 Subject: [PATCH] [ENTITY] Add uniqueness constraint to Attachment::file_hash --- src/Entity/Attachment.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Entity/Attachment.php b/src/Entity/Attachment.php index 23196ce169..a6310cd740 100644 --- a/src/Entity/Attachment.php +++ b/src/Entity/Attachment.php @@ -213,18 +213,17 @@ class Attachment extends Entity return $this->height; } - public function setModified(\DateTimeInterface $modified): self + public function setModified(DateTimeInterface $modified): self { $this->modified = $modified; return $this; } - public function getModified(): \DateTimeInterface + public function getModified(): DateTimeInterface { return $this->modified; } - // }}} Autocode const URLHASH_ALGO = 'sha256'; @@ -303,7 +302,7 @@ class Attachment extends Entity ], 'primary key' => ['id'], 'unique keys' => [ - // 'file_file_key' => ['file_hash', 'actor_id'], + 'attachment_file_hash_uniq' => ['file_hash'], ], 'indexes' => [ 'file_filehash_idx' => ['file_hash'],