From c24e3c18e0177e2e059f622a63e87249c52db2d5 Mon Sep 17 00:00:00 2001
From: Kujtim Hoxha <kujtimii.h@gmail.com>
Date: Thu, 17 Apr 2025 13:45:26 +0200
Subject: small improvements

---
 internal/db/migrations/000001_initial.up.sql | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'internal/db/migrations/000001_initial.up.sql')

diff --git a/internal/db/migrations/000001_initial.up.sql b/internal/db/migrations/000001_initial.up.sql
index 4ac297dc5..b846ec600 100644
--- a/internal/db/migrations/000001_initial.up.sql
+++ b/internal/db/migrations/000001_initial.up.sql
@@ -27,7 +27,8 @@ CREATE TABLE IF NOT EXISTS files (
     version TEXT NOT NULL,
     created_at INTEGER NOT NULL,  -- Unix timestamp in milliseconds
     updated_at INTEGER NOT NULL,  -- Unix timestamp in milliseconds
-    FOREIGN KEY (session_id) REFERENCES sessions (id) ON DELETE CASCADE
+    FOREIGN KEY (session_id) REFERENCES sessions (id) ON DELETE CASCADE,
+    UNIQUE(path, session_id, version)
 );
 
 CREATE INDEX IF NOT EXISTS idx_files_session_id ON files (session_id);
-- 
cgit v1.2.3

