@vrplatform/kysely 1.3.45-39248566836 → 1.3.45-39373965466

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.
@@ -7,10 +7,28 @@ import { sql } from 'kysely';
7
7
  // and a heap fetch per entry took 21-39 s. Both partial indexes cover every
8
8
  // column those queries read, so they can run as index-only scans. On large
9
9
  // databases run scripts/ben-2/pro-19314-create-revenue-indexes.ts first: it
10
- // builds the indexes concurrently, and this migration then skips them.
10
+ // builds the indexes concurrently, and this migration then skips them. The
11
+ // migrator runs in a transaction, so this build cannot be concurrent: the short
12
+ // statement timeout fails it before it blocks journal writes for long.
11
13
  export async function up(db: Kysely<unknown>): Promise<void> {
12
14
  await sql`set local lock_timeout = '5s'`.execute(db);
13
- await sql`set local statement_timeout = '60min'`.execute(db);
15
+ await sql`set local statement_timeout = '60s'`.execute(db);
16
+ // A failed concurrent build leaves an invalid index that `if not exists`
17
+ // would keep, so drop it first.
18
+ const invalid = await sql<{ name: string }>`
19
+ select index_class.relname as name
20
+ from pg_index as i
21
+ inner join pg_class as index_class on index_class.oid = i.indexrelid
22
+ where i.indrelid = 'accounting.journal_entry'::regclass
23
+ and index_class.relname in (
24
+ 'journal_entry_reservation_revenue_txn_at_idx',
25
+ 'journal_entry_reservation_revenue_reservation_idx'
26
+ )
27
+ and not (i.indisvalid and i.indisready)
28
+ `.execute(db);
29
+ for (const { name } of invalid.rows) {
30
+ await sql`drop index accounting.${sql.id(name)}`.execute(db);
31
+ }
14
32
 
15
33
  await sql`
16
34
  create index if not exists journal_entry_reservation_revenue_txn_at_idx
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.3.45-39248566836",
6
+ "version": "1.3.45-39373965466",
7
7
  "description": "",
8
8
  "main": "build/main/index.js",
9
9
  "module": "build/module/index.js",