@vrplatform/kysely 1.3.45-4459 → 1.3.45-4466
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,25 @@
|
|
|
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
|
+
update public.user
|
|
7
|
+
set secondary_emails = '[]'::jsonb
|
|
8
|
+
where secondary_emails = to_jsonb('[]'::text)
|
|
9
|
+
`.execute(db);
|
|
10
|
+
await sql`
|
|
11
|
+
alter table public.user
|
|
12
|
+
add constraint user_secondary_emails_array_check
|
|
13
|
+
check (
|
|
14
|
+
secondary_emails is null
|
|
15
|
+
or jsonb_typeof(secondary_emails) = 'array'
|
|
16
|
+
)
|
|
17
|
+
`.execute(db);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function down(db: Kysely<any>): Promise<void> {
|
|
21
|
+
await sql`
|
|
22
|
+
alter table public.user
|
|
23
|
+
drop constraint user_secondary_emails_array_check
|
|
24
|
+
`.execute(db);
|
|
25
|
+
}
|