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

ApplicationEventSequenceIndexes.ts

19 lines664 Bytes

1import * as Effect from "effect/Effect";
2import * as SqlClient from "effect/unstable/sql/SqlClient";
3​
4// Index setup composed by migration 050.
5export default Effect.gen(function* () {
6 const sql = yield* SqlClient.SqlClient;
7​
8 yield* sql`
9 CREATE INDEX idx_orchestration_events_application_high_water
10 ON orchestration_events(sequence)
11 WHERE aggregate_kind = 'project'
12 OR (application_event_version = 2 AND aggregate_kind = 'thread')
13 `;
14 yield* sql`
15 CREATE INDEX idx_orchestration_events_agent_stream_sequence
16 ON orchestration_events(stream_id, sequence)
17 WHERE application_event_version = 2 AND aggregate_kind = 'thread'
18 `;
19});