update source code (drizzle) (4 files)
This commit is contained in:
53
drizzle/0002_workflow_runs.sql
Normal file
53
drizzle/0002_workflow_runs.sql
Normal file
@@ -0,0 +1,53 @@
|
||||
CREATE TABLE IF NOT EXISTS "workflow_runs" (
|
||||
"id" text PRIMARY KEY DEFAULT gen_random_uuid()::text NOT NULL,
|
||||
"user_id" text NOT NULL REFERENCES "users"("id") ON DELETE cascade,
|
||||
"workflow_id" text NOT NULL,
|
||||
"workflow_version" text NOT NULL,
|
||||
"status" text DEFAULT 'running' NOT NULL,
|
||||
"goal" text,
|
||||
"input" jsonb,
|
||||
"current_step_id" text,
|
||||
"progress_percent" integer DEFAULT 0 NOT NULL,
|
||||
"qscore_before" jsonb,
|
||||
"qscore_after" jsonb,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"completed_at" timestamp with time zone
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS "workflow_runs_user_idx" ON "workflow_runs" ("user_id", "created_at");
|
||||
CREATE INDEX IF NOT EXISTS "workflow_runs_workflow_idx" ON "workflow_runs" ("workflow_id");
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "workflow_run_modules" (
|
||||
"id" text PRIMARY KEY DEFAULT gen_random_uuid()::text NOT NULL,
|
||||
"run_id" text NOT NULL REFERENCES "workflow_runs"("id") ON DELETE cascade,
|
||||
"module_id" text NOT NULL,
|
||||
"title" text NOT NULL,
|
||||
"status" text DEFAULT 'idle' NOT NULL,
|
||||
"service" text,
|
||||
"output_summary" text,
|
||||
"output" jsonb,
|
||||
"error" text,
|
||||
"started_at" timestamp with time zone,
|
||||
"completed_at" timestamp with time zone
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "workflow_artifacts" (
|
||||
"id" text PRIMARY KEY DEFAULT gen_random_uuid()::text NOT NULL,
|
||||
"run_id" text NOT NULL REFERENCES "workflow_runs"("id") ON DELETE cascade,
|
||||
"module_id" text,
|
||||
"type" text NOT NULL,
|
||||
"title" text NOT NULL,
|
||||
"repo_path" text,
|
||||
"public_url" text,
|
||||
"metadata" jsonb,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "workflow_events" (
|
||||
"id" text PRIMARY KEY DEFAULT gen_random_uuid()::text NOT NULL,
|
||||
"run_id" text NOT NULL REFERENCES "workflow_runs"("id") ON DELETE cascade,
|
||||
"user_id" text NOT NULL REFERENCES "users"("id") ON DELETE cascade,
|
||||
"type" text NOT NULL,
|
||||
"payload" jsonb,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
14
drizzle/0003_workflow_phase2.sql
Normal file
14
drizzle/0003_workflow_phase2.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
ALTER TABLE "workflow_run_modules" ADD COLUMN IF NOT EXISTS "idempotency_key" text;
|
||||
ALTER TABLE "workflow_run_modules" ADD COLUMN IF NOT EXISTS "retry_count" integer DEFAULT 0 NOT NULL;
|
||||
ALTER TABLE "workflow_run_modules" ADD COLUMN IF NOT EXISTS "max_retries" integer DEFAULT 2 NOT NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "workflow_approvals" (
|
||||
"id" text PRIMARY KEY DEFAULT gen_random_uuid()::text NOT NULL,
|
||||
"run_id" text NOT NULL REFERENCES "workflow_runs"("id") ON DELETE cascade,
|
||||
"approval_id" text NOT NULL,
|
||||
"status" text DEFAULT 'pending' NOT NULL,
|
||||
"payload" jsonb,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"resolved_at" timestamp with time zone
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS "workflow_approvals_run_idx" ON "workflow_approvals" ("run_id", "approval_id");
|
||||
11
drizzle/0004_qscore_snapshots.sql
Normal file
11
drizzle/0004_qscore_snapshots.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
CREATE TABLE IF NOT EXISTS "qscore_snapshots" (
|
||||
"id" text PRIMARY KEY DEFAULT gen_random_uuid()::text NOT NULL,
|
||||
"user_id" text NOT NULL REFERENCES "users"("id") ON DELETE cascade,
|
||||
"run_id" text REFERENCES "workflow_runs"("id") ON DELETE cascade,
|
||||
"snapshot_type" text NOT NULL,
|
||||
"score" integer,
|
||||
"payload" jsonb,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS "qscore_snapshots_user_idx" ON "qscore_snapshots" ("user_id", "created_at");
|
||||
CREATE INDEX IF NOT EXISTS "qscore_snapshots_run_idx" ON "qscore_snapshots" ("run_id");
|
||||
@@ -15,6 +15,27 @@
|
||||
"when": 1780306600000,
|
||||
"tag": "0001_central_gitea_unified_actor",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 2,
|
||||
"version": "7",
|
||||
"when": 1780306700000,
|
||||
"tag": "0002_workflow_runs",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 3,
|
||||
"version": "7",
|
||||
"when": 1780306800000,
|
||||
"tag": "0003_workflow_phase2",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 4,
|
||||
"version": "7",
|
||||
"when": 1780306900000,
|
||||
"tag": "0004_qscore_snapshots",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user