@vrplatform/kysely 1.3.41-4283 → 1.3.41-4307

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,46 @@
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 table if not exists public.control_plane_outbox (
7
+ id uuid primary key default gen_random_uuid(),
8
+ aggregate_type text not null,
9
+ aggregate_id text not null,
10
+ event_type text not null,
11
+ event_version integer not null,
12
+ data_region text,
13
+ payload jsonb not null default jsonb_build_object(),
14
+ created_at timestamptz not null default now(),
15
+ published_at timestamptz,
16
+ attempts integer not null default 0,
17
+ last_error text,
18
+ constraint control_plane_outbox_region_check
19
+ check (
20
+ data_region is null
21
+ or data_region in ('ap', 'crunchy', 'eu', 'hostaway', 'us')
22
+ ),
23
+ constraint control_plane_outbox_event_version_check
24
+ check (event_version > 0),
25
+ constraint control_plane_outbox_aggregate_version_key
26
+ unique (aggregate_type, aggregate_id, event_version)
27
+ );
28
+ `.execute(db);
29
+
30
+ await sql`
31
+ create index if not exists control_plane_outbox_pending_idx
32
+ on public.control_plane_outbox (created_at, id)
33
+ where published_at is null;
34
+ `.execute(db);
35
+
36
+ await sql`
37
+ create index if not exists control_plane_outbox_aggregate_idx
38
+ on public.control_plane_outbox (aggregate_type, aggregate_id, created_at);
39
+ `.execute(db);
40
+ }
41
+
42
+ export async function down(db: Kysely<any>): Promise<void> {
43
+ await sql`
44
+ drop table if exists public.control_plane_outbox;
45
+ `.execute(db);
46
+ }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.3.41-4283",
6
+ "version": "1.3.41-4307",
7
7
  "description": "",
8
8
  "main": "build/main/index.js",
9
9
  "module": "build/module/index.js",