import * as Effect from "effect/Effect";
import * as SqlClient from "effect/sql/SqlClient";
export default Effect.gen(function* () {
const sql = yield* SqlClient.SqlClient;
yield* sql`
CREATE TABLE orchestration_v2_projection_subagents (
subagent_id TEXT PRIMARY KEY,
thread_id TEXT NOT NULL,
run_id TEXT,
parent_node_id TEXT NOT NULL,
provider TEXT NOT NULL,
provider_thread_id TEXT,
child_thread_id TEXT,
origin TEXT NOT NULL,
status TEXT NOT NULL,
started_at TEXT,
completed_at TEXT,
updated_at TEXT NOT NULL,
payload_json TEXT NOT NULL
)
`;
yield* sql`CREATE INDEX orchestration_v2_projection_subagents_thread_idx ON orchestration_v2_projection_subagents(thread_id, started_at, subagent_id)`;
yield* sql`CREATE INDEX orchestration_v2_projection_subagents_parent_node_idx ON orchestration_v2_projection_subagents(parent_node_id)`;
yield* sql`CREATE INDEX orchestration_v2_projection_subagents_provider_thread_idx ON orchestration_v2_projection_subagents(provider_thread_id)`;
yield* sql`CREATE INDEX orchestration_v2_projection_subagents_child_thread_idx ON orchestration_v2_projection_subagents(child_thread_id)`;
});