summaryrefslogtreecommitdiff
path: root/makima/migrations
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-02-05 00:48:38 +0000
committersoryu <soryu@soryu.co>2026-02-05 00:48:38 +0000
commit0302b4596e14210884df5d645df9a179d8f0c1c6 (patch)
tree46efe027dffa25a30e4eab87fd62de249c3075ad /makima/migrations
parente16d49b52a393aa9a762edf57f93434a4bd7844e (diff)
downloadsoryu-0302b4596e14210884df5d645df9a179d8f0c1c6.tar.gz
soryu-0302b4596e14210884df5d645df9a179d8f0c1c6.zip
Add multi-repository support for chains
Chains can now have multiple repositories attached, with one marked as primary. Repositories are used by contracts created from chain definitions. Backend changes: - Add chain_repositories table migration - Add ChainRepository model with CRUD operations - Add API endpoints for listing, adding, deleting repositories - Add endpoint to set a repository as primary - Update Chain and ChainEditorData models to use repositories - Update chain parser to support repositories in YAML format - Remove deprecated repository_url/local_path from Chain Frontend changes: - Add ChainRepository interface and API functions - Add repository section to ChainEditor showing attached repos - Add modal for adding new repositories (remote or local) - Support setting primary repository and removing repositories Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'makima/migrations')
-rw-r--r--makima/migrations/20260205000000_chain_repositories.sql27
1 files changed, 27 insertions, 0 deletions
diff --git a/makima/migrations/20260205000000_chain_repositories.sql b/makima/migrations/20260205000000_chain_repositories.sql
new file mode 100644
index 0000000..5be8cf2
--- /dev/null
+++ b/makima/migrations/20260205000000_chain_repositories.sql
@@ -0,0 +1,27 @@
+-- Chain repositories - allow chains to have multiple repositories
+-- Similar to contract_repositories but for chains
+CREATE TABLE IF NOT EXISTS chain_repositories (
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
+ chain_id UUID NOT NULL REFERENCES chains(id) ON DELETE CASCADE,
+ name VARCHAR(255) NOT NULL, -- display name / repo name
+ repository_url VARCHAR(512), -- NULL for local repos
+ local_path VARCHAR(512), -- local filesystem path (for local repos)
+ source_type VARCHAR(32) NOT NULL DEFAULT 'remote', -- remote/local/managed
+ status VARCHAR(32) NOT NULL DEFAULT 'ready', -- ready/pending/creating/failed
+ is_primary BOOLEAN NOT NULL DEFAULT false, -- primary repo for contract defaults
+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
+ updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
+);
+
+-- source_type values:
+-- 'remote' = existing remote repo (GitHub, GitLab, etc) - has repository_url
+-- 'local' = existing local repo - has local_path
+-- 'managed' = new repo created/managed by Makima daemon - gets repository_url after creation
+
+CREATE INDEX idx_chain_repositories_chain_id ON chain_repositories(chain_id);
+-- Only one primary per chain
+CREATE UNIQUE INDEX idx_chain_repositories_primary ON chain_repositories(chain_id) WHERE is_primary = true;
+
+-- Remove the old single repository fields from chains table (they're now in chain_repositories)
+ALTER TABLE chains DROP COLUMN IF EXISTS repository_url;
+ALTER TABLE chains DROP COLUMN IF EXISTS local_path;