@vrplatform/kysely 1.3.41-stage.4219 → 1.3.41-stage.4228

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,45 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ // Tenant-to-tenant references (partner, billing partner, chart-of-accounts
5
+ // source) are cross-region: a partner homed in one cell manages tenants in
6
+ // another, so these self-referential FKs cannot hold within a single regional
7
+ // database. The control plane holds the authoritative tenant graph; the
8
+ // regional columns keep the ids as plain references. Drop the FKs.
9
+ export async function up(db: Kysely<any>): Promise<void> {
10
+ await sql`
11
+ alter table public.tenant
12
+ drop constraint if exists tenant_partner_id_fkey;
13
+ `.execute(db);
14
+ await sql`
15
+ alter table public.tenant
16
+ drop constraint if exists tenant_billing_partner_id_fkey;
17
+ `.execute(db);
18
+ await sql`
19
+ alter table public.tenant
20
+ drop constraint if exists tenant_chart_of_account_tenant_id_fkey;
21
+ `.execute(db);
22
+ }
23
+
24
+ export async function down(db: Kysely<any>): Promise<void> {
25
+ // NOT VALID: cross-region references may already exist; only future writes
26
+ // are constrained again.
27
+ await sql`
28
+ alter table public.tenant
29
+ add constraint tenant_partner_id_fkey
30
+ foreign key (partner_id) references public.tenant(id)
31
+ on update restrict on delete restrict not valid;
32
+ `.execute(db);
33
+ await sql`
34
+ alter table public.tenant
35
+ add constraint tenant_billing_partner_id_fkey
36
+ foreign key (billing_partner_id) references public.tenant(id)
37
+ on update restrict on delete restrict not valid;
38
+ `.execute(db);
39
+ await sql`
40
+ alter table public.tenant
41
+ add constraint tenant_chart_of_account_tenant_id_fkey
42
+ foreign key (chart_of_account_tenant_id) references public.tenant(id)
43
+ on update restrict on delete restrict not valid;
44
+ `.execute(db);
45
+ }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.3.41-stage.4219",
6
+ "version": "1.3.41-stage.4228",
7
7
  "description": "",
8
8
  "main": "build/main/index.js",
9
9
  "module": "build/module/index.js",