@claroshq/claros 0.0.0-stage → 0.8.4

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.
Files changed (92) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -2
  3. package/assets/dashboard/apple-touch-icon.png +0 -0
  4. package/assets/dashboard/assets/bricolage-grotesque-latin-ext-wght-normal-CcLUaPy7.woff2 +0 -0
  5. package/assets/dashboard/assets/bricolage-grotesque-latin-wght-normal-DLoelf7F.woff2 +0 -0
  6. package/assets/dashboard/assets/bricolage-grotesque-vietnamese-wght-normal-BUzh504Q.woff2 +0 -0
  7. package/assets/dashboard/assets/index-Dvs1k10B.js +23 -0
  8. package/assets/dashboard/assets/index-gR64IOwq.css +1 -0
  9. package/assets/dashboard/assets/instrument-sans-latin-ext-wght-normal-B5bTHO_g.woff2 +0 -0
  10. package/assets/dashboard/assets/instrument-sans-latin-wght-normal-BbzFLZTg.woff2 +0 -0
  11. package/assets/dashboard/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
  12. package/assets/dashboard/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  13. package/assets/dashboard/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  14. package/assets/dashboard/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  15. package/assets/dashboard/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  16. package/assets/dashboard/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  17. package/assets/dashboard/assets/quicksand-latin-ext-wght-normal-CrJ75Ewg.woff2 +0 -0
  18. package/assets/dashboard/assets/quicksand-latin-wght-normal-Buj9m_3d.woff2 +0 -0
  19. package/assets/dashboard/assets/quicksand-vietnamese-wght-normal-ei70gACF.woff2 +0 -0
  20. package/assets/dashboard/claros.js +122 -0
  21. package/assets/dashboard/favicon-16.png +0 -0
  22. package/assets/dashboard/favicon-32.png +0 -0
  23. package/assets/dashboard/favicon.ico +0 -0
  24. package/assets/dashboard/favicon.svg +17 -0
  25. package/assets/dashboard/fonts-license.txt +119 -0
  26. package/assets/dashboard/index.html +34 -0
  27. package/assets/migrations/0000_baseline.sql +343 -0
  28. package/assets/migrations/0001_kb_fts.sql +22 -0
  29. package/assets/migrations/0002_instance_layer.sql +51 -0
  30. package/assets/migrations/0003_suppressions_lower_email.sql +22 -0
  31. package/assets/migrations/0004_claim_tokens.sql +9 -0
  32. package/assets/migrations/0005_topics_transports.sql +36 -0
  33. package/assets/migrations/0006_ops_alerts.sql +28 -0
  34. package/assets/migrations/0007_integration_surface.sql +46 -0
  35. package/assets/migrations/0008_p5_engine.sql +31 -0
  36. package/assets/migrations/0009_p5b_readiness.sql +11 -0
  37. package/assets/migrations/meta/0000_snapshot.json +2489 -0
  38. package/assets/migrations/meta/0002_snapshot.json +2645 -0
  39. package/assets/migrations/meta/0004_snapshot.json +2698 -0
  40. package/assets/migrations/meta/0005_snapshot.json +2959 -0
  41. package/assets/migrations/meta/0006_snapshot.json +3138 -0
  42. package/assets/migrations/meta/0007_snapshot.json +3469 -0
  43. package/assets/migrations/meta/0008_snapshot.json +3709 -0
  44. package/assets/migrations/meta/0009_snapshot.json +3785 -0
  45. package/assets/migrations/meta/_journal.json +76 -0
  46. package/assets/worker/index.js +57902 -0
  47. package/bin/claros.mjs +13 -0
  48. package/dist/apply.d.ts +10 -0
  49. package/dist/apply.d.ts.map +1 -0
  50. package/dist/apply.js +72 -0
  51. package/dist/apply.js.map +1 -0
  52. package/dist/assets.d.ts +15 -0
  53. package/dist/assets.d.ts.map +1 -0
  54. package/dist/assets.js +48 -0
  55. package/dist/assets.js.map +1 -0
  56. package/dist/claim.d.ts +12 -0
  57. package/dist/claim.d.ts.map +1 -0
  58. package/dist/claim.js +26 -0
  59. package/dist/claim.js.map +1 -0
  60. package/dist/cli.d.ts +13 -0
  61. package/dist/cli.d.ts.map +1 -0
  62. package/dist/cli.js +158 -0
  63. package/dist/cli.js.map +1 -0
  64. package/dist/cloudflare-api.d.ts +48 -0
  65. package/dist/cloudflare-api.d.ts.map +1 -0
  66. package/dist/cloudflare-api.js +94 -0
  67. package/dist/cloudflare-api.js.map +1 -0
  68. package/dist/import.d.ts +16 -0
  69. package/dist/import.d.ts.map +1 -0
  70. package/dist/import.js +97 -0
  71. package/dist/import.js.map +1 -0
  72. package/dist/ops.d.ts +84 -0
  73. package/dist/ops.d.ts.map +1 -0
  74. package/dist/ops.js +552 -0
  75. package/dist/ops.js.map +1 -0
  76. package/dist/state.d.ts +53 -0
  77. package/dist/state.d.ts.map +1 -0
  78. package/dist/state.js +87 -0
  79. package/dist/state.js.map +1 -0
  80. package/dist/template.d.ts +77 -0
  81. package/dist/template.d.ts.map +1 -0
  82. package/dist/template.js +127 -0
  83. package/dist/template.js.map +1 -0
  84. package/dist/version.d.ts +3 -0
  85. package/dist/version.d.ts.map +1 -0
  86. package/dist/version.js +36 -0
  87. package/dist/version.js.map +1 -0
  88. package/dist/wrangler.d.ts +116 -0
  89. package/dist/wrangler.d.ts.map +1 -0
  90. package/dist/wrangler.js +210 -0
  91. package/dist/wrangler.js.map +1 -0
  92. package/package.json +53 -4
@@ -0,0 +1,3785 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "4d9b7c75-4258-4d88-ba1f-674a3cfc9dd4",
5
+ "prevId": "b74d4dd1-1b45-4402-baf8-a4024760922d",
6
+ "tables": {
7
+ "api_keys": {
8
+ "name": "api_keys",
9
+ "columns": {
10
+ "id": {
11
+ "name": "id",
12
+ "type": "text",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "tenant_id": {
18
+ "name": "tenant_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": false,
22
+ "autoincrement": false
23
+ },
24
+ "key_hash": {
25
+ "name": "key_hash",
26
+ "type": "text",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ },
31
+ "prefix": {
32
+ "name": "prefix",
33
+ "type": "text",
34
+ "primaryKey": false,
35
+ "notNull": true,
36
+ "autoincrement": false
37
+ },
38
+ "label": {
39
+ "name": "label",
40
+ "type": "text",
41
+ "primaryKey": false,
42
+ "notNull": false,
43
+ "autoincrement": false
44
+ },
45
+ "kind": {
46
+ "name": "kind",
47
+ "type": "text",
48
+ "primaryKey": false,
49
+ "notNull": true,
50
+ "autoincrement": false,
51
+ "default": "'secret'"
52
+ },
53
+ "allowed_origins": {
54
+ "name": "allowed_origins",
55
+ "type": "text",
56
+ "primaryKey": false,
57
+ "notNull": false,
58
+ "autoincrement": false
59
+ },
60
+ "scopes": {
61
+ "name": "scopes",
62
+ "type": "text",
63
+ "primaryKey": false,
64
+ "notNull": false,
65
+ "autoincrement": false
66
+ },
67
+ "last_used_at": {
68
+ "name": "last_used_at",
69
+ "type": "integer",
70
+ "primaryKey": false,
71
+ "notNull": false,
72
+ "autoincrement": false
73
+ },
74
+ "created_at": {
75
+ "name": "created_at",
76
+ "type": "integer",
77
+ "primaryKey": false,
78
+ "notNull": false,
79
+ "autoincrement": false
80
+ },
81
+ "revoked_at": {
82
+ "name": "revoked_at",
83
+ "type": "integer",
84
+ "primaryKey": false,
85
+ "notNull": false,
86
+ "autoincrement": false
87
+ }
88
+ },
89
+ "indexes": {
90
+ "uq_api_keys_hash_active": {
91
+ "name": "uq_api_keys_hash_active",
92
+ "columns": [
93
+ "key_hash"
94
+ ],
95
+ "isUnique": true,
96
+ "where": "revoked_at IS NULL"
97
+ },
98
+ "idx_api_keys_tenant": {
99
+ "name": "idx_api_keys_tenant",
100
+ "columns": [
101
+ "tenant_id"
102
+ ],
103
+ "isUnique": false
104
+ }
105
+ },
106
+ "foreignKeys": {
107
+ "api_keys_tenant_id_tenants_id_fk": {
108
+ "name": "api_keys_tenant_id_tenants_id_fk",
109
+ "tableFrom": "api_keys",
110
+ "tableTo": "tenants",
111
+ "columnsFrom": [
112
+ "tenant_id"
113
+ ],
114
+ "columnsTo": [
115
+ "id"
116
+ ],
117
+ "onDelete": "no action",
118
+ "onUpdate": "no action"
119
+ }
120
+ },
121
+ "compositePrimaryKeys": {},
122
+ "uniqueConstraints": {},
123
+ "checkConstraints": {}
124
+ },
125
+ "claim_tokens": {
126
+ "name": "claim_tokens",
127
+ "columns": {
128
+ "id": {
129
+ "name": "id",
130
+ "type": "text",
131
+ "primaryKey": true,
132
+ "notNull": true,
133
+ "autoincrement": false
134
+ },
135
+ "token_hash": {
136
+ "name": "token_hash",
137
+ "type": "text",
138
+ "primaryKey": false,
139
+ "notNull": true,
140
+ "autoincrement": false
141
+ },
142
+ "expires_at": {
143
+ "name": "expires_at",
144
+ "type": "integer",
145
+ "primaryKey": false,
146
+ "notNull": true,
147
+ "autoincrement": false
148
+ },
149
+ "consumed_at": {
150
+ "name": "consumed_at",
151
+ "type": "integer",
152
+ "primaryKey": false,
153
+ "notNull": false,
154
+ "autoincrement": false
155
+ },
156
+ "created_at": {
157
+ "name": "created_at",
158
+ "type": "integer",
159
+ "primaryKey": false,
160
+ "notNull": false,
161
+ "autoincrement": false
162
+ }
163
+ },
164
+ "indexes": {
165
+ "uq_claim_tokens_token_hash": {
166
+ "name": "uq_claim_tokens_token_hash",
167
+ "columns": [
168
+ "token_hash"
169
+ ],
170
+ "isUnique": true
171
+ }
172
+ },
173
+ "foreignKeys": {},
174
+ "compositePrimaryKeys": {},
175
+ "uniqueConstraints": {},
176
+ "checkConstraints": {}
177
+ },
178
+ "contact_conflicts": {
179
+ "name": "contact_conflicts",
180
+ "columns": {
181
+ "id": {
182
+ "name": "id",
183
+ "type": "text",
184
+ "primaryKey": true,
185
+ "notNull": true,
186
+ "autoincrement": false
187
+ },
188
+ "tenant_id": {
189
+ "name": "tenant_id",
190
+ "type": "text",
191
+ "primaryKey": false,
192
+ "notNull": true,
193
+ "autoincrement": false
194
+ },
195
+ "contact_id": {
196
+ "name": "contact_id",
197
+ "type": "text",
198
+ "primaryKey": false,
199
+ "notNull": true,
200
+ "autoincrement": false
201
+ },
202
+ "field": {
203
+ "name": "field",
204
+ "type": "text",
205
+ "primaryKey": false,
206
+ "notNull": true,
207
+ "autoincrement": false
208
+ },
209
+ "rejected_value": {
210
+ "name": "rejected_value",
211
+ "type": "text",
212
+ "primaryKey": false,
213
+ "notNull": true,
214
+ "autoincrement": false
215
+ },
216
+ "event_id": {
217
+ "name": "event_id",
218
+ "type": "text",
219
+ "primaryKey": false,
220
+ "notNull": true,
221
+ "autoincrement": false
222
+ },
223
+ "created_at": {
224
+ "name": "created_at",
225
+ "type": "integer",
226
+ "primaryKey": false,
227
+ "notNull": false,
228
+ "autoincrement": false
229
+ }
230
+ },
231
+ "indexes": {
232
+ "idx_contact_conflicts_tenant": {
233
+ "name": "idx_contact_conflicts_tenant",
234
+ "columns": [
235
+ "tenant_id",
236
+ "created_at"
237
+ ],
238
+ "isUnique": false
239
+ },
240
+ "idx_contact_conflicts_contact": {
241
+ "name": "idx_contact_conflicts_contact",
242
+ "columns": [
243
+ "contact_id"
244
+ ],
245
+ "isUnique": false
246
+ }
247
+ },
248
+ "foreignKeys": {
249
+ "contact_conflicts_tenant_id_tenants_id_fk": {
250
+ "name": "contact_conflicts_tenant_id_tenants_id_fk",
251
+ "tableFrom": "contact_conflicts",
252
+ "tableTo": "tenants",
253
+ "columnsFrom": [
254
+ "tenant_id"
255
+ ],
256
+ "columnsTo": [
257
+ "id"
258
+ ],
259
+ "onDelete": "no action",
260
+ "onUpdate": "no action"
261
+ },
262
+ "contact_conflicts_contact_id_contacts_id_fk": {
263
+ "name": "contact_conflicts_contact_id_contacts_id_fk",
264
+ "tableFrom": "contact_conflicts",
265
+ "tableTo": "contacts",
266
+ "columnsFrom": [
267
+ "contact_id"
268
+ ],
269
+ "columnsTo": [
270
+ "id"
271
+ ],
272
+ "onDelete": "no action",
273
+ "onUpdate": "no action"
274
+ }
275
+ },
276
+ "compositePrimaryKeys": {},
277
+ "uniqueConstraints": {},
278
+ "checkConstraints": {}
279
+ },
280
+ "contact_dates": {
281
+ "name": "contact_dates",
282
+ "columns": {
283
+ "tenant_id": {
284
+ "name": "tenant_id",
285
+ "type": "text",
286
+ "primaryKey": false,
287
+ "notNull": true,
288
+ "autoincrement": false
289
+ },
290
+ "contact_id": {
291
+ "name": "contact_id",
292
+ "type": "text",
293
+ "primaryKey": false,
294
+ "notNull": true,
295
+ "autoincrement": false
296
+ },
297
+ "property": {
298
+ "name": "property",
299
+ "type": "text",
300
+ "primaryKey": false,
301
+ "notNull": true,
302
+ "autoincrement": false
303
+ },
304
+ "value": {
305
+ "name": "value",
306
+ "type": "integer",
307
+ "primaryKey": false,
308
+ "notNull": true,
309
+ "autoincrement": false
310
+ },
311
+ "updated_at": {
312
+ "name": "updated_at",
313
+ "type": "integer",
314
+ "primaryKey": false,
315
+ "notNull": false,
316
+ "autoincrement": false
317
+ }
318
+ },
319
+ "indexes": {
320
+ "idx_contact_dates_scan": {
321
+ "name": "idx_contact_dates_scan",
322
+ "columns": [
323
+ "tenant_id",
324
+ "property",
325
+ "value"
326
+ ],
327
+ "isUnique": false
328
+ }
329
+ },
330
+ "foreignKeys": {
331
+ "contact_dates_tenant_id_tenants_id_fk": {
332
+ "name": "contact_dates_tenant_id_tenants_id_fk",
333
+ "tableFrom": "contact_dates",
334
+ "tableTo": "tenants",
335
+ "columnsFrom": [
336
+ "tenant_id"
337
+ ],
338
+ "columnsTo": [
339
+ "id"
340
+ ],
341
+ "onDelete": "no action",
342
+ "onUpdate": "no action"
343
+ },
344
+ "contact_dates_contact_id_contacts_id_fk": {
345
+ "name": "contact_dates_contact_id_contacts_id_fk",
346
+ "tableFrom": "contact_dates",
347
+ "tableTo": "contacts",
348
+ "columnsFrom": [
349
+ "contact_id"
350
+ ],
351
+ "columnsTo": [
352
+ "id"
353
+ ],
354
+ "onDelete": "no action",
355
+ "onUpdate": "no action"
356
+ }
357
+ },
358
+ "compositePrimaryKeys": {
359
+ "contact_dates_pkey": {
360
+ "columns": [
361
+ "tenant_id",
362
+ "contact_id",
363
+ "property"
364
+ ],
365
+ "name": "contact_dates_pkey"
366
+ }
367
+ },
368
+ "uniqueConstraints": {},
369
+ "checkConstraints": {}
370
+ },
371
+ "contact_topics": {
372
+ "name": "contact_topics",
373
+ "columns": {
374
+ "tenant_id": {
375
+ "name": "tenant_id",
376
+ "type": "text",
377
+ "primaryKey": false,
378
+ "notNull": true,
379
+ "autoincrement": false
380
+ },
381
+ "contact_id": {
382
+ "name": "contact_id",
383
+ "type": "text",
384
+ "primaryKey": false,
385
+ "notNull": true,
386
+ "autoincrement": false
387
+ },
388
+ "topic_id": {
389
+ "name": "topic_id",
390
+ "type": "text",
391
+ "primaryKey": false,
392
+ "notNull": true,
393
+ "autoincrement": false
394
+ },
395
+ "status": {
396
+ "name": "status",
397
+ "type": "text",
398
+ "primaryKey": false,
399
+ "notNull": true,
400
+ "autoincrement": false
401
+ },
402
+ "updated_at": {
403
+ "name": "updated_at",
404
+ "type": "integer",
405
+ "primaryKey": false,
406
+ "notNull": false,
407
+ "autoincrement": false
408
+ },
409
+ "source": {
410
+ "name": "source",
411
+ "type": "text",
412
+ "primaryKey": false,
413
+ "notNull": false,
414
+ "autoincrement": false
415
+ }
416
+ },
417
+ "indexes": {
418
+ "idx_contact_topics_tenant_topic": {
419
+ "name": "idx_contact_topics_tenant_topic",
420
+ "columns": [
421
+ "tenant_id",
422
+ "topic_id"
423
+ ],
424
+ "isUnique": false
425
+ }
426
+ },
427
+ "foreignKeys": {
428
+ "contact_topics_tenant_id_tenants_id_fk": {
429
+ "name": "contact_topics_tenant_id_tenants_id_fk",
430
+ "tableFrom": "contact_topics",
431
+ "tableTo": "tenants",
432
+ "columnsFrom": [
433
+ "tenant_id"
434
+ ],
435
+ "columnsTo": [
436
+ "id"
437
+ ],
438
+ "onDelete": "no action",
439
+ "onUpdate": "no action"
440
+ },
441
+ "contact_topics_contact_id_contacts_id_fk": {
442
+ "name": "contact_topics_contact_id_contacts_id_fk",
443
+ "tableFrom": "contact_topics",
444
+ "tableTo": "contacts",
445
+ "columnsFrom": [
446
+ "contact_id"
447
+ ],
448
+ "columnsTo": [
449
+ "id"
450
+ ],
451
+ "onDelete": "no action",
452
+ "onUpdate": "no action"
453
+ },
454
+ "contact_topics_topic_id_topics_id_fk": {
455
+ "name": "contact_topics_topic_id_topics_id_fk",
456
+ "tableFrom": "contact_topics",
457
+ "tableTo": "topics",
458
+ "columnsFrom": [
459
+ "topic_id"
460
+ ],
461
+ "columnsTo": [
462
+ "id"
463
+ ],
464
+ "onDelete": "no action",
465
+ "onUpdate": "no action"
466
+ }
467
+ },
468
+ "compositePrimaryKeys": {
469
+ "contact_topics_pkey": {
470
+ "columns": [
471
+ "contact_id",
472
+ "topic_id"
473
+ ],
474
+ "name": "contact_topics_pkey"
475
+ }
476
+ },
477
+ "uniqueConstraints": {},
478
+ "checkConstraints": {}
479
+ },
480
+ "contacts": {
481
+ "name": "contacts",
482
+ "columns": {
483
+ "id": {
484
+ "name": "id",
485
+ "type": "text",
486
+ "primaryKey": true,
487
+ "notNull": true,
488
+ "autoincrement": false
489
+ },
490
+ "tenant_id": {
491
+ "name": "tenant_id",
492
+ "type": "text",
493
+ "primaryKey": false,
494
+ "notNull": true,
495
+ "autoincrement": false
496
+ },
497
+ "external_id": {
498
+ "name": "external_id",
499
+ "type": "text",
500
+ "primaryKey": false,
501
+ "notNull": true,
502
+ "autoincrement": false
503
+ },
504
+ "email": {
505
+ "name": "email",
506
+ "type": "text",
507
+ "primaryKey": false,
508
+ "notNull": false,
509
+ "autoincrement": false
510
+ },
511
+ "name": {
512
+ "name": "name",
513
+ "type": "text",
514
+ "primaryKey": false,
515
+ "notNull": false,
516
+ "autoincrement": false
517
+ },
518
+ "company": {
519
+ "name": "company",
520
+ "type": "text",
521
+ "primaryKey": false,
522
+ "notNull": false,
523
+ "autoincrement": false
524
+ },
525
+ "properties": {
526
+ "name": "properties",
527
+ "type": "text",
528
+ "primaryKey": false,
529
+ "notNull": false,
530
+ "autoincrement": false
531
+ },
532
+ "lifecycle_state": {
533
+ "name": "lifecycle_state",
534
+ "type": "text",
535
+ "primaryKey": false,
536
+ "notNull": true,
537
+ "autoincrement": false
538
+ },
539
+ "engagement_depth": {
540
+ "name": "engagement_depth",
541
+ "type": "text",
542
+ "primaryKey": false,
543
+ "notNull": false,
544
+ "autoincrement": false
545
+ },
546
+ "payment_status": {
547
+ "name": "payment_status",
548
+ "type": "text",
549
+ "primaryKey": false,
550
+ "notNull": false,
551
+ "autoincrement": false,
552
+ "default": "'free'"
553
+ },
554
+ "first_seen_at": {
555
+ "name": "first_seen_at",
556
+ "type": "integer",
557
+ "primaryKey": false,
558
+ "notNull": false,
559
+ "autoincrement": false
560
+ },
561
+ "last_seen_at": {
562
+ "name": "last_seen_at",
563
+ "type": "integer",
564
+ "primaryKey": false,
565
+ "notNull": false,
566
+ "autoincrement": false
567
+ },
568
+ "activated_at": {
569
+ "name": "activated_at",
570
+ "type": "integer",
571
+ "primaryKey": false,
572
+ "notNull": false,
573
+ "autoincrement": false
574
+ },
575
+ "created_at": {
576
+ "name": "created_at",
577
+ "type": "integer",
578
+ "primaryKey": false,
579
+ "notNull": false,
580
+ "autoincrement": false
581
+ },
582
+ "event_count_bucket_current": {
583
+ "name": "event_count_bucket_current",
584
+ "type": "integer",
585
+ "primaryKey": false,
586
+ "notNull": false,
587
+ "autoincrement": false,
588
+ "default": 0
589
+ },
590
+ "event_count_bucket_prev": {
591
+ "name": "event_count_bucket_prev",
592
+ "type": "integer",
593
+ "primaryKey": false,
594
+ "notNull": false,
595
+ "autoincrement": false,
596
+ "default": 0
597
+ },
598
+ "last_counter_reset_at": {
599
+ "name": "last_counter_reset_at",
600
+ "type": "integer",
601
+ "primaryKey": false,
602
+ "notNull": false,
603
+ "autoincrement": false
604
+ }
605
+ },
606
+ "indexes": {
607
+ "uq_contacts_tenant_external_id": {
608
+ "name": "uq_contacts_tenant_external_id",
609
+ "columns": [
610
+ "tenant_id",
611
+ "external_id"
612
+ ],
613
+ "isUnique": true
614
+ },
615
+ "uq_contacts_tenant_email": {
616
+ "name": "uq_contacts_tenant_email",
617
+ "columns": [
618
+ "tenant_id",
619
+ "email"
620
+ ],
621
+ "isUnique": true,
622
+ "where": "email IS NOT NULL"
623
+ },
624
+ "idx_contacts_tenant_state": {
625
+ "name": "idx_contacts_tenant_state",
626
+ "columns": [
627
+ "tenant_id",
628
+ "lifecycle_state"
629
+ ],
630
+ "isUnique": false
631
+ },
632
+ "idx_contacts_last_seen": {
633
+ "name": "idx_contacts_last_seen",
634
+ "columns": [
635
+ "tenant_id",
636
+ "last_seen_at"
637
+ ],
638
+ "isUnique": false
639
+ },
640
+ "idx_contacts_tenant_created": {
641
+ "name": "idx_contacts_tenant_created",
642
+ "columns": [
643
+ "tenant_id",
644
+ "created_at",
645
+ "id"
646
+ ],
647
+ "isUnique": false
648
+ }
649
+ },
650
+ "foreignKeys": {
651
+ "contacts_tenant_id_tenants_id_fk": {
652
+ "name": "contacts_tenant_id_tenants_id_fk",
653
+ "tableFrom": "contacts",
654
+ "tableTo": "tenants",
655
+ "columnsFrom": [
656
+ "tenant_id"
657
+ ],
658
+ "columnsTo": [
659
+ "id"
660
+ ],
661
+ "onDelete": "no action",
662
+ "onUpdate": "no action"
663
+ }
664
+ },
665
+ "compositePrimaryKeys": {},
666
+ "uniqueConstraints": {},
667
+ "checkConstraints": {}
668
+ },
669
+ "events": {
670
+ "name": "events",
671
+ "columns": {
672
+ "id": {
673
+ "name": "id",
674
+ "type": "text",
675
+ "primaryKey": true,
676
+ "notNull": true,
677
+ "autoincrement": false
678
+ },
679
+ "tenant_id": {
680
+ "name": "tenant_id",
681
+ "type": "text",
682
+ "primaryKey": false,
683
+ "notNull": true,
684
+ "autoincrement": false
685
+ },
686
+ "contact_id": {
687
+ "name": "contact_id",
688
+ "type": "text",
689
+ "primaryKey": false,
690
+ "notNull": true,
691
+ "autoincrement": false
692
+ },
693
+ "type": {
694
+ "name": "type",
695
+ "type": "text",
696
+ "primaryKey": false,
697
+ "notNull": true,
698
+ "autoincrement": false
699
+ },
700
+ "event_name": {
701
+ "name": "event_name",
702
+ "type": "text",
703
+ "primaryKey": false,
704
+ "notNull": false,
705
+ "autoincrement": false
706
+ },
707
+ "properties": {
708
+ "name": "properties",
709
+ "type": "text",
710
+ "primaryKey": false,
711
+ "notNull": false,
712
+ "autoincrement": false
713
+ },
714
+ "context": {
715
+ "name": "context",
716
+ "type": "text",
717
+ "primaryKey": false,
718
+ "notNull": false,
719
+ "autoincrement": false
720
+ },
721
+ "message_id": {
722
+ "name": "message_id",
723
+ "type": "text",
724
+ "primaryKey": false,
725
+ "notNull": false,
726
+ "autoincrement": false
727
+ },
728
+ "timestamp": {
729
+ "name": "timestamp",
730
+ "type": "integer",
731
+ "primaryKey": false,
732
+ "notNull": true,
733
+ "autoincrement": false
734
+ },
735
+ "received_at": {
736
+ "name": "received_at",
737
+ "type": "integer",
738
+ "primaryKey": false,
739
+ "notNull": true,
740
+ "autoincrement": false
741
+ }
742
+ },
743
+ "indexes": {
744
+ "idx_events_contact_time": {
745
+ "name": "idx_events_contact_time",
746
+ "columns": [
747
+ "contact_id",
748
+ "timestamp"
749
+ ],
750
+ "isUnique": false
751
+ },
752
+ "idx_events_tenant_name": {
753
+ "name": "idx_events_tenant_name",
754
+ "columns": [
755
+ "tenant_id",
756
+ "event_name",
757
+ "timestamp"
758
+ ],
759
+ "isUnique": false
760
+ },
761
+ "idx_events_tenant_time": {
762
+ "name": "idx_events_tenant_time",
763
+ "columns": [
764
+ "tenant_id",
765
+ "timestamp"
766
+ ],
767
+ "isUnique": false
768
+ },
769
+ "idx_events_dedup_lookup": {
770
+ "name": "idx_events_dedup_lookup",
771
+ "columns": [
772
+ "tenant_id",
773
+ "message_id"
774
+ ],
775
+ "isUnique": false,
776
+ "where": "message_id IS NOT NULL"
777
+ }
778
+ },
779
+ "foreignKeys": {
780
+ "events_tenant_id_tenants_id_fk": {
781
+ "name": "events_tenant_id_tenants_id_fk",
782
+ "tableFrom": "events",
783
+ "tableTo": "tenants",
784
+ "columnsFrom": [
785
+ "tenant_id"
786
+ ],
787
+ "columnsTo": [
788
+ "id"
789
+ ],
790
+ "onDelete": "no action",
791
+ "onUpdate": "no action"
792
+ },
793
+ "events_contact_id_contacts_id_fk": {
794
+ "name": "events_contact_id_contacts_id_fk",
795
+ "tableFrom": "events",
796
+ "tableTo": "contacts",
797
+ "columnsFrom": [
798
+ "contact_id"
799
+ ],
800
+ "columnsTo": [
801
+ "id"
802
+ ],
803
+ "onDelete": "no action",
804
+ "onUpdate": "no action"
805
+ }
806
+ },
807
+ "compositePrimaryKeys": {},
808
+ "uniqueConstraints": {},
809
+ "checkConstraints": {}
810
+ },
811
+ "flow_memberships": {
812
+ "name": "flow_memberships",
813
+ "columns": {
814
+ "id": {
815
+ "name": "id",
816
+ "type": "text",
817
+ "primaryKey": true,
818
+ "notNull": true,
819
+ "autoincrement": false
820
+ },
821
+ "tenant_id": {
822
+ "name": "tenant_id",
823
+ "type": "text",
824
+ "primaryKey": false,
825
+ "notNull": true,
826
+ "autoincrement": false
827
+ },
828
+ "contact_id": {
829
+ "name": "contact_id",
830
+ "type": "text",
831
+ "primaryKey": false,
832
+ "notNull": true,
833
+ "autoincrement": false
834
+ },
835
+ "flow_id": {
836
+ "name": "flow_id",
837
+ "type": "text",
838
+ "primaryKey": false,
839
+ "notNull": true,
840
+ "autoincrement": false
841
+ },
842
+ "current_step": {
843
+ "name": "current_step",
844
+ "type": "integer",
845
+ "primaryKey": false,
846
+ "notNull": true,
847
+ "autoincrement": false,
848
+ "default": 1
849
+ },
850
+ "status": {
851
+ "name": "status",
852
+ "type": "text",
853
+ "primaryKey": false,
854
+ "notNull": true,
855
+ "autoincrement": false,
856
+ "default": "'active'"
857
+ },
858
+ "entered_at": {
859
+ "name": "entered_at",
860
+ "type": "integer",
861
+ "primaryKey": false,
862
+ "notNull": true,
863
+ "autoincrement": false
864
+ },
865
+ "completed_at": {
866
+ "name": "completed_at",
867
+ "type": "integer",
868
+ "primaryKey": false,
869
+ "notNull": false,
870
+ "autoincrement": false
871
+ },
872
+ "exited_at": {
873
+ "name": "exited_at",
874
+ "type": "integer",
875
+ "primaryKey": false,
876
+ "notNull": false,
877
+ "autoincrement": false
878
+ },
879
+ "exit_reason": {
880
+ "name": "exit_reason",
881
+ "type": "text",
882
+ "primaryKey": false,
883
+ "notNull": false,
884
+ "autoincrement": false
885
+ },
886
+ "condition_error": {
887
+ "name": "condition_error",
888
+ "type": "text",
889
+ "primaryKey": false,
890
+ "notNull": false,
891
+ "autoincrement": false
892
+ },
893
+ "anchor_at": {
894
+ "name": "anchor_at",
895
+ "type": "integer",
896
+ "primaryKey": false,
897
+ "notNull": false,
898
+ "autoincrement": false
899
+ },
900
+ "trigger_properties": {
901
+ "name": "trigger_properties",
902
+ "type": "text",
903
+ "primaryKey": false,
904
+ "notNull": false,
905
+ "autoincrement": false
906
+ }
907
+ },
908
+ "indexes": {
909
+ "uq_flow_membership_active": {
910
+ "name": "uq_flow_membership_active",
911
+ "columns": [
912
+ "contact_id",
913
+ "flow_id"
914
+ ],
915
+ "isUnique": true,
916
+ "where": "status = 'active'"
917
+ },
918
+ "uq_flow_membership_anchor": {
919
+ "name": "uq_flow_membership_anchor",
920
+ "columns": [
921
+ "tenant_id",
922
+ "flow_id",
923
+ "contact_id",
924
+ "anchor_at"
925
+ ],
926
+ "isUnique": true,
927
+ "where": "anchor_at IS NOT NULL"
928
+ },
929
+ "idx_flow_members_contact": {
930
+ "name": "idx_flow_members_contact",
931
+ "columns": [
932
+ "contact_id",
933
+ "status"
934
+ ],
935
+ "isUnique": false
936
+ },
937
+ "idx_flow_members_flow": {
938
+ "name": "idx_flow_members_flow",
939
+ "columns": [
940
+ "flow_id",
941
+ "status",
942
+ "current_step"
943
+ ],
944
+ "isUnique": false
945
+ }
946
+ },
947
+ "foreignKeys": {
948
+ "flow_memberships_tenant_id_tenants_id_fk": {
949
+ "name": "flow_memberships_tenant_id_tenants_id_fk",
950
+ "tableFrom": "flow_memberships",
951
+ "tableTo": "tenants",
952
+ "columnsFrom": [
953
+ "tenant_id"
954
+ ],
955
+ "columnsTo": [
956
+ "id"
957
+ ],
958
+ "onDelete": "no action",
959
+ "onUpdate": "no action"
960
+ },
961
+ "flow_memberships_contact_id_contacts_id_fk": {
962
+ "name": "flow_memberships_contact_id_contacts_id_fk",
963
+ "tableFrom": "flow_memberships",
964
+ "tableTo": "contacts",
965
+ "columnsFrom": [
966
+ "contact_id"
967
+ ],
968
+ "columnsTo": [
969
+ "id"
970
+ ],
971
+ "onDelete": "no action",
972
+ "onUpdate": "no action"
973
+ },
974
+ "flow_memberships_flow_id_flows_id_fk": {
975
+ "name": "flow_memberships_flow_id_flows_id_fk",
976
+ "tableFrom": "flow_memberships",
977
+ "tableTo": "flows",
978
+ "columnsFrom": [
979
+ "flow_id"
980
+ ],
981
+ "columnsTo": [
982
+ "id"
983
+ ],
984
+ "onDelete": "no action",
985
+ "onUpdate": "no action"
986
+ }
987
+ },
988
+ "compositePrimaryKeys": {},
989
+ "uniqueConstraints": {},
990
+ "checkConstraints": {}
991
+ },
992
+ "flows": {
993
+ "name": "flows",
994
+ "columns": {
995
+ "id": {
996
+ "name": "id",
997
+ "type": "text",
998
+ "primaryKey": true,
999
+ "notNull": true,
1000
+ "autoincrement": false
1001
+ },
1002
+ "tenant_id": {
1003
+ "name": "tenant_id",
1004
+ "type": "text",
1005
+ "primaryKey": false,
1006
+ "notNull": true,
1007
+ "autoincrement": false
1008
+ },
1009
+ "name": {
1010
+ "name": "name",
1011
+ "type": "text",
1012
+ "primaryKey": false,
1013
+ "notNull": true,
1014
+ "autoincrement": false
1015
+ },
1016
+ "description": {
1017
+ "name": "description",
1018
+ "type": "text",
1019
+ "primaryKey": false,
1020
+ "notNull": false,
1021
+ "autoincrement": false
1022
+ },
1023
+ "priority": {
1024
+ "name": "priority",
1025
+ "type": "integer",
1026
+ "primaryKey": false,
1027
+ "notNull": false,
1028
+ "autoincrement": false,
1029
+ "default": 0
1030
+ },
1031
+ "trigger_type": {
1032
+ "name": "trigger_type",
1033
+ "type": "text",
1034
+ "primaryKey": false,
1035
+ "notNull": true,
1036
+ "autoincrement": false
1037
+ },
1038
+ "trigger_config": {
1039
+ "name": "trigger_config",
1040
+ "type": "text",
1041
+ "primaryKey": false,
1042
+ "notNull": true,
1043
+ "autoincrement": false
1044
+ },
1045
+ "steps": {
1046
+ "name": "steps",
1047
+ "type": "text",
1048
+ "primaryKey": false,
1049
+ "notNull": true,
1050
+ "autoincrement": false
1051
+ },
1052
+ "source": {
1053
+ "name": "source",
1054
+ "type": "text",
1055
+ "primaryKey": false,
1056
+ "notNull": false,
1057
+ "autoincrement": false,
1058
+ "default": "'manual'"
1059
+ },
1060
+ "content_mode": {
1061
+ "name": "content_mode",
1062
+ "type": "text",
1063
+ "primaryKey": false,
1064
+ "notNull": false,
1065
+ "autoincrement": false,
1066
+ "default": "'ai_drafted'"
1067
+ },
1068
+ "status": {
1069
+ "name": "status",
1070
+ "type": "text",
1071
+ "primaryKey": false,
1072
+ "notNull": false,
1073
+ "autoincrement": false,
1074
+ "default": "'draft'"
1075
+ },
1076
+ "approval_mode": {
1077
+ "name": "approval_mode",
1078
+ "type": "text",
1079
+ "primaryKey": false,
1080
+ "notNull": false,
1081
+ "autoincrement": false,
1082
+ "default": "'require'"
1083
+ },
1084
+ "flow_class": {
1085
+ "name": "flow_class",
1086
+ "type": "text",
1087
+ "primaryKey": false,
1088
+ "notNull": true,
1089
+ "autoincrement": false,
1090
+ "default": "'nurture'"
1091
+ },
1092
+ "reentry_policy": {
1093
+ "name": "reentry_policy",
1094
+ "type": "text",
1095
+ "primaryKey": false,
1096
+ "notNull": true,
1097
+ "autoincrement": false,
1098
+ "default": "'cooldown'"
1099
+ },
1100
+ "reentry_cooldown_days": {
1101
+ "name": "reentry_cooldown_days",
1102
+ "type": "integer",
1103
+ "primaryKey": false,
1104
+ "notNull": false,
1105
+ "autoincrement": false,
1106
+ "default": 30
1107
+ },
1108
+ "prompt_source": {
1109
+ "name": "prompt_source",
1110
+ "type": "text",
1111
+ "primaryKey": false,
1112
+ "notNull": false,
1113
+ "autoincrement": false
1114
+ },
1115
+ "compiled_plan": {
1116
+ "name": "compiled_plan",
1117
+ "type": "text",
1118
+ "primaryKey": false,
1119
+ "notNull": false,
1120
+ "autoincrement": false
1121
+ },
1122
+ "compiled_at": {
1123
+ "name": "compiled_at",
1124
+ "type": "integer",
1125
+ "primaryKey": false,
1126
+ "notNull": false,
1127
+ "autoincrement": false
1128
+ },
1129
+ "compile_status": {
1130
+ "name": "compile_status",
1131
+ "type": "text",
1132
+ "primaryKey": false,
1133
+ "notNull": false,
1134
+ "autoincrement": false
1135
+ },
1136
+ "compile_error": {
1137
+ "name": "compile_error",
1138
+ "type": "text",
1139
+ "primaryKey": false,
1140
+ "notNull": false,
1141
+ "autoincrement": false
1142
+ },
1143
+ "topic_id": {
1144
+ "name": "topic_id",
1145
+ "type": "text",
1146
+ "primaryKey": false,
1147
+ "notNull": false,
1148
+ "autoincrement": false
1149
+ },
1150
+ "slug": {
1151
+ "name": "slug",
1152
+ "type": "text",
1153
+ "primaryKey": false,
1154
+ "notNull": false,
1155
+ "autoincrement": false
1156
+ },
1157
+ "created_at": {
1158
+ "name": "created_at",
1159
+ "type": "integer",
1160
+ "primaryKey": false,
1161
+ "notNull": false,
1162
+ "autoincrement": false
1163
+ },
1164
+ "updated_at": {
1165
+ "name": "updated_at",
1166
+ "type": "integer",
1167
+ "primaryKey": false,
1168
+ "notNull": false,
1169
+ "autoincrement": false
1170
+ }
1171
+ },
1172
+ "indexes": {
1173
+ "uq_flows_tenant_slug": {
1174
+ "name": "uq_flows_tenant_slug",
1175
+ "columns": [
1176
+ "tenant_id",
1177
+ "slug"
1178
+ ],
1179
+ "isUnique": true,
1180
+ "where": "slug IS NOT NULL"
1181
+ }
1182
+ },
1183
+ "foreignKeys": {
1184
+ "flows_tenant_id_tenants_id_fk": {
1185
+ "name": "flows_tenant_id_tenants_id_fk",
1186
+ "tableFrom": "flows",
1187
+ "tableTo": "tenants",
1188
+ "columnsFrom": [
1189
+ "tenant_id"
1190
+ ],
1191
+ "columnsTo": [
1192
+ "id"
1193
+ ],
1194
+ "onDelete": "no action",
1195
+ "onUpdate": "no action"
1196
+ },
1197
+ "flows_topic_id_topics_id_fk": {
1198
+ "name": "flows_topic_id_topics_id_fk",
1199
+ "tableFrom": "flows",
1200
+ "tableTo": "topics",
1201
+ "columnsFrom": [
1202
+ "topic_id"
1203
+ ],
1204
+ "columnsTo": [
1205
+ "id"
1206
+ ],
1207
+ "onDelete": "no action",
1208
+ "onUpdate": "no action"
1209
+ }
1210
+ },
1211
+ "compositePrimaryKeys": {},
1212
+ "uniqueConstraints": {},
1213
+ "checkConstraints": {}
1214
+ },
1215
+ "instance_settings": {
1216
+ "name": "instance_settings",
1217
+ "columns": {
1218
+ "key": {
1219
+ "name": "key",
1220
+ "type": "text",
1221
+ "primaryKey": true,
1222
+ "notNull": true,
1223
+ "autoincrement": false
1224
+ },
1225
+ "value": {
1226
+ "name": "value",
1227
+ "type": "text",
1228
+ "primaryKey": false,
1229
+ "notNull": true,
1230
+ "autoincrement": false
1231
+ },
1232
+ "updated_at": {
1233
+ "name": "updated_at",
1234
+ "type": "integer",
1235
+ "primaryKey": false,
1236
+ "notNull": false,
1237
+ "autoincrement": false
1238
+ }
1239
+ },
1240
+ "indexes": {},
1241
+ "foreignKeys": {},
1242
+ "compositePrimaryKeys": {},
1243
+ "uniqueConstraints": {},
1244
+ "checkConstraints": {}
1245
+ },
1246
+ "invites": {
1247
+ "name": "invites",
1248
+ "columns": {
1249
+ "id": {
1250
+ "name": "id",
1251
+ "type": "text",
1252
+ "primaryKey": true,
1253
+ "notNull": true,
1254
+ "autoincrement": false
1255
+ },
1256
+ "tenant_id": {
1257
+ "name": "tenant_id",
1258
+ "type": "text",
1259
+ "primaryKey": false,
1260
+ "notNull": true,
1261
+ "autoincrement": false
1262
+ },
1263
+ "email": {
1264
+ "name": "email",
1265
+ "type": "text",
1266
+ "primaryKey": false,
1267
+ "notNull": true,
1268
+ "autoincrement": false
1269
+ },
1270
+ "role": {
1271
+ "name": "role",
1272
+ "type": "text",
1273
+ "primaryKey": false,
1274
+ "notNull": true,
1275
+ "autoincrement": false,
1276
+ "default": "'member'"
1277
+ },
1278
+ "token_hash": {
1279
+ "name": "token_hash",
1280
+ "type": "text",
1281
+ "primaryKey": false,
1282
+ "notNull": true,
1283
+ "autoincrement": false
1284
+ },
1285
+ "invited_by": {
1286
+ "name": "invited_by",
1287
+ "type": "text",
1288
+ "primaryKey": false,
1289
+ "notNull": true,
1290
+ "autoincrement": false
1291
+ },
1292
+ "expires_at": {
1293
+ "name": "expires_at",
1294
+ "type": "integer",
1295
+ "primaryKey": false,
1296
+ "notNull": true,
1297
+ "autoincrement": false
1298
+ },
1299
+ "accepted_at": {
1300
+ "name": "accepted_at",
1301
+ "type": "integer",
1302
+ "primaryKey": false,
1303
+ "notNull": false,
1304
+ "autoincrement": false
1305
+ },
1306
+ "created_at": {
1307
+ "name": "created_at",
1308
+ "type": "integer",
1309
+ "primaryKey": false,
1310
+ "notNull": false,
1311
+ "autoincrement": false
1312
+ }
1313
+ },
1314
+ "indexes": {
1315
+ "idx_invites_token_hash": {
1316
+ "name": "idx_invites_token_hash",
1317
+ "columns": [
1318
+ "token_hash"
1319
+ ],
1320
+ "isUnique": false
1321
+ },
1322
+ "idx_invites_tenant": {
1323
+ "name": "idx_invites_tenant",
1324
+ "columns": [
1325
+ "tenant_id"
1326
+ ],
1327
+ "isUnique": false
1328
+ }
1329
+ },
1330
+ "foreignKeys": {
1331
+ "invites_tenant_id_tenants_id_fk": {
1332
+ "name": "invites_tenant_id_tenants_id_fk",
1333
+ "tableFrom": "invites",
1334
+ "tableTo": "tenants",
1335
+ "columnsFrom": [
1336
+ "tenant_id"
1337
+ ],
1338
+ "columnsTo": [
1339
+ "id"
1340
+ ],
1341
+ "onDelete": "no action",
1342
+ "onUpdate": "no action"
1343
+ },
1344
+ "invites_invited_by_users_id_fk": {
1345
+ "name": "invites_invited_by_users_id_fk",
1346
+ "tableFrom": "invites",
1347
+ "tableTo": "users",
1348
+ "columnsFrom": [
1349
+ "invited_by"
1350
+ ],
1351
+ "columnsTo": [
1352
+ "id"
1353
+ ],
1354
+ "onDelete": "no action",
1355
+ "onUpdate": "no action"
1356
+ }
1357
+ },
1358
+ "compositePrimaryKeys": {},
1359
+ "uniqueConstraints": {},
1360
+ "checkConstraints": {}
1361
+ },
1362
+ "kb_entries": {
1363
+ "name": "kb_entries",
1364
+ "columns": {
1365
+ "id": {
1366
+ "name": "id",
1367
+ "type": "text",
1368
+ "primaryKey": true,
1369
+ "notNull": true,
1370
+ "autoincrement": false
1371
+ },
1372
+ "tenant_id": {
1373
+ "name": "tenant_id",
1374
+ "type": "text",
1375
+ "primaryKey": false,
1376
+ "notNull": true,
1377
+ "autoincrement": false
1378
+ },
1379
+ "title": {
1380
+ "name": "title",
1381
+ "type": "text",
1382
+ "primaryKey": false,
1383
+ "notNull": true,
1384
+ "autoincrement": false
1385
+ },
1386
+ "content": {
1387
+ "name": "content",
1388
+ "type": "text",
1389
+ "primaryKey": false,
1390
+ "notNull": true,
1391
+ "autoincrement": false
1392
+ },
1393
+ "content_type": {
1394
+ "name": "content_type",
1395
+ "type": "text",
1396
+ "primaryKey": false,
1397
+ "notNull": false,
1398
+ "autoincrement": false,
1399
+ "default": "'markdown'"
1400
+ },
1401
+ "source": {
1402
+ "name": "source",
1403
+ "type": "text",
1404
+ "primaryKey": false,
1405
+ "notNull": false,
1406
+ "autoincrement": false,
1407
+ "default": "'manual'"
1408
+ },
1409
+ "source_url": {
1410
+ "name": "source_url",
1411
+ "type": "text",
1412
+ "primaryKey": false,
1413
+ "notNull": false,
1414
+ "autoincrement": false
1415
+ },
1416
+ "tags": {
1417
+ "name": "tags",
1418
+ "type": "text",
1419
+ "primaryKey": false,
1420
+ "notNull": false,
1421
+ "autoincrement": false
1422
+ },
1423
+ "embedding": {
1424
+ "name": "embedding",
1425
+ "type": "text",
1426
+ "primaryKey": false,
1427
+ "notNull": false,
1428
+ "autoincrement": false
1429
+ },
1430
+ "embedding_status": {
1431
+ "name": "embedding_status",
1432
+ "type": "text",
1433
+ "primaryKey": false,
1434
+ "notNull": false,
1435
+ "autoincrement": false
1436
+ },
1437
+ "embedding_error": {
1438
+ "name": "embedding_error",
1439
+ "type": "text",
1440
+ "primaryKey": false,
1441
+ "notNull": false,
1442
+ "autoincrement": false
1443
+ },
1444
+ "is_active": {
1445
+ "name": "is_active",
1446
+ "type": "integer",
1447
+ "primaryKey": false,
1448
+ "notNull": false,
1449
+ "autoincrement": false,
1450
+ "default": true
1451
+ },
1452
+ "category": {
1453
+ "name": "category",
1454
+ "type": "text",
1455
+ "primaryKey": false,
1456
+ "notNull": false,
1457
+ "autoincrement": false
1458
+ },
1459
+ "external_key": {
1460
+ "name": "external_key",
1461
+ "type": "text",
1462
+ "primaryKey": false,
1463
+ "notNull": false,
1464
+ "autoincrement": false
1465
+ },
1466
+ "data": {
1467
+ "name": "data",
1468
+ "type": "text",
1469
+ "primaryKey": false,
1470
+ "notNull": false,
1471
+ "autoincrement": false
1472
+ },
1473
+ "pinned": {
1474
+ "name": "pinned",
1475
+ "type": "integer",
1476
+ "primaryKey": false,
1477
+ "notNull": true,
1478
+ "autoincrement": false,
1479
+ "default": false
1480
+ },
1481
+ "imported_at": {
1482
+ "name": "imported_at",
1483
+ "type": "integer",
1484
+ "primaryKey": false,
1485
+ "notNull": false,
1486
+ "autoincrement": false
1487
+ },
1488
+ "created_at": {
1489
+ "name": "created_at",
1490
+ "type": "integer",
1491
+ "primaryKey": false,
1492
+ "notNull": false,
1493
+ "autoincrement": false
1494
+ },
1495
+ "updated_at": {
1496
+ "name": "updated_at",
1497
+ "type": "integer",
1498
+ "primaryKey": false,
1499
+ "notNull": false,
1500
+ "autoincrement": false
1501
+ }
1502
+ },
1503
+ "indexes": {
1504
+ "idx_kb_entries_tenant_created": {
1505
+ "name": "idx_kb_entries_tenant_created",
1506
+ "columns": [
1507
+ "tenant_id",
1508
+ "created_at",
1509
+ "id"
1510
+ ],
1511
+ "isUnique": false
1512
+ },
1513
+ "uq_kb_entries_external_key": {
1514
+ "name": "uq_kb_entries_external_key",
1515
+ "columns": [
1516
+ "tenant_id",
1517
+ "external_key"
1518
+ ],
1519
+ "isUnique": true,
1520
+ "where": "external_key IS NOT NULL"
1521
+ },
1522
+ "idx_kb_entries_category": {
1523
+ "name": "idx_kb_entries_category",
1524
+ "columns": [
1525
+ "tenant_id",
1526
+ "category"
1527
+ ],
1528
+ "isUnique": false
1529
+ }
1530
+ },
1531
+ "foreignKeys": {
1532
+ "kb_entries_tenant_id_tenants_id_fk": {
1533
+ "name": "kb_entries_tenant_id_tenants_id_fk",
1534
+ "tableFrom": "kb_entries",
1535
+ "tableTo": "tenants",
1536
+ "columnsFrom": [
1537
+ "tenant_id"
1538
+ ],
1539
+ "columnsTo": [
1540
+ "id"
1541
+ ],
1542
+ "onDelete": "no action",
1543
+ "onUpdate": "no action"
1544
+ }
1545
+ },
1546
+ "compositePrimaryKeys": {},
1547
+ "uniqueConstraints": {},
1548
+ "checkConstraints": {}
1549
+ },
1550
+ "lifecycle_messages": {
1551
+ "name": "lifecycle_messages",
1552
+ "columns": {
1553
+ "id": {
1554
+ "name": "id",
1555
+ "type": "text",
1556
+ "primaryKey": true,
1557
+ "notNull": true,
1558
+ "autoincrement": false
1559
+ },
1560
+ "tenant_id": {
1561
+ "name": "tenant_id",
1562
+ "type": "text",
1563
+ "primaryKey": false,
1564
+ "notNull": true,
1565
+ "autoincrement": false
1566
+ },
1567
+ "contact_id": {
1568
+ "name": "contact_id",
1569
+ "type": "text",
1570
+ "primaryKey": false,
1571
+ "notNull": true,
1572
+ "autoincrement": false
1573
+ },
1574
+ "flow_id": {
1575
+ "name": "flow_id",
1576
+ "type": "text",
1577
+ "primaryKey": false,
1578
+ "notNull": true,
1579
+ "autoincrement": false
1580
+ },
1581
+ "membership_id": {
1582
+ "name": "membership_id",
1583
+ "type": "text",
1584
+ "primaryKey": false,
1585
+ "notNull": true,
1586
+ "autoincrement": false
1587
+ },
1588
+ "flow_step_order": {
1589
+ "name": "flow_step_order",
1590
+ "type": "integer",
1591
+ "primaryKey": false,
1592
+ "notNull": false,
1593
+ "autoincrement": false
1594
+ },
1595
+ "status": {
1596
+ "name": "status",
1597
+ "type": "text",
1598
+ "primaryKey": false,
1599
+ "notNull": true,
1600
+ "autoincrement": false
1601
+ },
1602
+ "feedback": {
1603
+ "name": "feedback",
1604
+ "type": "text",
1605
+ "primaryKey": false,
1606
+ "notNull": false,
1607
+ "autoincrement": false
1608
+ },
1609
+ "subject": {
1610
+ "name": "subject",
1611
+ "type": "text",
1612
+ "primaryKey": false,
1613
+ "notNull": false,
1614
+ "autoincrement": false
1615
+ },
1616
+ "body_html": {
1617
+ "name": "body_html",
1618
+ "type": "text",
1619
+ "primaryKey": false,
1620
+ "notNull": false,
1621
+ "autoincrement": false
1622
+ },
1623
+ "body_text": {
1624
+ "name": "body_text",
1625
+ "type": "text",
1626
+ "primaryKey": false,
1627
+ "notNull": false,
1628
+ "autoincrement": false
1629
+ },
1630
+ "brain_reasoning": {
1631
+ "name": "brain_reasoning",
1632
+ "type": "text",
1633
+ "primaryKey": false,
1634
+ "notNull": false,
1635
+ "autoincrement": false
1636
+ },
1637
+ "brain_action_type": {
1638
+ "name": "brain_action_type",
1639
+ "type": "text",
1640
+ "primaryKey": false,
1641
+ "notNull": false,
1642
+ "autoincrement": false
1643
+ },
1644
+ "scheduled_send_at": {
1645
+ "name": "scheduled_send_at",
1646
+ "type": "integer",
1647
+ "primaryKey": false,
1648
+ "notNull": false,
1649
+ "autoincrement": false
1650
+ },
1651
+ "approved_at": {
1652
+ "name": "approved_at",
1653
+ "type": "integer",
1654
+ "primaryKey": false,
1655
+ "notNull": false,
1656
+ "autoincrement": false
1657
+ },
1658
+ "sent_at": {
1659
+ "name": "sent_at",
1660
+ "type": "integer",
1661
+ "primaryKey": false,
1662
+ "notNull": false,
1663
+ "autoincrement": false
1664
+ },
1665
+ "retry_count": {
1666
+ "name": "retry_count",
1667
+ "type": "integer",
1668
+ "primaryKey": false,
1669
+ "notNull": false,
1670
+ "autoincrement": false,
1671
+ "default": 0
1672
+ },
1673
+ "provider_message_id": {
1674
+ "name": "provider_message_id",
1675
+ "type": "text",
1676
+ "primaryKey": false,
1677
+ "notNull": false,
1678
+ "autoincrement": false
1679
+ },
1680
+ "recipient_address": {
1681
+ "name": "recipient_address",
1682
+ "type": "text",
1683
+ "primaryKey": false,
1684
+ "notNull": false,
1685
+ "autoincrement": false
1686
+ },
1687
+ "topic_id": {
1688
+ "name": "topic_id",
1689
+ "type": "text",
1690
+ "primaryKey": false,
1691
+ "notNull": false,
1692
+ "autoincrement": false
1693
+ },
1694
+ "transport_id": {
1695
+ "name": "transport_id",
1696
+ "type": "text",
1697
+ "primaryKey": false,
1698
+ "notNull": false,
1699
+ "autoincrement": false
1700
+ },
1701
+ "status_reason": {
1702
+ "name": "status_reason",
1703
+ "type": "text",
1704
+ "primaryKey": false,
1705
+ "notNull": false,
1706
+ "autoincrement": false
1707
+ },
1708
+ "approved_by": {
1709
+ "name": "approved_by",
1710
+ "type": "text",
1711
+ "primaryKey": false,
1712
+ "notNull": false,
1713
+ "autoincrement": false
1714
+ },
1715
+ "rejected_by": {
1716
+ "name": "rejected_by",
1717
+ "type": "text",
1718
+ "primaryKey": false,
1719
+ "notNull": false,
1720
+ "autoincrement": false
1721
+ },
1722
+ "edited_by": {
1723
+ "name": "edited_by",
1724
+ "type": "text",
1725
+ "primaryKey": false,
1726
+ "notNull": false,
1727
+ "autoincrement": false
1728
+ },
1729
+ "edited_at": {
1730
+ "name": "edited_at",
1731
+ "type": "integer",
1732
+ "primaryKey": false,
1733
+ "notNull": false,
1734
+ "autoincrement": false
1735
+ },
1736
+ "original_subject": {
1737
+ "name": "original_subject",
1738
+ "type": "text",
1739
+ "primaryKey": false,
1740
+ "notNull": false,
1741
+ "autoincrement": false
1742
+ },
1743
+ "original_body_html": {
1744
+ "name": "original_body_html",
1745
+ "type": "text",
1746
+ "primaryKey": false,
1747
+ "notNull": false,
1748
+ "autoincrement": false
1749
+ },
1750
+ "original_body_text": {
1751
+ "name": "original_body_text",
1752
+ "type": "text",
1753
+ "primaryKey": false,
1754
+ "notNull": false,
1755
+ "autoincrement": false
1756
+ },
1757
+ "forced_action_type": {
1758
+ "name": "forced_action_type",
1759
+ "type": "text",
1760
+ "primaryKey": false,
1761
+ "notNull": false,
1762
+ "autoincrement": false
1763
+ },
1764
+ "kb_entry_id": {
1765
+ "name": "kb_entry_id",
1766
+ "type": "text",
1767
+ "primaryKey": false,
1768
+ "notNull": false,
1769
+ "autoincrement": false
1770
+ },
1771
+ "imported": {
1772
+ "name": "imported",
1773
+ "type": "integer",
1774
+ "primaryKey": false,
1775
+ "notNull": true,
1776
+ "autoincrement": false,
1777
+ "default": false
1778
+ },
1779
+ "import_key": {
1780
+ "name": "import_key",
1781
+ "type": "text",
1782
+ "primaryKey": false,
1783
+ "notNull": false,
1784
+ "autoincrement": false
1785
+ },
1786
+ "expires_at": {
1787
+ "name": "expires_at",
1788
+ "type": "integer",
1789
+ "primaryKey": false,
1790
+ "notNull": false,
1791
+ "autoincrement": false
1792
+ },
1793
+ "context_snapshot": {
1794
+ "name": "context_snapshot",
1795
+ "type": "text",
1796
+ "primaryKey": false,
1797
+ "notNull": false,
1798
+ "autoincrement": false
1799
+ },
1800
+ "choose_decision": {
1801
+ "name": "choose_decision",
1802
+ "type": "text",
1803
+ "primaryKey": false,
1804
+ "notNull": false,
1805
+ "autoincrement": false
1806
+ },
1807
+ "opening_line": {
1808
+ "name": "opening_line",
1809
+ "type": "text",
1810
+ "primaryKey": false,
1811
+ "notNull": false,
1812
+ "autoincrement": false
1813
+ },
1814
+ "created_at": {
1815
+ "name": "created_at",
1816
+ "type": "integer",
1817
+ "primaryKey": false,
1818
+ "notNull": false,
1819
+ "autoincrement": false
1820
+ },
1821
+ "updated_at": {
1822
+ "name": "updated_at",
1823
+ "type": "integer",
1824
+ "primaryKey": false,
1825
+ "notNull": false,
1826
+ "autoincrement": false
1827
+ }
1828
+ },
1829
+ "indexes": {
1830
+ "idx_messages_drain": {
1831
+ "name": "idx_messages_drain",
1832
+ "columns": [
1833
+ "tenant_id",
1834
+ "status",
1835
+ "scheduled_send_at"
1836
+ ],
1837
+ "isUnique": false,
1838
+ "where": "status IN ('approved', 'sending')"
1839
+ },
1840
+ "idx_messages_contact": {
1841
+ "name": "idx_messages_contact",
1842
+ "columns": [
1843
+ "contact_id",
1844
+ "status",
1845
+ "created_at"
1846
+ ],
1847
+ "isUnique": false
1848
+ },
1849
+ "idx_messages_contact_sent": {
1850
+ "name": "idx_messages_contact_sent",
1851
+ "columns": [
1852
+ "contact_id",
1853
+ "sent_at"
1854
+ ],
1855
+ "isUnique": false,
1856
+ "where": "status IN ('sending', 'sent')"
1857
+ },
1858
+ "uq_messages_membership_step": {
1859
+ "name": "uq_messages_membership_step",
1860
+ "columns": [
1861
+ "membership_id",
1862
+ "flow_step_order"
1863
+ ],
1864
+ "isUnique": true
1865
+ },
1866
+ "idx_messages_generation": {
1867
+ "name": "idx_messages_generation",
1868
+ "columns": [
1869
+ "tenant_id",
1870
+ "status",
1871
+ "created_at"
1872
+ ],
1873
+ "isUnique": false,
1874
+ "where": "status IN ('pending_generation', 'generating')"
1875
+ },
1876
+ "idx_messages_provider_id": {
1877
+ "name": "idx_messages_provider_id",
1878
+ "columns": [
1879
+ "provider_message_id"
1880
+ ],
1881
+ "isUnique": false,
1882
+ "where": "provider_message_id IS NOT NULL"
1883
+ },
1884
+ "idx_messages_tenant_sent": {
1885
+ "name": "idx_messages_tenant_sent",
1886
+ "columns": [
1887
+ "tenant_id",
1888
+ "sent_at"
1889
+ ],
1890
+ "isUnique": false,
1891
+ "where": "sent_at IS NOT NULL"
1892
+ },
1893
+ "uq_messages_import_key": {
1894
+ "name": "uq_messages_import_key",
1895
+ "columns": [
1896
+ "tenant_id",
1897
+ "import_key"
1898
+ ],
1899
+ "isUnique": true,
1900
+ "where": "import_key IS NOT NULL"
1901
+ },
1902
+ "idx_messages_kb_entry": {
1903
+ "name": "idx_messages_kb_entry",
1904
+ "columns": [
1905
+ "tenant_id",
1906
+ "contact_id",
1907
+ "kb_entry_id"
1908
+ ],
1909
+ "isUnique": false,
1910
+ "where": "kb_entry_id IS NOT NULL"
1911
+ },
1912
+ "idx_messages_expires": {
1913
+ "name": "idx_messages_expires",
1914
+ "columns": [
1915
+ "tenant_id",
1916
+ "expires_at"
1917
+ ],
1918
+ "isUnique": false,
1919
+ "where": "expires_at IS NOT NULL"
1920
+ }
1921
+ },
1922
+ "foreignKeys": {
1923
+ "lifecycle_messages_tenant_id_tenants_id_fk": {
1924
+ "name": "lifecycle_messages_tenant_id_tenants_id_fk",
1925
+ "tableFrom": "lifecycle_messages",
1926
+ "tableTo": "tenants",
1927
+ "columnsFrom": [
1928
+ "tenant_id"
1929
+ ],
1930
+ "columnsTo": [
1931
+ "id"
1932
+ ],
1933
+ "onDelete": "no action",
1934
+ "onUpdate": "no action"
1935
+ },
1936
+ "lifecycle_messages_contact_id_contacts_id_fk": {
1937
+ "name": "lifecycle_messages_contact_id_contacts_id_fk",
1938
+ "tableFrom": "lifecycle_messages",
1939
+ "tableTo": "contacts",
1940
+ "columnsFrom": [
1941
+ "contact_id"
1942
+ ],
1943
+ "columnsTo": [
1944
+ "id"
1945
+ ],
1946
+ "onDelete": "no action",
1947
+ "onUpdate": "no action"
1948
+ },
1949
+ "lifecycle_messages_flow_id_flows_id_fk": {
1950
+ "name": "lifecycle_messages_flow_id_flows_id_fk",
1951
+ "tableFrom": "lifecycle_messages",
1952
+ "tableTo": "flows",
1953
+ "columnsFrom": [
1954
+ "flow_id"
1955
+ ],
1956
+ "columnsTo": [
1957
+ "id"
1958
+ ],
1959
+ "onDelete": "no action",
1960
+ "onUpdate": "no action"
1961
+ },
1962
+ "lifecycle_messages_membership_id_flow_memberships_id_fk": {
1963
+ "name": "lifecycle_messages_membership_id_flow_memberships_id_fk",
1964
+ "tableFrom": "lifecycle_messages",
1965
+ "tableTo": "flow_memberships",
1966
+ "columnsFrom": [
1967
+ "membership_id"
1968
+ ],
1969
+ "columnsTo": [
1970
+ "id"
1971
+ ],
1972
+ "onDelete": "no action",
1973
+ "onUpdate": "no action"
1974
+ }
1975
+ },
1976
+ "compositePrimaryKeys": {},
1977
+ "uniqueConstraints": {},
1978
+ "checkConstraints": {}
1979
+ },
1980
+ "lifecycle_transitions": {
1981
+ "name": "lifecycle_transitions",
1982
+ "columns": {
1983
+ "id": {
1984
+ "name": "id",
1985
+ "type": "text",
1986
+ "primaryKey": true,
1987
+ "notNull": true,
1988
+ "autoincrement": false
1989
+ },
1990
+ "tenant_id": {
1991
+ "name": "tenant_id",
1992
+ "type": "text",
1993
+ "primaryKey": false,
1994
+ "notNull": true,
1995
+ "autoincrement": false
1996
+ },
1997
+ "contact_id": {
1998
+ "name": "contact_id",
1999
+ "type": "text",
2000
+ "primaryKey": false,
2001
+ "notNull": true,
2002
+ "autoincrement": false
2003
+ },
2004
+ "from_state": {
2005
+ "name": "from_state",
2006
+ "type": "text",
2007
+ "primaryKey": false,
2008
+ "notNull": true,
2009
+ "autoincrement": false
2010
+ },
2011
+ "to_state": {
2012
+ "name": "to_state",
2013
+ "type": "text",
2014
+ "primaryKey": false,
2015
+ "notNull": true,
2016
+ "autoincrement": false
2017
+ },
2018
+ "trigger_event_id": {
2019
+ "name": "trigger_event_id",
2020
+ "type": "text",
2021
+ "primaryKey": false,
2022
+ "notNull": false,
2023
+ "autoincrement": false
2024
+ },
2025
+ "metadata": {
2026
+ "name": "metadata",
2027
+ "type": "text",
2028
+ "primaryKey": false,
2029
+ "notNull": false,
2030
+ "autoincrement": false
2031
+ },
2032
+ "transitioned_at": {
2033
+ "name": "transitioned_at",
2034
+ "type": "integer",
2035
+ "primaryKey": false,
2036
+ "notNull": true,
2037
+ "autoincrement": false
2038
+ }
2039
+ },
2040
+ "indexes": {
2041
+ "idx_transitions_contact": {
2042
+ "name": "idx_transitions_contact",
2043
+ "columns": [
2044
+ "contact_id",
2045
+ "transitioned_at"
2046
+ ],
2047
+ "isUnique": false
2048
+ },
2049
+ "idx_transitions_tenant_time": {
2050
+ "name": "idx_transitions_tenant_time",
2051
+ "columns": [
2052
+ "tenant_id",
2053
+ "transitioned_at"
2054
+ ],
2055
+ "isUnique": false
2056
+ }
2057
+ },
2058
+ "foreignKeys": {
2059
+ "lifecycle_transitions_tenant_id_tenants_id_fk": {
2060
+ "name": "lifecycle_transitions_tenant_id_tenants_id_fk",
2061
+ "tableFrom": "lifecycle_transitions",
2062
+ "tableTo": "tenants",
2063
+ "columnsFrom": [
2064
+ "tenant_id"
2065
+ ],
2066
+ "columnsTo": [
2067
+ "id"
2068
+ ],
2069
+ "onDelete": "no action",
2070
+ "onUpdate": "no action"
2071
+ },
2072
+ "lifecycle_transitions_contact_id_contacts_id_fk": {
2073
+ "name": "lifecycle_transitions_contact_id_contacts_id_fk",
2074
+ "tableFrom": "lifecycle_transitions",
2075
+ "tableTo": "contacts",
2076
+ "columnsFrom": [
2077
+ "contact_id"
2078
+ ],
2079
+ "columnsTo": [
2080
+ "id"
2081
+ ],
2082
+ "onDelete": "no action",
2083
+ "onUpdate": "no action"
2084
+ }
2085
+ },
2086
+ "compositePrimaryKeys": {},
2087
+ "uniqueConstraints": {},
2088
+ "checkConstraints": {}
2089
+ },
2090
+ "llm_configs": {
2091
+ "name": "llm_configs",
2092
+ "columns": {
2093
+ "id": {
2094
+ "name": "id",
2095
+ "type": "text",
2096
+ "primaryKey": true,
2097
+ "notNull": true,
2098
+ "autoincrement": false
2099
+ },
2100
+ "tenant_id": {
2101
+ "name": "tenant_id",
2102
+ "type": "text",
2103
+ "primaryKey": false,
2104
+ "notNull": true,
2105
+ "autoincrement": false
2106
+ },
2107
+ "provider": {
2108
+ "name": "provider",
2109
+ "type": "text",
2110
+ "primaryKey": false,
2111
+ "notNull": true,
2112
+ "autoincrement": false
2113
+ },
2114
+ "config": {
2115
+ "name": "config",
2116
+ "type": "text",
2117
+ "primaryKey": false,
2118
+ "notNull": true,
2119
+ "autoincrement": false
2120
+ },
2121
+ "is_active": {
2122
+ "name": "is_active",
2123
+ "type": "integer",
2124
+ "primaryKey": false,
2125
+ "notNull": false,
2126
+ "autoincrement": false,
2127
+ "default": true
2128
+ },
2129
+ "created_at": {
2130
+ "name": "created_at",
2131
+ "type": "integer",
2132
+ "primaryKey": false,
2133
+ "notNull": false,
2134
+ "autoincrement": false
2135
+ }
2136
+ },
2137
+ "indexes": {},
2138
+ "foreignKeys": {
2139
+ "llm_configs_tenant_id_tenants_id_fk": {
2140
+ "name": "llm_configs_tenant_id_tenants_id_fk",
2141
+ "tableFrom": "llm_configs",
2142
+ "tableTo": "tenants",
2143
+ "columnsFrom": [
2144
+ "tenant_id"
2145
+ ],
2146
+ "columnsTo": [
2147
+ "id"
2148
+ ],
2149
+ "onDelete": "no action",
2150
+ "onUpdate": "no action"
2151
+ }
2152
+ },
2153
+ "compositePrimaryKeys": {},
2154
+ "uniqueConstraints": {},
2155
+ "checkConstraints": {}
2156
+ },
2157
+ "magic_link_tokens": {
2158
+ "name": "magic_link_tokens",
2159
+ "columns": {
2160
+ "id": {
2161
+ "name": "id",
2162
+ "type": "text",
2163
+ "primaryKey": true,
2164
+ "notNull": true,
2165
+ "autoincrement": false
2166
+ },
2167
+ "tenant_id": {
2168
+ "name": "tenant_id",
2169
+ "type": "text",
2170
+ "primaryKey": false,
2171
+ "notNull": true,
2172
+ "autoincrement": false
2173
+ },
2174
+ "user_id": {
2175
+ "name": "user_id",
2176
+ "type": "text",
2177
+ "primaryKey": false,
2178
+ "notNull": true,
2179
+ "autoincrement": false
2180
+ },
2181
+ "token_hash": {
2182
+ "name": "token_hash",
2183
+ "type": "text",
2184
+ "primaryKey": false,
2185
+ "notNull": true,
2186
+ "autoincrement": false
2187
+ },
2188
+ "expires_at": {
2189
+ "name": "expires_at",
2190
+ "type": "integer",
2191
+ "primaryKey": false,
2192
+ "notNull": true,
2193
+ "autoincrement": false
2194
+ },
2195
+ "consumed_at": {
2196
+ "name": "consumed_at",
2197
+ "type": "integer",
2198
+ "primaryKey": false,
2199
+ "notNull": false,
2200
+ "autoincrement": false
2201
+ },
2202
+ "created_at": {
2203
+ "name": "created_at",
2204
+ "type": "integer",
2205
+ "primaryKey": false,
2206
+ "notNull": false,
2207
+ "autoincrement": false
2208
+ }
2209
+ },
2210
+ "indexes": {
2211
+ "idx_magic_link_tokens_hash": {
2212
+ "name": "idx_magic_link_tokens_hash",
2213
+ "columns": [
2214
+ "token_hash"
2215
+ ],
2216
+ "isUnique": false
2217
+ }
2218
+ },
2219
+ "foreignKeys": {
2220
+ "magic_link_tokens_tenant_id_tenants_id_fk": {
2221
+ "name": "magic_link_tokens_tenant_id_tenants_id_fk",
2222
+ "tableFrom": "magic_link_tokens",
2223
+ "tableTo": "tenants",
2224
+ "columnsFrom": [
2225
+ "tenant_id"
2226
+ ],
2227
+ "columnsTo": [
2228
+ "id"
2229
+ ],
2230
+ "onDelete": "no action",
2231
+ "onUpdate": "no action"
2232
+ },
2233
+ "magic_link_tokens_user_id_users_id_fk": {
2234
+ "name": "magic_link_tokens_user_id_users_id_fk",
2235
+ "tableFrom": "magic_link_tokens",
2236
+ "tableTo": "users",
2237
+ "columnsFrom": [
2238
+ "user_id"
2239
+ ],
2240
+ "columnsTo": [
2241
+ "id"
2242
+ ],
2243
+ "onDelete": "cascade",
2244
+ "onUpdate": "no action"
2245
+ }
2246
+ },
2247
+ "compositePrimaryKeys": {},
2248
+ "uniqueConstraints": {},
2249
+ "checkConstraints": {}
2250
+ },
2251
+ "memberships": {
2252
+ "name": "memberships",
2253
+ "columns": {
2254
+ "user_id": {
2255
+ "name": "user_id",
2256
+ "type": "text",
2257
+ "primaryKey": false,
2258
+ "notNull": true,
2259
+ "autoincrement": false
2260
+ },
2261
+ "tenant_id": {
2262
+ "name": "tenant_id",
2263
+ "type": "text",
2264
+ "primaryKey": false,
2265
+ "notNull": true,
2266
+ "autoincrement": false
2267
+ },
2268
+ "role": {
2269
+ "name": "role",
2270
+ "type": "text",
2271
+ "primaryKey": false,
2272
+ "notNull": true,
2273
+ "autoincrement": false
2274
+ },
2275
+ "created_at": {
2276
+ "name": "created_at",
2277
+ "type": "integer",
2278
+ "primaryKey": false,
2279
+ "notNull": false,
2280
+ "autoincrement": false
2281
+ }
2282
+ },
2283
+ "indexes": {
2284
+ "idx_memberships_tenant": {
2285
+ "name": "idx_memberships_tenant",
2286
+ "columns": [
2287
+ "tenant_id"
2288
+ ],
2289
+ "isUnique": false
2290
+ }
2291
+ },
2292
+ "foreignKeys": {
2293
+ "memberships_user_id_users_id_fk": {
2294
+ "name": "memberships_user_id_users_id_fk",
2295
+ "tableFrom": "memberships",
2296
+ "tableTo": "users",
2297
+ "columnsFrom": [
2298
+ "user_id"
2299
+ ],
2300
+ "columnsTo": [
2301
+ "id"
2302
+ ],
2303
+ "onDelete": "cascade",
2304
+ "onUpdate": "no action"
2305
+ },
2306
+ "memberships_tenant_id_tenants_id_fk": {
2307
+ "name": "memberships_tenant_id_tenants_id_fk",
2308
+ "tableFrom": "memberships",
2309
+ "tableTo": "tenants",
2310
+ "columnsFrom": [
2311
+ "tenant_id"
2312
+ ],
2313
+ "columnsTo": [
2314
+ "id"
2315
+ ],
2316
+ "onDelete": "no action",
2317
+ "onUpdate": "no action"
2318
+ }
2319
+ },
2320
+ "compositePrimaryKeys": {
2321
+ "memberships_pkey": {
2322
+ "columns": [
2323
+ "user_id",
2324
+ "tenant_id"
2325
+ ],
2326
+ "name": "memberships_pkey"
2327
+ }
2328
+ },
2329
+ "uniqueConstraints": {},
2330
+ "checkConstraints": {}
2331
+ },
2332
+ "message_events": {
2333
+ "name": "message_events",
2334
+ "columns": {
2335
+ "id": {
2336
+ "name": "id",
2337
+ "type": "text",
2338
+ "primaryKey": true,
2339
+ "notNull": true,
2340
+ "autoincrement": false
2341
+ },
2342
+ "tenant_id": {
2343
+ "name": "tenant_id",
2344
+ "type": "text",
2345
+ "primaryKey": false,
2346
+ "notNull": true,
2347
+ "autoincrement": false
2348
+ },
2349
+ "message_id": {
2350
+ "name": "message_id",
2351
+ "type": "text",
2352
+ "primaryKey": false,
2353
+ "notNull": true,
2354
+ "autoincrement": false
2355
+ },
2356
+ "event_type": {
2357
+ "name": "event_type",
2358
+ "type": "text",
2359
+ "primaryKey": false,
2360
+ "notNull": true,
2361
+ "autoincrement": false
2362
+ },
2363
+ "occurred_at": {
2364
+ "name": "occurred_at",
2365
+ "type": "integer",
2366
+ "primaryKey": false,
2367
+ "notNull": true,
2368
+ "autoincrement": false
2369
+ },
2370
+ "provider_event_id": {
2371
+ "name": "provider_event_id",
2372
+ "type": "text",
2373
+ "primaryKey": false,
2374
+ "notNull": false,
2375
+ "autoincrement": false
2376
+ },
2377
+ "metadata": {
2378
+ "name": "metadata",
2379
+ "type": "text",
2380
+ "primaryKey": false,
2381
+ "notNull": false,
2382
+ "autoincrement": false
2383
+ },
2384
+ "created_at": {
2385
+ "name": "created_at",
2386
+ "type": "integer",
2387
+ "primaryKey": false,
2388
+ "notNull": false,
2389
+ "autoincrement": false
2390
+ }
2391
+ },
2392
+ "indexes": {
2393
+ "idx_message_events_message": {
2394
+ "name": "idx_message_events_message",
2395
+ "columns": [
2396
+ "message_id",
2397
+ "occurred_at"
2398
+ ],
2399
+ "isUnique": false
2400
+ },
2401
+ "idx_message_events_tenant_type_day": {
2402
+ "name": "idx_message_events_tenant_type_day",
2403
+ "columns": [
2404
+ "tenant_id",
2405
+ "event_type",
2406
+ "occurred_at"
2407
+ ],
2408
+ "isUnique": false
2409
+ },
2410
+ "uq_message_events_provider_dedup": {
2411
+ "name": "uq_message_events_provider_dedup",
2412
+ "columns": [
2413
+ "tenant_id",
2414
+ "provider_event_id"
2415
+ ],
2416
+ "isUnique": true,
2417
+ "where": "provider_event_id IS NOT NULL"
2418
+ }
2419
+ },
2420
+ "foreignKeys": {
2421
+ "message_events_tenant_id_tenants_id_fk": {
2422
+ "name": "message_events_tenant_id_tenants_id_fk",
2423
+ "tableFrom": "message_events",
2424
+ "tableTo": "tenants",
2425
+ "columnsFrom": [
2426
+ "tenant_id"
2427
+ ],
2428
+ "columnsTo": [
2429
+ "id"
2430
+ ],
2431
+ "onDelete": "no action",
2432
+ "onUpdate": "no action"
2433
+ },
2434
+ "message_events_message_id_lifecycle_messages_id_fk": {
2435
+ "name": "message_events_message_id_lifecycle_messages_id_fk",
2436
+ "tableFrom": "message_events",
2437
+ "tableTo": "lifecycle_messages",
2438
+ "columnsFrom": [
2439
+ "message_id"
2440
+ ],
2441
+ "columnsTo": [
2442
+ "id"
2443
+ ],
2444
+ "onDelete": "no action",
2445
+ "onUpdate": "no action"
2446
+ }
2447
+ },
2448
+ "compositePrimaryKeys": {},
2449
+ "uniqueConstraints": {},
2450
+ "checkConstraints": {}
2451
+ },
2452
+ "ops_alerts": {
2453
+ "name": "ops_alerts",
2454
+ "columns": {
2455
+ "fingerprint": {
2456
+ "name": "fingerprint",
2457
+ "type": "text",
2458
+ "primaryKey": true,
2459
+ "notNull": true,
2460
+ "autoincrement": false
2461
+ },
2462
+ "kind": {
2463
+ "name": "kind",
2464
+ "type": "text",
2465
+ "primaryKey": false,
2466
+ "notNull": true,
2467
+ "autoincrement": false
2468
+ },
2469
+ "tenant_id": {
2470
+ "name": "tenant_id",
2471
+ "type": "text",
2472
+ "primaryKey": false,
2473
+ "notNull": false,
2474
+ "autoincrement": false
2475
+ },
2476
+ "severity": {
2477
+ "name": "severity",
2478
+ "type": "text",
2479
+ "primaryKey": false,
2480
+ "notNull": true,
2481
+ "autoincrement": false
2482
+ },
2483
+ "message": {
2484
+ "name": "message",
2485
+ "type": "text",
2486
+ "primaryKey": false,
2487
+ "notNull": true,
2488
+ "autoincrement": false
2489
+ },
2490
+ "first_at": {
2491
+ "name": "first_at",
2492
+ "type": "integer",
2493
+ "primaryKey": false,
2494
+ "notNull": true,
2495
+ "autoincrement": false
2496
+ },
2497
+ "last_at": {
2498
+ "name": "last_at",
2499
+ "type": "integer",
2500
+ "primaryKey": false,
2501
+ "notNull": true,
2502
+ "autoincrement": false
2503
+ },
2504
+ "count": {
2505
+ "name": "count",
2506
+ "type": "integer",
2507
+ "primaryKey": false,
2508
+ "notNull": true,
2509
+ "autoincrement": false,
2510
+ "default": 1
2511
+ },
2512
+ "last_notified_at": {
2513
+ "name": "last_notified_at",
2514
+ "type": "integer",
2515
+ "primaryKey": false,
2516
+ "notNull": false,
2517
+ "autoincrement": false
2518
+ },
2519
+ "notified_count": {
2520
+ "name": "notified_count",
2521
+ "type": "integer",
2522
+ "primaryKey": false,
2523
+ "notNull": true,
2524
+ "autoincrement": false,
2525
+ "default": 0
2526
+ },
2527
+ "status": {
2528
+ "name": "status",
2529
+ "type": "text",
2530
+ "primaryKey": false,
2531
+ "notNull": true,
2532
+ "autoincrement": false,
2533
+ "default": "'open'"
2534
+ },
2535
+ "muted_until": {
2536
+ "name": "muted_until",
2537
+ "type": "integer",
2538
+ "primaryKey": false,
2539
+ "notNull": false,
2540
+ "autoincrement": false
2541
+ }
2542
+ },
2543
+ "indexes": {},
2544
+ "foreignKeys": {},
2545
+ "compositePrimaryKeys": {},
2546
+ "uniqueConstraints": {},
2547
+ "checkConstraints": {}
2548
+ },
2549
+ "ops_events": {
2550
+ "name": "ops_events",
2551
+ "columns": {
2552
+ "id": {
2553
+ "name": "id",
2554
+ "type": "text",
2555
+ "primaryKey": true,
2556
+ "notNull": true,
2557
+ "autoincrement": false
2558
+ },
2559
+ "at": {
2560
+ "name": "at",
2561
+ "type": "integer",
2562
+ "primaryKey": false,
2563
+ "notNull": true,
2564
+ "autoincrement": false
2565
+ },
2566
+ "tenant_id": {
2567
+ "name": "tenant_id",
2568
+ "type": "text",
2569
+ "primaryKey": false,
2570
+ "notNull": false,
2571
+ "autoincrement": false
2572
+ },
2573
+ "kind": {
2574
+ "name": "kind",
2575
+ "type": "text",
2576
+ "primaryKey": false,
2577
+ "notNull": true,
2578
+ "autoincrement": false
2579
+ },
2580
+ "severity": {
2581
+ "name": "severity",
2582
+ "type": "text",
2583
+ "primaryKey": false,
2584
+ "notNull": true,
2585
+ "autoincrement": false
2586
+ },
2587
+ "fingerprint": {
2588
+ "name": "fingerprint",
2589
+ "type": "text",
2590
+ "primaryKey": false,
2591
+ "notNull": true,
2592
+ "autoincrement": false
2593
+ },
2594
+ "message": {
2595
+ "name": "message",
2596
+ "type": "text",
2597
+ "primaryKey": false,
2598
+ "notNull": true,
2599
+ "autoincrement": false
2600
+ },
2601
+ "context": {
2602
+ "name": "context",
2603
+ "type": "text",
2604
+ "primaryKey": false,
2605
+ "notNull": false,
2606
+ "autoincrement": false
2607
+ }
2608
+ },
2609
+ "indexes": {
2610
+ "idx_ops_events_fingerprint_at": {
2611
+ "name": "idx_ops_events_fingerprint_at",
2612
+ "columns": [
2613
+ "fingerprint",
2614
+ "at"
2615
+ ],
2616
+ "isUnique": false
2617
+ },
2618
+ "idx_ops_events_at": {
2619
+ "name": "idx_ops_events_at",
2620
+ "columns": [
2621
+ "at"
2622
+ ],
2623
+ "isUnique": false
2624
+ }
2625
+ },
2626
+ "foreignKeys": {},
2627
+ "compositePrimaryKeys": {},
2628
+ "uniqueConstraints": {},
2629
+ "checkConstraints": {}
2630
+ },
2631
+ "retention_grid_snapshots": {
2632
+ "name": "retention_grid_snapshots",
2633
+ "columns": {
2634
+ "tenant_id": {
2635
+ "name": "tenant_id",
2636
+ "type": "text",
2637
+ "primaryKey": false,
2638
+ "notNull": true,
2639
+ "autoincrement": false
2640
+ },
2641
+ "snapshot_date": {
2642
+ "name": "snapshot_date",
2643
+ "type": "text",
2644
+ "primaryKey": false,
2645
+ "notNull": true,
2646
+ "autoincrement": false
2647
+ },
2648
+ "tenure_bucket": {
2649
+ "name": "tenure_bucket",
2650
+ "type": "text",
2651
+ "primaryKey": false,
2652
+ "notNull": true,
2653
+ "autoincrement": false
2654
+ },
2655
+ "recency_bucket": {
2656
+ "name": "recency_bucket",
2657
+ "type": "text",
2658
+ "primaryKey": false,
2659
+ "notNull": true,
2660
+ "autoincrement": false
2661
+ },
2662
+ "contact_count": {
2663
+ "name": "contact_count",
2664
+ "type": "integer",
2665
+ "primaryKey": false,
2666
+ "notNull": true,
2667
+ "autoincrement": false
2668
+ },
2669
+ "paying_count": {
2670
+ "name": "paying_count",
2671
+ "type": "integer",
2672
+ "primaryKey": false,
2673
+ "notNull": true,
2674
+ "autoincrement": false
2675
+ }
2676
+ },
2677
+ "indexes": {},
2678
+ "foreignKeys": {
2679
+ "retention_grid_snapshots_tenant_id_tenants_id_fk": {
2680
+ "name": "retention_grid_snapshots_tenant_id_tenants_id_fk",
2681
+ "tableFrom": "retention_grid_snapshots",
2682
+ "tableTo": "tenants",
2683
+ "columnsFrom": [
2684
+ "tenant_id"
2685
+ ],
2686
+ "columnsTo": [
2687
+ "id"
2688
+ ],
2689
+ "onDelete": "no action",
2690
+ "onUpdate": "no action"
2691
+ }
2692
+ },
2693
+ "compositePrimaryKeys": {
2694
+ "retention_grid_snapshots_tenant_id_snapshot_date_tenure_bucket_recency_bucket_pk": {
2695
+ "columns": [
2696
+ "tenant_id",
2697
+ "snapshot_date",
2698
+ "tenure_bucket",
2699
+ "recency_bucket"
2700
+ ],
2701
+ "name": "retention_grid_snapshots_tenant_id_snapshot_date_tenure_bucket_recency_bucket_pk"
2702
+ }
2703
+ },
2704
+ "uniqueConstraints": {},
2705
+ "checkConstraints": {}
2706
+ },
2707
+ "scan_checkpoints": {
2708
+ "name": "scan_checkpoints",
2709
+ "columns": {
2710
+ "scan_phase": {
2711
+ "name": "scan_phase",
2712
+ "type": "text",
2713
+ "primaryKey": false,
2714
+ "notNull": true,
2715
+ "autoincrement": false
2716
+ },
2717
+ "tenant_id": {
2718
+ "name": "tenant_id",
2719
+ "type": "text",
2720
+ "primaryKey": false,
2721
+ "notNull": true,
2722
+ "autoincrement": false
2723
+ },
2724
+ "last_id": {
2725
+ "name": "last_id",
2726
+ "type": "text",
2727
+ "primaryKey": false,
2728
+ "notNull": true,
2729
+ "autoincrement": false
2730
+ },
2731
+ "started_at": {
2732
+ "name": "started_at",
2733
+ "type": "integer",
2734
+ "primaryKey": false,
2735
+ "notNull": true,
2736
+ "autoincrement": false
2737
+ },
2738
+ "discard_count": {
2739
+ "name": "discard_count",
2740
+ "type": "integer",
2741
+ "primaryKey": false,
2742
+ "notNull": true,
2743
+ "autoincrement": false,
2744
+ "default": 0
2745
+ }
2746
+ },
2747
+ "indexes": {},
2748
+ "foreignKeys": {
2749
+ "scan_checkpoints_tenant_id_tenants_id_fk": {
2750
+ "name": "scan_checkpoints_tenant_id_tenants_id_fk",
2751
+ "tableFrom": "scan_checkpoints",
2752
+ "tableTo": "tenants",
2753
+ "columnsFrom": [
2754
+ "tenant_id"
2755
+ ],
2756
+ "columnsTo": [
2757
+ "id"
2758
+ ],
2759
+ "onDelete": "no action",
2760
+ "onUpdate": "no action"
2761
+ }
2762
+ },
2763
+ "compositePrimaryKeys": {
2764
+ "scan_checkpoints_scan_phase_tenant_id_pk": {
2765
+ "columns": [
2766
+ "scan_phase",
2767
+ "tenant_id"
2768
+ ],
2769
+ "name": "scan_checkpoints_scan_phase_tenant_id_pk"
2770
+ }
2771
+ },
2772
+ "uniqueConstraints": {},
2773
+ "checkConstraints": {}
2774
+ },
2775
+ "sessions": {
2776
+ "name": "sessions",
2777
+ "columns": {
2778
+ "id": {
2779
+ "name": "id",
2780
+ "type": "text",
2781
+ "primaryKey": true,
2782
+ "notNull": true,
2783
+ "autoincrement": false
2784
+ },
2785
+ "tenant_id": {
2786
+ "name": "tenant_id",
2787
+ "type": "text",
2788
+ "primaryKey": false,
2789
+ "notNull": true,
2790
+ "autoincrement": false
2791
+ },
2792
+ "user_id": {
2793
+ "name": "user_id",
2794
+ "type": "text",
2795
+ "primaryKey": false,
2796
+ "notNull": true,
2797
+ "autoincrement": false
2798
+ },
2799
+ "expires_at": {
2800
+ "name": "expires_at",
2801
+ "type": "integer",
2802
+ "primaryKey": false,
2803
+ "notNull": true,
2804
+ "autoincrement": false
2805
+ },
2806
+ "created_at": {
2807
+ "name": "created_at",
2808
+ "type": "integer",
2809
+ "primaryKey": false,
2810
+ "notNull": false,
2811
+ "autoincrement": false
2812
+ }
2813
+ },
2814
+ "indexes": {},
2815
+ "foreignKeys": {
2816
+ "sessions_tenant_id_tenants_id_fk": {
2817
+ "name": "sessions_tenant_id_tenants_id_fk",
2818
+ "tableFrom": "sessions",
2819
+ "tableTo": "tenants",
2820
+ "columnsFrom": [
2821
+ "tenant_id"
2822
+ ],
2823
+ "columnsTo": [
2824
+ "id"
2825
+ ],
2826
+ "onDelete": "no action",
2827
+ "onUpdate": "no action"
2828
+ },
2829
+ "sessions_user_id_users_id_fk": {
2830
+ "name": "sessions_user_id_users_id_fk",
2831
+ "tableFrom": "sessions",
2832
+ "tableTo": "users",
2833
+ "columnsFrom": [
2834
+ "user_id"
2835
+ ],
2836
+ "columnsTo": [
2837
+ "id"
2838
+ ],
2839
+ "onDelete": "cascade",
2840
+ "onUpdate": "no action"
2841
+ }
2842
+ },
2843
+ "compositePrimaryKeys": {},
2844
+ "uniqueConstraints": {},
2845
+ "checkConstraints": {}
2846
+ },
2847
+ "suppressions": {
2848
+ "name": "suppressions",
2849
+ "columns": {
2850
+ "id": {
2851
+ "name": "id",
2852
+ "type": "text",
2853
+ "primaryKey": true,
2854
+ "notNull": true,
2855
+ "autoincrement": false
2856
+ },
2857
+ "tenant_id": {
2858
+ "name": "tenant_id",
2859
+ "type": "text",
2860
+ "primaryKey": false,
2861
+ "notNull": true,
2862
+ "autoincrement": false
2863
+ },
2864
+ "email": {
2865
+ "name": "email",
2866
+ "type": "text",
2867
+ "primaryKey": false,
2868
+ "notNull": true,
2869
+ "autoincrement": false
2870
+ },
2871
+ "reason": {
2872
+ "name": "reason",
2873
+ "type": "text",
2874
+ "primaryKey": false,
2875
+ "notNull": true,
2876
+ "autoincrement": false
2877
+ },
2878
+ "source": {
2879
+ "name": "source",
2880
+ "type": "text",
2881
+ "primaryKey": false,
2882
+ "notNull": false,
2883
+ "autoincrement": false
2884
+ },
2885
+ "created_at": {
2886
+ "name": "created_at",
2887
+ "type": "integer",
2888
+ "primaryKey": false,
2889
+ "notNull": false,
2890
+ "autoincrement": false
2891
+ }
2892
+ },
2893
+ "indexes": {},
2894
+ "foreignKeys": {
2895
+ "suppressions_tenant_id_tenants_id_fk": {
2896
+ "name": "suppressions_tenant_id_tenants_id_fk",
2897
+ "tableFrom": "suppressions",
2898
+ "tableTo": "tenants",
2899
+ "columnsFrom": [
2900
+ "tenant_id"
2901
+ ],
2902
+ "columnsTo": [
2903
+ "id"
2904
+ ],
2905
+ "onDelete": "no action",
2906
+ "onUpdate": "no action"
2907
+ }
2908
+ },
2909
+ "compositePrimaryKeys": {},
2910
+ "uniqueConstraints": {},
2911
+ "checkConstraints": {}
2912
+ },
2913
+ "templates": {
2914
+ "name": "templates",
2915
+ "columns": {
2916
+ "id": {
2917
+ "name": "id",
2918
+ "type": "text",
2919
+ "primaryKey": true,
2920
+ "notNull": true,
2921
+ "autoincrement": false
2922
+ },
2923
+ "tenant_id": {
2924
+ "name": "tenant_id",
2925
+ "type": "text",
2926
+ "primaryKey": false,
2927
+ "notNull": true,
2928
+ "autoincrement": false
2929
+ },
2930
+ "name": {
2931
+ "name": "name",
2932
+ "type": "text",
2933
+ "primaryKey": false,
2934
+ "notNull": true,
2935
+ "autoincrement": false
2936
+ },
2937
+ "slug": {
2938
+ "name": "slug",
2939
+ "type": "text",
2940
+ "primaryKey": false,
2941
+ "notNull": true,
2942
+ "autoincrement": false
2943
+ },
2944
+ "subject": {
2945
+ "name": "subject",
2946
+ "type": "text",
2947
+ "primaryKey": false,
2948
+ "notNull": true,
2949
+ "autoincrement": false
2950
+ },
2951
+ "body_html": {
2952
+ "name": "body_html",
2953
+ "type": "text",
2954
+ "primaryKey": false,
2955
+ "notNull": true,
2956
+ "autoincrement": false
2957
+ },
2958
+ "body_text": {
2959
+ "name": "body_text",
2960
+ "type": "text",
2961
+ "primaryKey": false,
2962
+ "notNull": false,
2963
+ "autoincrement": false
2964
+ },
2965
+ "variables": {
2966
+ "name": "variables",
2967
+ "type": "text",
2968
+ "primaryKey": false,
2969
+ "notNull": false,
2970
+ "autoincrement": false
2971
+ },
2972
+ "category": {
2973
+ "name": "category",
2974
+ "type": "text",
2975
+ "primaryKey": false,
2976
+ "notNull": false,
2977
+ "autoincrement": false
2978
+ },
2979
+ "is_active": {
2980
+ "name": "is_active",
2981
+ "type": "integer",
2982
+ "primaryKey": false,
2983
+ "notNull": false,
2984
+ "autoincrement": false,
2985
+ "default": true
2986
+ },
2987
+ "created_at": {
2988
+ "name": "created_at",
2989
+ "type": "integer",
2990
+ "primaryKey": false,
2991
+ "notNull": false,
2992
+ "autoincrement": false
2993
+ }
2994
+ },
2995
+ "indexes": {
2996
+ "uq_templates_tenant_slug": {
2997
+ "name": "uq_templates_tenant_slug",
2998
+ "columns": [
2999
+ "tenant_id",
3000
+ "slug"
3001
+ ],
3002
+ "isUnique": true
3003
+ }
3004
+ },
3005
+ "foreignKeys": {
3006
+ "templates_tenant_id_tenants_id_fk": {
3007
+ "name": "templates_tenant_id_tenants_id_fk",
3008
+ "tableFrom": "templates",
3009
+ "tableTo": "tenants",
3010
+ "columnsFrom": [
3011
+ "tenant_id"
3012
+ ],
3013
+ "columnsTo": [
3014
+ "id"
3015
+ ],
3016
+ "onDelete": "no action",
3017
+ "onUpdate": "no action"
3018
+ }
3019
+ },
3020
+ "compositePrimaryKeys": {},
3021
+ "uniqueConstraints": {},
3022
+ "checkConstraints": {}
3023
+ },
3024
+ "tenant_daily_usage": {
3025
+ "name": "tenant_daily_usage",
3026
+ "columns": {
3027
+ "tenant_id": {
3028
+ "name": "tenant_id",
3029
+ "type": "text",
3030
+ "primaryKey": false,
3031
+ "notNull": true,
3032
+ "autoincrement": false
3033
+ },
3034
+ "day": {
3035
+ "name": "day",
3036
+ "type": "text",
3037
+ "primaryKey": false,
3038
+ "notNull": true,
3039
+ "autoincrement": false
3040
+ },
3041
+ "llm_tokens": {
3042
+ "name": "llm_tokens",
3043
+ "type": "integer",
3044
+ "primaryKey": false,
3045
+ "notNull": true,
3046
+ "autoincrement": false,
3047
+ "default": 0
3048
+ },
3049
+ "digest_sent_at": {
3050
+ "name": "digest_sent_at",
3051
+ "type": "integer",
3052
+ "primaryKey": false,
3053
+ "notNull": false,
3054
+ "autoincrement": false
3055
+ }
3056
+ },
3057
+ "indexes": {},
3058
+ "foreignKeys": {
3059
+ "tenant_daily_usage_tenant_id_tenants_id_fk": {
3060
+ "name": "tenant_daily_usage_tenant_id_tenants_id_fk",
3061
+ "tableFrom": "tenant_daily_usage",
3062
+ "tableTo": "tenants",
3063
+ "columnsFrom": [
3064
+ "tenant_id"
3065
+ ],
3066
+ "columnsTo": [
3067
+ "id"
3068
+ ],
3069
+ "onDelete": "no action",
3070
+ "onUpdate": "no action"
3071
+ }
3072
+ },
3073
+ "compositePrimaryKeys": {
3074
+ "tenant_daily_usage_pkey": {
3075
+ "columns": [
3076
+ "tenant_id",
3077
+ "day"
3078
+ ],
3079
+ "name": "tenant_daily_usage_pkey"
3080
+ }
3081
+ },
3082
+ "uniqueConstraints": {},
3083
+ "checkConstraints": {}
3084
+ },
3085
+ "tenants": {
3086
+ "name": "tenants",
3087
+ "columns": {
3088
+ "id": {
3089
+ "name": "id",
3090
+ "type": "text",
3091
+ "primaryKey": true,
3092
+ "notNull": true,
3093
+ "autoincrement": false
3094
+ },
3095
+ "name": {
3096
+ "name": "name",
3097
+ "type": "text",
3098
+ "primaryKey": false,
3099
+ "notNull": true,
3100
+ "autoincrement": false
3101
+ },
3102
+ "slug": {
3103
+ "name": "slug",
3104
+ "type": "text",
3105
+ "primaryKey": false,
3106
+ "notNull": true,
3107
+ "autoincrement": false
3108
+ },
3109
+ "plan": {
3110
+ "name": "plan",
3111
+ "type": "text",
3112
+ "primaryKey": false,
3113
+ "notNull": false,
3114
+ "autoincrement": false,
3115
+ "default": "'free'"
3116
+ },
3117
+ "settings": {
3118
+ "name": "settings",
3119
+ "type": "text",
3120
+ "primaryKey": false,
3121
+ "notNull": false,
3122
+ "autoincrement": false
3123
+ },
3124
+ "business_model": {
3125
+ "name": "business_model",
3126
+ "type": "text",
3127
+ "primaryKey": false,
3128
+ "notNull": false,
3129
+ "autoincrement": false
3130
+ },
3131
+ "created_at": {
3132
+ "name": "created_at",
3133
+ "type": "integer",
3134
+ "primaryKey": false,
3135
+ "notNull": false,
3136
+ "autoincrement": false
3137
+ },
3138
+ "archived_at": {
3139
+ "name": "archived_at",
3140
+ "type": "integer",
3141
+ "primaryKey": false,
3142
+ "notNull": false,
3143
+ "autoincrement": false
3144
+ },
3145
+ "public_host": {
3146
+ "name": "public_host",
3147
+ "type": "text",
3148
+ "primaryKey": false,
3149
+ "notNull": false,
3150
+ "autoincrement": false
3151
+ },
3152
+ "locale": {
3153
+ "name": "locale",
3154
+ "type": "text",
3155
+ "primaryKey": false,
3156
+ "notNull": false,
3157
+ "autoincrement": false
3158
+ },
3159
+ "config_version": {
3160
+ "name": "config_version",
3161
+ "type": "integer",
3162
+ "primaryKey": false,
3163
+ "notNull": true,
3164
+ "autoincrement": false,
3165
+ "default": 0
3166
+ }
3167
+ },
3168
+ "indexes": {
3169
+ "tenants_slug_unique": {
3170
+ "name": "tenants_slug_unique",
3171
+ "columns": [
3172
+ "slug"
3173
+ ],
3174
+ "isUnique": true
3175
+ },
3176
+ "uq_tenants_public_host": {
3177
+ "name": "uq_tenants_public_host",
3178
+ "columns": [
3179
+ "public_host"
3180
+ ],
3181
+ "isUnique": true,
3182
+ "where": "public_host IS NOT NULL"
3183
+ }
3184
+ },
3185
+ "foreignKeys": {},
3186
+ "compositePrimaryKeys": {},
3187
+ "uniqueConstraints": {},
3188
+ "checkConstraints": {}
3189
+ },
3190
+ "topics": {
3191
+ "name": "topics",
3192
+ "columns": {
3193
+ "id": {
3194
+ "name": "id",
3195
+ "type": "text",
3196
+ "primaryKey": true,
3197
+ "notNull": true,
3198
+ "autoincrement": false
3199
+ },
3200
+ "tenant_id": {
3201
+ "name": "tenant_id",
3202
+ "type": "text",
3203
+ "primaryKey": false,
3204
+ "notNull": true,
3205
+ "autoincrement": false
3206
+ },
3207
+ "slug": {
3208
+ "name": "slug",
3209
+ "type": "text",
3210
+ "primaryKey": false,
3211
+ "notNull": true,
3212
+ "autoincrement": false
3213
+ },
3214
+ "name": {
3215
+ "name": "name",
3216
+ "type": "text",
3217
+ "primaryKey": false,
3218
+ "notNull": true,
3219
+ "autoincrement": false
3220
+ },
3221
+ "kind": {
3222
+ "name": "kind",
3223
+ "type": "text",
3224
+ "primaryKey": false,
3225
+ "notNull": true,
3226
+ "autoincrement": false
3227
+ },
3228
+ "description": {
3229
+ "name": "description",
3230
+ "type": "text",
3231
+ "primaryKey": false,
3232
+ "notNull": false,
3233
+ "autoincrement": false
3234
+ },
3235
+ "default_subscribed": {
3236
+ "name": "default_subscribed",
3237
+ "type": "integer",
3238
+ "primaryKey": false,
3239
+ "notNull": true,
3240
+ "autoincrement": false,
3241
+ "default": true
3242
+ },
3243
+ "mirror_only": {
3244
+ "name": "mirror_only",
3245
+ "type": "integer",
3246
+ "primaryKey": false,
3247
+ "notNull": true,
3248
+ "autoincrement": false,
3249
+ "default": false
3250
+ },
3251
+ "created_at": {
3252
+ "name": "created_at",
3253
+ "type": "integer",
3254
+ "primaryKey": false,
3255
+ "notNull": false,
3256
+ "autoincrement": false
3257
+ }
3258
+ },
3259
+ "indexes": {
3260
+ "uq_topics_tenant_slug": {
3261
+ "name": "uq_topics_tenant_slug",
3262
+ "columns": [
3263
+ "tenant_id",
3264
+ "slug"
3265
+ ],
3266
+ "isUnique": true
3267
+ }
3268
+ },
3269
+ "foreignKeys": {
3270
+ "topics_tenant_id_tenants_id_fk": {
3271
+ "name": "topics_tenant_id_tenants_id_fk",
3272
+ "tableFrom": "topics",
3273
+ "tableTo": "tenants",
3274
+ "columnsFrom": [
3275
+ "tenant_id"
3276
+ ],
3277
+ "columnsTo": [
3278
+ "id"
3279
+ ],
3280
+ "onDelete": "no action",
3281
+ "onUpdate": "no action"
3282
+ }
3283
+ },
3284
+ "compositePrimaryKeys": {},
3285
+ "uniqueConstraints": {},
3286
+ "checkConstraints": {}
3287
+ },
3288
+ "transport_configs": {
3289
+ "name": "transport_configs",
3290
+ "columns": {
3291
+ "id": {
3292
+ "name": "id",
3293
+ "type": "text",
3294
+ "primaryKey": true,
3295
+ "notNull": true,
3296
+ "autoincrement": false
3297
+ },
3298
+ "tenant_id": {
3299
+ "name": "tenant_id",
3300
+ "type": "text",
3301
+ "primaryKey": false,
3302
+ "notNull": true,
3303
+ "autoincrement": false
3304
+ },
3305
+ "provider": {
3306
+ "name": "provider",
3307
+ "type": "text",
3308
+ "primaryKey": false,
3309
+ "notNull": true,
3310
+ "autoincrement": false
3311
+ },
3312
+ "config": {
3313
+ "name": "config",
3314
+ "type": "text",
3315
+ "primaryKey": false,
3316
+ "notNull": true,
3317
+ "autoincrement": false
3318
+ },
3319
+ "is_active": {
3320
+ "name": "is_active",
3321
+ "type": "integer",
3322
+ "primaryKey": false,
3323
+ "notNull": false,
3324
+ "autoincrement": false,
3325
+ "default": true
3326
+ },
3327
+ "dkim_verified": {
3328
+ "name": "dkim_verified",
3329
+ "type": "integer",
3330
+ "primaryKey": false,
3331
+ "notNull": false,
3332
+ "autoincrement": false,
3333
+ "default": false
3334
+ },
3335
+ "from_email": {
3336
+ "name": "from_email",
3337
+ "type": "text",
3338
+ "primaryKey": false,
3339
+ "notNull": true,
3340
+ "autoincrement": false
3341
+ },
3342
+ "from_name": {
3343
+ "name": "from_name",
3344
+ "type": "text",
3345
+ "primaryKey": false,
3346
+ "notNull": false,
3347
+ "autoincrement": false
3348
+ },
3349
+ "daily_limit": {
3350
+ "name": "daily_limit",
3351
+ "type": "integer",
3352
+ "primaryKey": false,
3353
+ "notNull": false,
3354
+ "autoincrement": false
3355
+ },
3356
+ "kind": {
3357
+ "name": "kind",
3358
+ "type": "text",
3359
+ "primaryKey": false,
3360
+ "notNull": false,
3361
+ "autoincrement": false
3362
+ },
3363
+ "name": {
3364
+ "name": "name",
3365
+ "type": "text",
3366
+ "primaryKey": false,
3367
+ "notNull": false,
3368
+ "autoincrement": false
3369
+ },
3370
+ "reply_to": {
3371
+ "name": "reply_to",
3372
+ "type": "text",
3373
+ "primaryKey": false,
3374
+ "notNull": false,
3375
+ "autoincrement": false
3376
+ },
3377
+ "created_at": {
3378
+ "name": "created_at",
3379
+ "type": "integer",
3380
+ "primaryKey": false,
3381
+ "notNull": false,
3382
+ "autoincrement": false
3383
+ }
3384
+ },
3385
+ "indexes": {},
3386
+ "foreignKeys": {
3387
+ "transport_configs_tenant_id_tenants_id_fk": {
3388
+ "name": "transport_configs_tenant_id_tenants_id_fk",
3389
+ "tableFrom": "transport_configs",
3390
+ "tableTo": "tenants",
3391
+ "columnsFrom": [
3392
+ "tenant_id"
3393
+ ],
3394
+ "columnsTo": [
3395
+ "id"
3396
+ ],
3397
+ "onDelete": "no action",
3398
+ "onUpdate": "no action"
3399
+ }
3400
+ },
3401
+ "compositePrimaryKeys": {},
3402
+ "uniqueConstraints": {},
3403
+ "checkConstraints": {}
3404
+ },
3405
+ "users": {
3406
+ "name": "users",
3407
+ "columns": {
3408
+ "id": {
3409
+ "name": "id",
3410
+ "type": "text",
3411
+ "primaryKey": true,
3412
+ "notNull": true,
3413
+ "autoincrement": false
3414
+ },
3415
+ "tenant_id": {
3416
+ "name": "tenant_id",
3417
+ "type": "text",
3418
+ "primaryKey": false,
3419
+ "notNull": true,
3420
+ "autoincrement": false
3421
+ },
3422
+ "email": {
3423
+ "name": "email",
3424
+ "type": "text",
3425
+ "primaryKey": false,
3426
+ "notNull": true,
3427
+ "autoincrement": false
3428
+ },
3429
+ "name": {
3430
+ "name": "name",
3431
+ "type": "text",
3432
+ "primaryKey": false,
3433
+ "notNull": false,
3434
+ "autoincrement": false
3435
+ },
3436
+ "role": {
3437
+ "name": "role",
3438
+ "type": "text",
3439
+ "primaryKey": false,
3440
+ "notNull": true,
3441
+ "autoincrement": false,
3442
+ "default": "'member'"
3443
+ },
3444
+ "instance_role": {
3445
+ "name": "instance_role",
3446
+ "type": "text",
3447
+ "primaryKey": false,
3448
+ "notNull": false,
3449
+ "autoincrement": false
3450
+ },
3451
+ "last_login_at": {
3452
+ "name": "last_login_at",
3453
+ "type": "integer",
3454
+ "primaryKey": false,
3455
+ "notNull": false,
3456
+ "autoincrement": false
3457
+ },
3458
+ "deactivated_at": {
3459
+ "name": "deactivated_at",
3460
+ "type": "integer",
3461
+ "primaryKey": false,
3462
+ "notNull": false,
3463
+ "autoincrement": false
3464
+ },
3465
+ "pending_email": {
3466
+ "name": "pending_email",
3467
+ "type": "text",
3468
+ "primaryKey": false,
3469
+ "notNull": false,
3470
+ "autoincrement": false
3471
+ },
3472
+ "pending_email_token_hash": {
3473
+ "name": "pending_email_token_hash",
3474
+ "type": "text",
3475
+ "primaryKey": false,
3476
+ "notNull": false,
3477
+ "autoincrement": false
3478
+ },
3479
+ "pending_email_expires_at": {
3480
+ "name": "pending_email_expires_at",
3481
+ "type": "integer",
3482
+ "primaryKey": false,
3483
+ "notNull": false,
3484
+ "autoincrement": false
3485
+ },
3486
+ "created_at": {
3487
+ "name": "created_at",
3488
+ "type": "integer",
3489
+ "primaryKey": false,
3490
+ "notNull": false,
3491
+ "autoincrement": false
3492
+ }
3493
+ },
3494
+ "indexes": {
3495
+ "uq_users_tenant_email": {
3496
+ "name": "uq_users_tenant_email",
3497
+ "columns": [
3498
+ "tenant_id",
3499
+ "email"
3500
+ ],
3501
+ "isUnique": true
3502
+ }
3503
+ },
3504
+ "foreignKeys": {
3505
+ "users_tenant_id_tenants_id_fk": {
3506
+ "name": "users_tenant_id_tenants_id_fk",
3507
+ "tableFrom": "users",
3508
+ "tableTo": "tenants",
3509
+ "columnsFrom": [
3510
+ "tenant_id"
3511
+ ],
3512
+ "columnsTo": [
3513
+ "id"
3514
+ ],
3515
+ "onDelete": "no action",
3516
+ "onUpdate": "no action"
3517
+ }
3518
+ },
3519
+ "compositePrimaryKeys": {},
3520
+ "uniqueConstraints": {},
3521
+ "checkConstraints": {}
3522
+ },
3523
+ "webhook_endpoints": {
3524
+ "name": "webhook_endpoints",
3525
+ "columns": {
3526
+ "id": {
3527
+ "name": "id",
3528
+ "type": "text",
3529
+ "primaryKey": true,
3530
+ "notNull": true,
3531
+ "autoincrement": false
3532
+ },
3533
+ "tenant_id": {
3534
+ "name": "tenant_id",
3535
+ "type": "text",
3536
+ "primaryKey": false,
3537
+ "notNull": true,
3538
+ "autoincrement": false
3539
+ },
3540
+ "slug": {
3541
+ "name": "slug",
3542
+ "type": "text",
3543
+ "primaryKey": false,
3544
+ "notNull": true,
3545
+ "autoincrement": false
3546
+ },
3547
+ "kind": {
3548
+ "name": "kind",
3549
+ "type": "text",
3550
+ "primaryKey": false,
3551
+ "notNull": true,
3552
+ "autoincrement": false,
3553
+ "default": "'webhook'"
3554
+ },
3555
+ "url": {
3556
+ "name": "url",
3557
+ "type": "text",
3558
+ "primaryKey": false,
3559
+ "notNull": true,
3560
+ "autoincrement": false
3561
+ },
3562
+ "secret": {
3563
+ "name": "secret",
3564
+ "type": "text",
3565
+ "primaryKey": false,
3566
+ "notNull": false,
3567
+ "autoincrement": false
3568
+ },
3569
+ "events": {
3570
+ "name": "events",
3571
+ "type": "text",
3572
+ "primaryKey": false,
3573
+ "notNull": true,
3574
+ "autoincrement": false
3575
+ },
3576
+ "config": {
3577
+ "name": "config",
3578
+ "type": "text",
3579
+ "primaryKey": false,
3580
+ "notNull": false,
3581
+ "autoincrement": false
3582
+ },
3583
+ "enabled": {
3584
+ "name": "enabled",
3585
+ "type": "integer",
3586
+ "primaryKey": false,
3587
+ "notNull": true,
3588
+ "autoincrement": false,
3589
+ "default": true
3590
+ },
3591
+ "created_at": {
3592
+ "name": "created_at",
3593
+ "type": "integer",
3594
+ "primaryKey": false,
3595
+ "notNull": false,
3596
+ "autoincrement": false
3597
+ },
3598
+ "updated_at": {
3599
+ "name": "updated_at",
3600
+ "type": "integer",
3601
+ "primaryKey": false,
3602
+ "notNull": false,
3603
+ "autoincrement": false
3604
+ }
3605
+ },
3606
+ "indexes": {
3607
+ "uq_webhook_endpoints_tenant_slug": {
3608
+ "name": "uq_webhook_endpoints_tenant_slug",
3609
+ "columns": [
3610
+ "tenant_id",
3611
+ "slug"
3612
+ ],
3613
+ "isUnique": true
3614
+ }
3615
+ },
3616
+ "foreignKeys": {
3617
+ "webhook_endpoints_tenant_id_tenants_id_fk": {
3618
+ "name": "webhook_endpoints_tenant_id_tenants_id_fk",
3619
+ "tableFrom": "webhook_endpoints",
3620
+ "tableTo": "tenants",
3621
+ "columnsFrom": [
3622
+ "tenant_id"
3623
+ ],
3624
+ "columnsTo": [
3625
+ "id"
3626
+ ],
3627
+ "onDelete": "no action",
3628
+ "onUpdate": "no action"
3629
+ }
3630
+ },
3631
+ "compositePrimaryKeys": {},
3632
+ "uniqueConstraints": {},
3633
+ "checkConstraints": {}
3634
+ },
3635
+ "webhook_outbox": {
3636
+ "name": "webhook_outbox",
3637
+ "columns": {
3638
+ "id": {
3639
+ "name": "id",
3640
+ "type": "text",
3641
+ "primaryKey": true,
3642
+ "notNull": true,
3643
+ "autoincrement": false
3644
+ },
3645
+ "tenant_id": {
3646
+ "name": "tenant_id",
3647
+ "type": "text",
3648
+ "primaryKey": false,
3649
+ "notNull": true,
3650
+ "autoincrement": false
3651
+ },
3652
+ "endpoint_id": {
3653
+ "name": "endpoint_id",
3654
+ "type": "text",
3655
+ "primaryKey": false,
3656
+ "notNull": true,
3657
+ "autoincrement": false
3658
+ },
3659
+ "event": {
3660
+ "name": "event",
3661
+ "type": "text",
3662
+ "primaryKey": false,
3663
+ "notNull": true,
3664
+ "autoincrement": false
3665
+ },
3666
+ "payload": {
3667
+ "name": "payload",
3668
+ "type": "text",
3669
+ "primaryKey": false,
3670
+ "notNull": true,
3671
+ "autoincrement": false
3672
+ },
3673
+ "status": {
3674
+ "name": "status",
3675
+ "type": "text",
3676
+ "primaryKey": false,
3677
+ "notNull": true,
3678
+ "autoincrement": false,
3679
+ "default": "'pending'"
3680
+ },
3681
+ "attempts": {
3682
+ "name": "attempts",
3683
+ "type": "integer",
3684
+ "primaryKey": false,
3685
+ "notNull": true,
3686
+ "autoincrement": false,
3687
+ "default": 0
3688
+ },
3689
+ "next_attempt_at": {
3690
+ "name": "next_attempt_at",
3691
+ "type": "integer",
3692
+ "primaryKey": false,
3693
+ "notNull": true,
3694
+ "autoincrement": false
3695
+ },
3696
+ "last_error": {
3697
+ "name": "last_error",
3698
+ "type": "text",
3699
+ "primaryKey": false,
3700
+ "notNull": false,
3701
+ "autoincrement": false
3702
+ },
3703
+ "dedup_key": {
3704
+ "name": "dedup_key",
3705
+ "type": "text",
3706
+ "primaryKey": false,
3707
+ "notNull": false,
3708
+ "autoincrement": false
3709
+ },
3710
+ "created_at": {
3711
+ "name": "created_at",
3712
+ "type": "integer",
3713
+ "primaryKey": false,
3714
+ "notNull": true,
3715
+ "autoincrement": false
3716
+ },
3717
+ "delivered_at": {
3718
+ "name": "delivered_at",
3719
+ "type": "integer",
3720
+ "primaryKey": false,
3721
+ "notNull": false,
3722
+ "autoincrement": false
3723
+ }
3724
+ },
3725
+ "indexes": {
3726
+ "idx_webhook_outbox_due": {
3727
+ "name": "idx_webhook_outbox_due",
3728
+ "columns": [
3729
+ "tenant_id",
3730
+ "next_attempt_at"
3731
+ ],
3732
+ "isUnique": false,
3733
+ "where": "status = 'pending'"
3734
+ },
3735
+ "idx_webhook_outbox_tenant_event": {
3736
+ "name": "idx_webhook_outbox_tenant_event",
3737
+ "columns": [
3738
+ "tenant_id",
3739
+ "event",
3740
+ "created_at"
3741
+ ],
3742
+ "isUnique": false
3743
+ },
3744
+ "uq_webhook_outbox_dedup": {
3745
+ "name": "uq_webhook_outbox_dedup",
3746
+ "columns": [
3747
+ "tenant_id",
3748
+ "endpoint_id",
3749
+ "dedup_key"
3750
+ ],
3751
+ "isUnique": true,
3752
+ "where": "dedup_key IS NOT NULL"
3753
+ }
3754
+ },
3755
+ "foreignKeys": {
3756
+ "webhook_outbox_tenant_id_tenants_id_fk": {
3757
+ "name": "webhook_outbox_tenant_id_tenants_id_fk",
3758
+ "tableFrom": "webhook_outbox",
3759
+ "tableTo": "tenants",
3760
+ "columnsFrom": [
3761
+ "tenant_id"
3762
+ ],
3763
+ "columnsTo": [
3764
+ "id"
3765
+ ],
3766
+ "onDelete": "no action",
3767
+ "onUpdate": "no action"
3768
+ }
3769
+ },
3770
+ "compositePrimaryKeys": {},
3771
+ "uniqueConstraints": {},
3772
+ "checkConstraints": {}
3773
+ }
3774
+ },
3775
+ "views": {},
3776
+ "enums": {},
3777
+ "_meta": {
3778
+ "schemas": {},
3779
+ "tables": {},
3780
+ "columns": {}
3781
+ },
3782
+ "internal": {
3783
+ "indexes": {}
3784
+ }
3785
+ }