summaryrefslogtreecommitdiff
path: root/makima/migrations/20250113000000_add_repo_file_path.sql
diff options
context:
space:
mode:
Diffstat (limited to 'makima/migrations/20250113000000_add_repo_file_path.sql')
-rw-r--r--makima/migrations/20250113000000_add_repo_file_path.sql15
1 files changed, 15 insertions, 0 deletions
diff --git a/makima/migrations/20250113000000_add_repo_file_path.sql b/makima/migrations/20250113000000_add_repo_file_path.sql
new file mode 100644
index 0000000..eb7cec2
--- /dev/null
+++ b/makima/migrations/20250113000000_add_repo_file_path.sql
@@ -0,0 +1,15 @@
+-- Add repository file path linking to files
+-- Files can now be linked to specific file paths in repositories
+
+ALTER TABLE files ADD COLUMN repo_file_path VARCHAR(500) NULL;
+ALTER TABLE files ADD COLUMN repo_synced_at TIMESTAMPTZ NULL;
+ALTER TABLE files ADD COLUMN repo_sync_status VARCHAR(50) DEFAULT 'none';
+-- Status: 'none' (not linked), 'synced' (up to date), 'modified' (local changes), 'conflict'
+
+-- Index for efficient lookup of files by repo path within a contract
+CREATE INDEX idx_files_repo_file_path ON files(contract_id, repo_file_path)
+WHERE repo_file_path IS NOT NULL;
+
+COMMENT ON COLUMN files.repo_file_path IS 'Path to the file in the repository (e.g., README.md, docs/design.md)';
+COMMENT ON COLUMN files.repo_synced_at IS 'When the file was last synced from the repository';
+COMMENT ON COLUMN files.repo_sync_status IS 'Sync status: none, synced, modified, conflict';