ad24835940
G-pre1: 144k objects clustered into 7,466 groups via Mini-Batch K-Means
on bge-m3 embeddings. Two-stage: k=5000 base + sub-cluster groups >50.
G-pre2: 5,114 Master Controls from lifecycle phase chains
(define→implement→test→monitor), linking 172,504 atomic controls.
G-pre3: REST API for Master Controls
GET /v1/master-controls (list, search, filter)
GET /v1/master-controls/stats
GET /v1/master-controls/{mc_id} (detail with phase-controls)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
31 lines
1.2 KiB
SQL
31 lines
1.2 KiB
SQL
-- Migration 005: Master Controls (G-pre2)
|
|
-- Schema: compliance
|
|
-- Run: ssh macmini "docker exec -i bp-core-postgres psql -U breakpilot -d breakpilot_db" < control-pipeline/migrations/005_master_controls.sql
|
|
|
|
SET search_path TO compliance, public;
|
|
|
|
CREATE TABLE IF NOT EXISTS master_controls (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
master_control_id VARCHAR(50) UNIQUE NOT NULL,
|
|
object_group_id INTEGER NOT NULL,
|
|
canonical_name VARCHAR(200) NOT NULL,
|
|
phases_covered JSONB NOT NULL DEFAULT '[]',
|
|
phase_control_count JSONB NOT NULL DEFAULT '{}',
|
|
total_controls INTEGER DEFAULT 0,
|
|
created_at TIMESTAMPTZ DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_master_controls_group ON master_controls(object_group_id);
|
|
|
|
CREATE TABLE IF NOT EXISTS master_control_members (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
master_control_uuid UUID NOT NULL REFERENCES master_controls(id) ON DELETE CASCADE,
|
|
control_uuid UUID NOT NULL,
|
|
phase VARCHAR(50) NOT NULL,
|
|
action VARCHAR(50) NOT NULL,
|
|
created_at TIMESTAMPTZ DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_mc_members_master ON master_control_members(master_control_uuid);
|
|
CREATE INDEX IF NOT EXISTS idx_mc_members_control ON master_control_members(control_uuid);
|