Set up or migrate GitChain schema on Supabase PostgreSQL
From gitchain-supabasenpx claudepluginhub c-0711/0711-tools --plugin gitchain-supabaseThis skill uses the workspace's default tool permissions.
Create or migrate the GitChain database schema on a Supabase PostgreSQL instance.
$ARGUMENTS for action:
init — Create full schema from scratchmigrate — Apply incremental migrationstatus — Show current schema version-- Core containers table
CREATE TABLE containers (
id TEXT PRIMARY KEY,
namespace TEXT NOT NULL,
identifier TEXT NOT NULL,
type TEXT NOT NULL DEFAULT 'product',
version INTEGER NOT NULL DEFAULT 1,
data JSONB NOT NULL,
hash TEXT NOT NULL,
message TEXT,
visibility TEXT DEFAULT 'public',
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW(),
UNIQUE(namespace, identifier, version)
);
-- Full-text search
CREATE INDEX idx_containers_search ON containers
USING GIN (to_tsvector('english', data::text));
CREATE INDEX idx_containers_namespace ON containers(namespace);
CREATE INDEX idx_containers_type ON containers(type);
-- Agent contexts
CREATE TABLE agent_contexts (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
container_id TEXT REFERENCES containers(id),
agent_id TEXT NOT NULL,
project TEXT,
summary TEXT,
decisions JSONB,
tasks JSONB,
learnings JSONB,
tags TEXT[],
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- Row Level Security
ALTER TABLE containers ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Public read" ON containers FOR SELECT USING (visibility = 'public');
CREATE POLICY "Auth write" ON containers FOR INSERT WITH CHECK (auth.role() = 'authenticated');
# Supabase Migration: [action]
## Applied
| Migration | Tables | Indexes | Policies |
|-----------|--------|---------|----------|
| init_v1 | 2 | 3 | 2 |
## Schema Status
- Tables: containers, agent_contexts
- Containers: [count]
- RLS: ✅ enabled
- Version: [X]