Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions src/db/migrations/0000_base_schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
-- Base Schema
-- Creates the initial tables needed before the incremental migration chain (0001+).
-- This migration is only applied to fresh databases.

BEGIN;

-- Projects (original schema before 0001)
CREATE TABLE IF NOT EXISTS "projects" (
"id" text PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"repo" text NOT NULL,
"base_branch" text,
"branch_prefix" text,
"model" text,
"card_budget_usd" numeric(10, 2),
"agent_backend_default" text,
"github_token_env" text,
"reviewer_token_env" text,
"trello_board_id" text,
"trello_lists" jsonb,
"trello_labels" jsonb,
"trello_custom_fields" jsonb,
"triggers" jsonb,
"agent_models" jsonb,
"agent_backend_overrides" jsonb,
"prompts" jsonb,
"created_at" timestamp DEFAULT now(),
"updated_at" timestamp DEFAULT now()
);

CREATE UNIQUE INDEX IF NOT EXISTS "idx_projects_repo" ON "projects" ("repo");
CREATE INDEX IF NOT EXISTS "idx_projects_trello_board_id" ON "projects" ("trello_board_id");

-- Project secrets (original credential storage, replaced in 0003)
CREATE TABLE IF NOT EXISTS "project_secrets" (
"id" serial PRIMARY KEY NOT NULL,
"project_id" text NOT NULL REFERENCES "projects"("id") ON DELETE CASCADE,
"key" text NOT NULL,
"value" text NOT NULL,
"created_at" timestamp DEFAULT now()
);

CREATE UNIQUE INDEX IF NOT EXISTS "uq_project_secrets_project_key"
ON "project_secrets" ("project_id", "key");

-- Cascade defaults (original schema before 0005)
CREATE TABLE IF NOT EXISTS "cascade_defaults" (
"id" serial PRIMARY KEY NOT NULL,
"model" text,
"max_iterations" integer,
"watchdog_timeout_ms" integer,
"card_budget_usd" numeric(10, 2),
"agent_backend" text,
"progress_model" text,
"progress_interval_minutes" numeric(5, 1),
"agent_models" jsonb,
"agent_iterations" jsonb,
"created_at" timestamp DEFAULT now(),
"updated_at" timestamp DEFAULT now()
);

COMMIT;
35 changes: 21 additions & 14 deletions src/db/migrations/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,103 +5,110 @@
{
"idx": 0,
"version": "7",
"when": 1735000000000,
"tag": "0000_base_schema",
"breakpoints": false
},
{
"idx": 1,
"version": "7",
"when": 1736000000000,
"tag": "0001_three_tier_normalization",
"breakpoints": false
},
{
"idx": 1,
"idx": 2,
"version": "7",
"when": 1737000000000,
"tag": "0002_agent_run_tracking",
"breakpoints": false
},
{
"idx": 2,
"idx": 3,
"version": "7",
"when": 1738000000000,
"tag": "0003_organizations_and_credentials",
"breakpoints": false
},
{
"idx": 3,
"idx": 4,
"version": "7",
"when": 1739000000000,
"tag": "0004_agent_credential_overrides",
"breakpoints": false
},
{
"idx": 4,
"idx": 5,
"version": "7",
"when": 1740000000000,
"tag": "0005_config_schema_cleanup",
"breakpoints": false
},
{
"idx": 5,
"idx": 6,
"version": "7",
"when": 1741000000000,
"tag": "0006_users_and_sessions",
"breakpoints": false
},
{
"idx": 6,
"idx": 7,
"version": "7",
"when": 1742000000000,
"tag": "0007_remove_flyio_columns",
"breakpoints": false
},
{
"idx": 7,
"idx": 8,
"version": "7",
"when": 1743000000000,
"tag": "0008_prompt_partials",
"breakpoints": false
},
{
"idx": 8,
"idx": 9,
"version": "7",
"when": 1744000000000,
"tag": "0009_add_squint_db_url",
"breakpoints": false
},
{
"idx": 9,
"idx": 10,
"version": "7",
"when": 1745000000000,
"tag": "0010_webhook_logs",
"breakpoints": false
},
{
"idx": 10,
"idx": 11,
"version": "7",
"when": 1746000000000,
"tag": "0011_remove_credentials_description",
"breakpoints": false
},
{
"idx": 11,
"idx": 12,
"version": "7",
"when": 1747000000000,
"tag": "0012_llm_calls_realtime",
"breakpoints": false
},
{
"idx": 12,
"idx": 13,
"version": "7",
"when": 1748000000000,
"tag": "0013_integration_model_refactor",
"breakpoints": false
},
{
"idx": 13,
"idx": 14,
"version": "7",
"when": 1749000000000,
"tag": "0014_pr_work_items",
"breakpoints": false
},
{
"idx": 14,
"idx": 15,
"version": "7",
"when": 1750000000000,
"tag": "0015_rename_briefing_to_splitting",
Expand Down
Loading