From c7f078361541047775a56997fd749c064715e311 Mon Sep 17 00:00:00 2001
From: Fabio Manganiello <blacklight86@gmail.com>
Date: Sun, 17 Feb 2019 17:17:20 +0100
Subject: [PATCH] Unique constraint on MediaFile.path

---
 platypush/plugins/media/local.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platypush/plugins/media/local.py b/platypush/plugins/media/local.py
index 3756aeab..a74ab3c0 100644
--- a/platypush/plugins/media/local.py
+++ b/platypush/plugins/media/local.py
@@ -254,7 +254,7 @@ class MediaFile(Base):
     id = Column(Integer, primary_key=True)
     directory_id = Column(Integer, ForeignKey(
         'MediaDirectory.id', ondelete='CASCADE'), nullable=False)
-    path = Column(String, nullable=False)
+    path = Column(String, nullable=False, unique=True)
     indexed_at = Column(DateTime)
 
     @classmethod