@vrplatform/kysely 1.3.45-stage.4994 → 1.3.45-stage.4999

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,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-stage.4994",
6
+ "version": "1.3.45-stage.4999",
7
7
  "description": "",
8
8
  "main": "build/main/index.js",
9
9
  "module": "build/module/index.js",