| 1 | import * as Effect from "effect/Effect"; |
| 2 | import * as SqlClient from "effect/sql/SqlClient"; |
| 3 | |
| 4 | export default Effect.gen(function* () { |
| 5 | const sql = yield* SqlClient.SqlClient; |
| 6 | |
| 7 | // Shell and limit-recovery reads need one root error, not every item in a run. |
| 8 | yield* sql` |
| 9 | CREATE INDEX orchestration_v2_projection_turn_items_failed_error_idx |
| 10 | ON orchestration_v2_projection_turn_items( |
| 11 | thread_id, run_id, node_id, updated_at DESC, ordinal DESC, turn_item_id DESC |
| 12 | ) |
| 13 | WHERE type = 'error' AND status = 'failed' |
| 14 | `; |
| 15 | }); |