Add project-bound OAuth MCP queries and controlled analysis with scoped evidence, limits, timeouts and a nearby-model spatial query using EPSG:4326 inputs. Default nearby searches to 200 meters and five results. Integrate investigation messaging/presentation, health/readiness and typed history; remove duplicate web search and fix online simulation and compressed baseline writes. Include project migrations 023-025; keep local credentials and demo seeding excluded. Validation: 319 focused pytest checks; real PostGIS temporary-table regression; read-only Jinqian bridge radius comparison; cross-language MCP discovery/calls.
43 lines
1.7 KiB
PL/PgSQL
43 lines
1.7 KiB
PL/PgSQL
-- Latest investigation reading snapshots and controlled browser presentation events.
|
|
BEGIN;
|
|
SET LOCAL lock_timeout = '5s';
|
|
|
|
DO $$
|
|
BEGIN
|
|
IF current_database() <> 'tjwater_v2' THEN
|
|
RAISE EXCEPTION 'Investigation progress migration is restricted to tjwater_v2';
|
|
END IF;
|
|
END $$;
|
|
|
|
CREATE TABLE IF NOT EXISTS workbench.operational_task_progress (
|
|
project_id uuid NOT NULL,
|
|
task_id uuid NOT NULL,
|
|
run_id uuid NOT NULL,
|
|
revision bigint NOT NULL CHECK (revision >= 1),
|
|
document jsonb NOT NULL,
|
|
published_at timestamptz NOT NULL,
|
|
PRIMARY KEY (project_id,task_id,run_id),
|
|
FOREIGN KEY (project_id,task_id)
|
|
REFERENCES workbench.operational_tasks(project_id,task_id) ON DELETE CASCADE,
|
|
FOREIGN KEY (project_id,run_id)
|
|
REFERENCES workbench.operational_task_runs(project_id,run_id) ON DELETE CASCADE,
|
|
CHECK ((jsonb_typeof(document)='object'
|
|
AND document->>'run_id'=run_id::text
|
|
AND (document->>'revision')::bigint=revision) IS TRUE)
|
|
);
|
|
|
|
ALTER TABLE workbench.domain_event_log
|
|
DROP CONSTRAINT IF EXISTS domain_event_log_topic_check;
|
|
ALTER TABLE workbench.domain_event_log ADD CONSTRAINT domain_event_log_topic_check
|
|
CHECK (topic IN (
|
|
'operational.task.changed','operational.run.queued','operational.run.changed',
|
|
'operational.report.published','operational.progress.changed',
|
|
'operational.presentation.requested','operational.action.changed',
|
|
'operational.notification.changed','workbench.alert.changed',
|
|
'workbench.work_order.changed','analysis.run.changed'
|
|
));
|
|
|
|
COMMENT ON TABLE workbench.operational_task_progress IS
|
|
'One latest complete reading snapshot per investigation run; never an execution scheduler.';
|
|
COMMIT;
|