@vrplatform/kysely 1.3.45-37952226697 → 1.3.45-37968626009

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,44 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ export async function up(db: Kysely<unknown>): Promise<void> {
5
+ await sql`set local lock_timeout = '5s'`.execute(db);
6
+ // These indexes scan existing multi-million-row tables.
7
+ await sql`set local statement_timeout = '10min'`.execute(db);
8
+
9
+ // recoverPublicAuditEvents (PRO-19064) looks for events projected with an
10
+ // older version. Without this index it probes every audit action since the
11
+ // cutover on each run.
12
+ await sql`
13
+ create index if not exists public_event_projection_version_idx
14
+ on audit.public_event (projection_version)
15
+ `.execute(db);
16
+ // The payment linker (PRO-18060) reads pending lines newest first, one
17
+ // keyset page at a time. match_status_tenant_id_idx cannot order them, so
18
+ // every page read all pending lines of the tenant.
19
+ await sql`
20
+ create index if not exists payment_line_pending_tenant_created_idx
21
+ on public.payment_line (tenant_id, created_at desc, id desc)
22
+ where match_status = 'pending'
23
+ `.execute(db);
24
+ await sql`
25
+ create index if not exists transaction_line_pending_tenant_created_idx
26
+ on accounting.transaction_line (tenant_id, created_at desc, id desc)
27
+ where match_status = 'pending'
28
+ `.execute(db);
29
+ }
30
+
31
+ export async function down(db: Kysely<unknown>): Promise<void> {
32
+ await sql`set local lock_timeout = '5s'`.execute(db);
33
+ await sql`set local statement_timeout = '60s'`.execute(db);
34
+
35
+ await sql`
36
+ drop index if exists accounting.transaction_line_pending_tenant_created_idx
37
+ `.execute(db);
38
+ await sql`
39
+ drop index if exists public.payment_line_pending_tenant_created_idx
40
+ `.execute(db);
41
+ await sql`
42
+ drop index if exists audit.public_event_projection_version_idx
43
+ `.execute(db);
44
+ }
@@ -0,0 +1,26 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ export async function up(db: Kysely<unknown>): Promise<void> {
5
+ await sql`set local lock_timeout = '5s'`.execute(db);
6
+ await sql`set local statement_timeout = '10min'`.execute(db);
7
+
8
+ // With 100 most-common values, the planner assumed an emptied tenant still
9
+ // owned about 545000 core.change rows, chose a skip scan over
10
+ // (sync_id, tenant_id) for the foreign-key check, and timed out deleting the
11
+ // tenant row (PRO-18138). A running vacuum holds the lock this needs; apply
12
+ // it when the table is idle.
13
+ await sql`
14
+ alter table core.change alter column tenant_id set statistics 1000
15
+ `.execute(db);
16
+ await sql`analyze core.change (tenant_id)`.execute(db);
17
+ }
18
+
19
+ export async function down(db: Kysely<unknown>): Promise<void> {
20
+ await sql`set local lock_timeout = '5s'`.execute(db);
21
+ await sql`set local statement_timeout = '60s'`.execute(db);
22
+
23
+ await sql`
24
+ alter table core.change alter column tenant_id set statistics -1
25
+ `.execute(db);
26
+ }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.3.45-37952226697",
6
+ "version": "1.3.45-37968626009",
7
7
  "description": "",
8
8
  "main": "build/main/index.js",
9
9
  "module": "build/module/index.js",