@dudousxd/nestjs-durable-store-prisma 0.26.0 → 0.27.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dudousxd/nestjs-durable-store-prisma",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "description": "Prisma adapter for the nestjs-durable StateStore",
5
5
  "license": "MIT",
6
6
  "author": "Davide Carvalho",
@@ -37,8 +37,8 @@
37
37
  "prisma": "6.19.3",
38
38
  "tsup": "8.3.5",
39
39
  "typescript": "5.9.3",
40
- "@dudousxd/nestjs-durable-core": "^0.88.0",
41
- "@dudousxd/nestjs-durable-testing": "^0.25.0"
40
+ "@dudousxd/nestjs-durable-core": "^0.90.0",
41
+ "@dudousxd/nestjs-durable-testing": "^0.26.0"
42
42
  },
43
43
  "module": "./dist/index.js",
44
44
  "exports": {
@@ -43,6 +43,14 @@ model DurableWorkflowRun {
43
43
  // column existed, so it stays NULL and reads back as `undefined` = "unknown". A real-looking
44
44
  // default would be indistinguishable from a genuine registration in the dashboard facet.
45
45
  origin String? @map("origin")
46
+ // The CUSTOMER (tenancy) this run belongs to — not the worker-pool `namespace`. Nullable, no
47
+ // default: NULL = no tenant, which is every run while tenancy is off. Existing deployment:
48
+ // ALTER TABLE durable_workflow_runs ADD COLUMN tenant_id TEXT;
49
+ // ALTER TABLE durable_workflow_runs ADD COLUMN tenant_kind TEXT;
50
+ // CREATE INDEX durable_workflow_runs_tenant_idx ON durable_workflow_runs (tenant_id, created_at);
51
+ // (Prisma Migrate generates exactly this from the fields; use VARCHAR(191) on MySQL.)
52
+ tenantId String? @map("tenant_id")
53
+ tenantKind String? @map("tenant_kind")
46
54
  createdAt DateTime @map("created_at")
47
55
  updatedAt DateTime @map("updated_at")
48
56
 
@@ -61,6 +69,8 @@ model DurableWorkflowRun {
61
69
  // swap from dropping and rebuilding it. The two indexes above already agree by accident — Prisma's
62
70
  // derived names happen to be the ones MikroORM declares.
63
71
  @@index([namespace, status, createdAt], map: "durable_workflow_runs_namespace_status_idx")
72
+ // App-facing reads with tenancy on: `tenant_id = ? ORDER BY created_at DESC`.
73
+ @@index([tenantId, createdAt], map: "durable_workflow_runs_tenant_idx")
64
74
  @@map("durable_workflow_runs")
65
75
  }
66
76
 
@@ -167,10 +177,14 @@ model DurableSchedule {
167
177
  tags Json?
168
178
  spec Json
169
179
  state Json
180
+ // The customer the schedule (and every run it starts) belongs to. NULL = none.
181
+ tenantId String? @map("tenant_id")
182
+ tenantKind String? @map("tenant_kind")
170
183
  createdAt DateTime @map("created_at")
171
184
  updatedAt DateTime @map("updated_at")
172
185
 
173
186
  // The poll's "due by T" scan: `paused = false AND next_fire_at <= T ORDER BY next_fire_at`.
174
187
  @@index([paused, nextFireAt], map: "durable_schedules_due_idx")
188
+ @@index([tenantId], map: "durable_schedules_tenant_idx")
175
189
  @@map("durable_schedules")
176
190
  }