-- Migration 083: AI Act Decision Tree Results -- Stores results from the two-axis AI Act classification (High-Risk + GPAI) CREATE TABLE IF NOT EXISTS ai_act_decision_tree_results ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), tenant_id UUID NOT NULL, project_id UUID, system_name VARCHAR(500) NOT NULL, system_description TEXT, answers JSONB NOT NULL DEFAULT '{}', high_risk_level VARCHAR(50) NOT NULL DEFAULT 'not_applicable', gpai_result JSONB NOT NULL DEFAULT '{}', combined_obligations JSONB DEFAULT '[]', applicable_articles JSONB DEFAULT '[]', created_at TIMESTAMPTZ DEFAULT NOW(), updated_at TIMESTAMPTZ DEFAULT NOW() ); CREATE INDEX IF NOT EXISTS idx_ai_act_dt_tenant ON ai_act_decision_tree_results(tenant_id); CREATE INDEX IF NOT EXISTS idx_ai_act_dt_project ON ai_act_decision_tree_results(project_id) WHERE project_id IS NOT NULL;