@vrplatform/kysely 1.3.45-stage.6461 → 1.3.45-stage.6463

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,49 @@
1
+ import { type Kysely, sql } from 'kysely';
2
+
3
+ export async function up(db: Kysely<unknown>): Promise<void> {
4
+ await sql`set local lock_timeout = '5s'`.execute(db);
5
+ await sql`
6
+ alter table health.accounting_integrity_case
7
+ drop constraint accounting_integrity_case_review_metadata_check,
8
+ add constraint accounting_integrity_case_review_metadata_check check (
9
+ (
10
+ reviewed_by is null and reviewed_at is null and
11
+ review_rationale is null
12
+ ) or (
13
+ reviewed_by is not null and reviewed_at is not null and
14
+ nullif(trim(review_rationale), '') is not null
15
+ )
16
+ )
17
+ `.execute(db);
18
+ }
19
+
20
+ export async function down(db: Kysely<unknown>): Promise<void> {
21
+ await sql`
22
+ update health.accounting_integrity_case
23
+ set reviewed_by = null, reviewed_at = null, review_rationale = null
24
+ where review_status = 'unreviewed'
25
+ `.execute(db);
26
+ await sql`
27
+ update health.accounting_integrity_case
28
+ set
29
+ reviewed_by = coalesce(reviewed_by, 'legacy-monitoring'),
30
+ reviewed_at = coalesce(reviewed_at, last_changed_at),
31
+ review_rationale = coalesce(
32
+ nullif(trim(review_rationale), ''),
33
+ 'Migrated from compatibility review state.'
34
+ )
35
+ where review_status <> 'unreviewed'
36
+ `.execute(db);
37
+ await sql`
38
+ alter table health.accounting_integrity_case
39
+ drop constraint accounting_integrity_case_review_metadata_check,
40
+ add constraint accounting_integrity_case_review_metadata_check check (
41
+ (review_status = 'unreviewed' and reviewed_by is null and
42
+ reviewed_at is null and review_rationale is null)
43
+ or
44
+ (review_status <> 'unreviewed' and reviewed_by is not null and
45
+ reviewed_at is not null and nullif(trim(review_rationale), '')
46
+ is not null)
47
+ )
48
+ `.execute(db);
49
+ }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.3.45-stage.6461",
6
+ "version": "1.3.45-stage.6463",
7
7
  "description": "",
8
8
  "main": "build/main/index.js",
9
9
  "module": "build/module/index.js",