diff options
| author | soryu <soryu@soryu.co> | 2026-02-05 01:55:49 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-02-05 01:55:49 +0000 |
| commit | 41897cc090bdeacca881ecd75cc19c4e0926fd58 (patch) | |
| tree | d9741af2b5686f39c7c3e2ba9fb551052f78657d /makima/migrations/20260205000001_chain_repositories.sql | |
| parent | 6a0c912a3fbd8e9b3e87ef40e960803d819d966d (diff) | |
| download | soryu-41897cc090bdeacca881ecd75cc19c4e0926fd58.tar.gz soryu-41897cc090bdeacca881ecd75cc19c4e0926fd58.zip | |
Fixup: overlapping migration timestamps
Diffstat (limited to 'makima/migrations/20260205000001_chain_repositories.sql')
| -rw-r--r-- | makima/migrations/20260205000001_chain_repositories.sql | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/makima/migrations/20260205000001_chain_repositories.sql b/makima/migrations/20260205000001_chain_repositories.sql new file mode 100644 index 0000000..5be8cf2 --- /dev/null +++ b/makima/migrations/20260205000001_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; |
