@vrplatform/kysely 1.3.45-stage.1120 → 1.3.45-stage.1130
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Kysely } from 'kysely';
|
|
2
|
+
import { sql } from 'kysely';
|
|
3
|
+
|
|
4
|
+
// The recurring-fee journal status joins invalidations by source resource,
|
|
5
|
+
// applied and pending. The existing source index is partial on pending rows, so
|
|
6
|
+
// the join scanned every invalidation of the tenant.
|
|
7
|
+
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
8
|
+
await sql`set local lock_timeout = '5s'`.execute(db);
|
|
9
|
+
await sql`set local statement_timeout = '120s'`.execute(db);
|
|
10
|
+
|
|
11
|
+
await sql`
|
|
12
|
+
create index if not exists reservation_journal_invalidation_source_idx
|
|
13
|
+
on accounting.reservation_journal_invalidation (
|
|
14
|
+
tenant_id,
|
|
15
|
+
source_resource_type,
|
|
16
|
+
source_resource_id
|
|
17
|
+
)
|
|
18
|
+
where source_resource_id is not null
|
|
19
|
+
`.execute(db);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
23
|
+
await sql`
|
|
24
|
+
drop index if exists accounting.reservation_journal_invalidation_source_idx
|
|
25
|
+
`.execute(db);
|
|
26
|
+
}
|