@vrplatform/kysely 1.3.45-4993 → 1.3.45-4998

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,53 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ export async function up(db: Kysely<any>): Promise<void> {
5
+ await sql`
6
+ create index if not exists source_bill_transfer_id_idx
7
+ on public.source (tenant_id, (json ->> 'transferId'))
8
+ where type = 'bill';
9
+ `.execute(db);
10
+
11
+ await sql`
12
+ create index if not exists sync_provider_payment_idempotency_key_idx
13
+ on core.sync (
14
+ tenant_id,
15
+ connection_id,
16
+ ((params -> 'providerPayment') ->> 'idempotencyKey')
17
+ )
18
+ where params ? 'providerPayment';
19
+ `.execute(db);
20
+
21
+ await sql`
22
+ create index if not exists sync_provider_payment_transaction_ids_idx
23
+ on core.sync using gin (((params -> 'providerPayment') -> 'transactionIds'))
24
+ where params ? 'providerPayment';
25
+ `.execute(db);
26
+
27
+ await sql`
28
+ create index if not exists sync_payment_method_contact_id_idx
29
+ on core.sync (
30
+ tenant_id,
31
+ ((params -> 'paymentMethod') ->> 'contactId')
32
+ )
33
+ where params ? 'paymentMethod';
34
+ `.execute(db);
35
+ }
36
+
37
+ export async function down(db: Kysely<any>): Promise<void> {
38
+ await sql`
39
+ drop index if exists core.sync_payment_method_contact_id_idx;
40
+ `.execute(db);
41
+
42
+ await sql`
43
+ drop index if exists core.sync_provider_payment_transaction_ids_idx;
44
+ `.execute(db);
45
+
46
+ await sql`
47
+ drop index if exists core.sync_provider_payment_idempotency_key_idx;
48
+ `.execute(db);
49
+
50
+ await sql`
51
+ drop index if exists public.source_bill_transfer_id_idx;
52
+ `.execute(db);
53
+ }
@@ -0,0 +1,39 @@
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`
6
+ alter table public.tenant
7
+ add constraint tenant_app_settings_object_check
8
+ check (
9
+ app_settings is null
10
+ or jsonb_typeof(app_settings) = 'object'
11
+ ) not valid
12
+ `.execute(db);
13
+
14
+ await sql`
15
+ update public.tenant
16
+ set app_settings = case
17
+ when jsonb_typeof(app_settings) = 'string' then
18
+ case
19
+ when pg_input_is_valid(app_settings #>> '{}', 'jsonb') then
20
+ case
21
+ when jsonb_typeof((app_settings #>> '{}')::jsonb) = 'object'
22
+ then (app_settings #>> '{}')::jsonb
23
+ else '{}'::jsonb
24
+ end
25
+ else '{}'::jsonb
26
+ end
27
+ else '{}'::jsonb
28
+ end
29
+ where app_settings is not null
30
+ and jsonb_typeof(app_settings) <> 'object'
31
+ `.execute(db);
32
+ }
33
+
34
+ export async function down(db: Kysely<unknown>): Promise<void> {
35
+ await sql`
36
+ alter table public.tenant
37
+ drop constraint if exists tenant_app_settings_object_check
38
+ `.execute(db);
39
+ }
@@ -0,0 +1,11 @@
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`
6
+ alter table public.tenant
7
+ validate constraint tenant_app_settings_object_check
8
+ `.execute(db);
9
+ }
10
+
11
+ export async function down(): Promise<void> {}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.3.45-4993",
6
+ "version": "1.3.45-4998",
7
7
  "description": "",
8
8
  "main": "build/main/index.js",
9
9
  "module": "build/module/index.js",