Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

060_ThreadSnapshotWindowIndexes.ts

18 lines664 Bytes

1import * as Effect from "effect/Effect";
2import * as SqlClient from "effect/sql/SqlClient";
3​
4export default Effect.gen(function* () {
5 const sql = yield* SqlClient.SqlClient;
6​
7 // ProjectionStore's turn_anchors CTE relies on it.
8 yield* sql`
9 CREATE INDEX IF NOT EXISTS orchestration_v2_projection_turn_items_user_message_idx
10 ON orchestration_v2_projection_turn_items(thread_id, ordinal, turn_item_id)
11 WHERE type = 'user_message'
12 `;
13 yield* sql`
14 CREATE INDEX IF NOT EXISTS orchestration_v2_projection_nodes_live_idx
15 ON orchestration_v2_projection_nodes(thread_id)
16 WHERE status IN ('pending', 'starting', 'running', 'waiting')
17 `;
18});