@claroshq/claros 0.0.0-stage → 0.8.3

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 +57863 -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,3709 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "b74d4dd1-1b45-4402-baf8-a4024760922d",
5
+ "prevId": "958ad852-09d3-49d8-a439-c10b567dcec3",
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
+ },
901
+ "indexes": {
902
+ "uq_flow_membership_active": {
903
+ "name": "uq_flow_membership_active",
904
+ "columns": [
905
+ "contact_id",
906
+ "flow_id"
907
+ ],
908
+ "isUnique": true,
909
+ "where": "status = 'active'"
910
+ },
911
+ "uq_flow_membership_anchor": {
912
+ "name": "uq_flow_membership_anchor",
913
+ "columns": [
914
+ "tenant_id",
915
+ "flow_id",
916
+ "contact_id",
917
+ "anchor_at"
918
+ ],
919
+ "isUnique": true,
920
+ "where": "anchor_at IS NOT NULL"
921
+ },
922
+ "idx_flow_members_contact": {
923
+ "name": "idx_flow_members_contact",
924
+ "columns": [
925
+ "contact_id",
926
+ "status"
927
+ ],
928
+ "isUnique": false
929
+ },
930
+ "idx_flow_members_flow": {
931
+ "name": "idx_flow_members_flow",
932
+ "columns": [
933
+ "flow_id",
934
+ "status",
935
+ "current_step"
936
+ ],
937
+ "isUnique": false
938
+ }
939
+ },
940
+ "foreignKeys": {
941
+ "flow_memberships_tenant_id_tenants_id_fk": {
942
+ "name": "flow_memberships_tenant_id_tenants_id_fk",
943
+ "tableFrom": "flow_memberships",
944
+ "tableTo": "tenants",
945
+ "columnsFrom": [
946
+ "tenant_id"
947
+ ],
948
+ "columnsTo": [
949
+ "id"
950
+ ],
951
+ "onDelete": "no action",
952
+ "onUpdate": "no action"
953
+ },
954
+ "flow_memberships_contact_id_contacts_id_fk": {
955
+ "name": "flow_memberships_contact_id_contacts_id_fk",
956
+ "tableFrom": "flow_memberships",
957
+ "tableTo": "contacts",
958
+ "columnsFrom": [
959
+ "contact_id"
960
+ ],
961
+ "columnsTo": [
962
+ "id"
963
+ ],
964
+ "onDelete": "no action",
965
+ "onUpdate": "no action"
966
+ },
967
+ "flow_memberships_flow_id_flows_id_fk": {
968
+ "name": "flow_memberships_flow_id_flows_id_fk",
969
+ "tableFrom": "flow_memberships",
970
+ "tableTo": "flows",
971
+ "columnsFrom": [
972
+ "flow_id"
973
+ ],
974
+ "columnsTo": [
975
+ "id"
976
+ ],
977
+ "onDelete": "no action",
978
+ "onUpdate": "no action"
979
+ }
980
+ },
981
+ "compositePrimaryKeys": {},
982
+ "uniqueConstraints": {},
983
+ "checkConstraints": {}
984
+ },
985
+ "flows": {
986
+ "name": "flows",
987
+ "columns": {
988
+ "id": {
989
+ "name": "id",
990
+ "type": "text",
991
+ "primaryKey": true,
992
+ "notNull": true,
993
+ "autoincrement": false
994
+ },
995
+ "tenant_id": {
996
+ "name": "tenant_id",
997
+ "type": "text",
998
+ "primaryKey": false,
999
+ "notNull": true,
1000
+ "autoincrement": false
1001
+ },
1002
+ "name": {
1003
+ "name": "name",
1004
+ "type": "text",
1005
+ "primaryKey": false,
1006
+ "notNull": true,
1007
+ "autoincrement": false
1008
+ },
1009
+ "description": {
1010
+ "name": "description",
1011
+ "type": "text",
1012
+ "primaryKey": false,
1013
+ "notNull": false,
1014
+ "autoincrement": false
1015
+ },
1016
+ "priority": {
1017
+ "name": "priority",
1018
+ "type": "integer",
1019
+ "primaryKey": false,
1020
+ "notNull": false,
1021
+ "autoincrement": false,
1022
+ "default": 0
1023
+ },
1024
+ "trigger_type": {
1025
+ "name": "trigger_type",
1026
+ "type": "text",
1027
+ "primaryKey": false,
1028
+ "notNull": true,
1029
+ "autoincrement": false
1030
+ },
1031
+ "trigger_config": {
1032
+ "name": "trigger_config",
1033
+ "type": "text",
1034
+ "primaryKey": false,
1035
+ "notNull": true,
1036
+ "autoincrement": false
1037
+ },
1038
+ "steps": {
1039
+ "name": "steps",
1040
+ "type": "text",
1041
+ "primaryKey": false,
1042
+ "notNull": true,
1043
+ "autoincrement": false
1044
+ },
1045
+ "source": {
1046
+ "name": "source",
1047
+ "type": "text",
1048
+ "primaryKey": false,
1049
+ "notNull": false,
1050
+ "autoincrement": false,
1051
+ "default": "'manual'"
1052
+ },
1053
+ "content_mode": {
1054
+ "name": "content_mode",
1055
+ "type": "text",
1056
+ "primaryKey": false,
1057
+ "notNull": false,
1058
+ "autoincrement": false,
1059
+ "default": "'ai_drafted'"
1060
+ },
1061
+ "status": {
1062
+ "name": "status",
1063
+ "type": "text",
1064
+ "primaryKey": false,
1065
+ "notNull": false,
1066
+ "autoincrement": false,
1067
+ "default": "'draft'"
1068
+ },
1069
+ "approval_mode": {
1070
+ "name": "approval_mode",
1071
+ "type": "text",
1072
+ "primaryKey": false,
1073
+ "notNull": false,
1074
+ "autoincrement": false,
1075
+ "default": "'require'"
1076
+ },
1077
+ "flow_class": {
1078
+ "name": "flow_class",
1079
+ "type": "text",
1080
+ "primaryKey": false,
1081
+ "notNull": true,
1082
+ "autoincrement": false,
1083
+ "default": "'nurture'"
1084
+ },
1085
+ "reentry_policy": {
1086
+ "name": "reentry_policy",
1087
+ "type": "text",
1088
+ "primaryKey": false,
1089
+ "notNull": true,
1090
+ "autoincrement": false,
1091
+ "default": "'cooldown'"
1092
+ },
1093
+ "reentry_cooldown_days": {
1094
+ "name": "reentry_cooldown_days",
1095
+ "type": "integer",
1096
+ "primaryKey": false,
1097
+ "notNull": false,
1098
+ "autoincrement": false,
1099
+ "default": 30
1100
+ },
1101
+ "prompt_source": {
1102
+ "name": "prompt_source",
1103
+ "type": "text",
1104
+ "primaryKey": false,
1105
+ "notNull": false,
1106
+ "autoincrement": false
1107
+ },
1108
+ "compiled_plan": {
1109
+ "name": "compiled_plan",
1110
+ "type": "text",
1111
+ "primaryKey": false,
1112
+ "notNull": false,
1113
+ "autoincrement": false
1114
+ },
1115
+ "compiled_at": {
1116
+ "name": "compiled_at",
1117
+ "type": "integer",
1118
+ "primaryKey": false,
1119
+ "notNull": false,
1120
+ "autoincrement": false
1121
+ },
1122
+ "compile_status": {
1123
+ "name": "compile_status",
1124
+ "type": "text",
1125
+ "primaryKey": false,
1126
+ "notNull": false,
1127
+ "autoincrement": false
1128
+ },
1129
+ "compile_error": {
1130
+ "name": "compile_error",
1131
+ "type": "text",
1132
+ "primaryKey": false,
1133
+ "notNull": false,
1134
+ "autoincrement": false
1135
+ },
1136
+ "topic_id": {
1137
+ "name": "topic_id",
1138
+ "type": "text",
1139
+ "primaryKey": false,
1140
+ "notNull": false,
1141
+ "autoincrement": false
1142
+ },
1143
+ "slug": {
1144
+ "name": "slug",
1145
+ "type": "text",
1146
+ "primaryKey": false,
1147
+ "notNull": false,
1148
+ "autoincrement": false
1149
+ },
1150
+ "created_at": {
1151
+ "name": "created_at",
1152
+ "type": "integer",
1153
+ "primaryKey": false,
1154
+ "notNull": false,
1155
+ "autoincrement": false
1156
+ },
1157
+ "updated_at": {
1158
+ "name": "updated_at",
1159
+ "type": "integer",
1160
+ "primaryKey": false,
1161
+ "notNull": false,
1162
+ "autoincrement": false
1163
+ }
1164
+ },
1165
+ "indexes": {
1166
+ "uq_flows_tenant_slug": {
1167
+ "name": "uq_flows_tenant_slug",
1168
+ "columns": [
1169
+ "tenant_id",
1170
+ "slug"
1171
+ ],
1172
+ "isUnique": true,
1173
+ "where": "slug IS NOT NULL"
1174
+ }
1175
+ },
1176
+ "foreignKeys": {
1177
+ "flows_tenant_id_tenants_id_fk": {
1178
+ "name": "flows_tenant_id_tenants_id_fk",
1179
+ "tableFrom": "flows",
1180
+ "tableTo": "tenants",
1181
+ "columnsFrom": [
1182
+ "tenant_id"
1183
+ ],
1184
+ "columnsTo": [
1185
+ "id"
1186
+ ],
1187
+ "onDelete": "no action",
1188
+ "onUpdate": "no action"
1189
+ },
1190
+ "flows_topic_id_topics_id_fk": {
1191
+ "name": "flows_topic_id_topics_id_fk",
1192
+ "tableFrom": "flows",
1193
+ "tableTo": "topics",
1194
+ "columnsFrom": [
1195
+ "topic_id"
1196
+ ],
1197
+ "columnsTo": [
1198
+ "id"
1199
+ ],
1200
+ "onDelete": "no action",
1201
+ "onUpdate": "no action"
1202
+ }
1203
+ },
1204
+ "compositePrimaryKeys": {},
1205
+ "uniqueConstraints": {},
1206
+ "checkConstraints": {}
1207
+ },
1208
+ "instance_settings": {
1209
+ "name": "instance_settings",
1210
+ "columns": {
1211
+ "key": {
1212
+ "name": "key",
1213
+ "type": "text",
1214
+ "primaryKey": true,
1215
+ "notNull": true,
1216
+ "autoincrement": false
1217
+ },
1218
+ "value": {
1219
+ "name": "value",
1220
+ "type": "text",
1221
+ "primaryKey": false,
1222
+ "notNull": true,
1223
+ "autoincrement": false
1224
+ },
1225
+ "updated_at": {
1226
+ "name": "updated_at",
1227
+ "type": "integer",
1228
+ "primaryKey": false,
1229
+ "notNull": false,
1230
+ "autoincrement": false
1231
+ }
1232
+ },
1233
+ "indexes": {},
1234
+ "foreignKeys": {},
1235
+ "compositePrimaryKeys": {},
1236
+ "uniqueConstraints": {},
1237
+ "checkConstraints": {}
1238
+ },
1239
+ "invites": {
1240
+ "name": "invites",
1241
+ "columns": {
1242
+ "id": {
1243
+ "name": "id",
1244
+ "type": "text",
1245
+ "primaryKey": true,
1246
+ "notNull": true,
1247
+ "autoincrement": false
1248
+ },
1249
+ "tenant_id": {
1250
+ "name": "tenant_id",
1251
+ "type": "text",
1252
+ "primaryKey": false,
1253
+ "notNull": true,
1254
+ "autoincrement": false
1255
+ },
1256
+ "email": {
1257
+ "name": "email",
1258
+ "type": "text",
1259
+ "primaryKey": false,
1260
+ "notNull": true,
1261
+ "autoincrement": false
1262
+ },
1263
+ "role": {
1264
+ "name": "role",
1265
+ "type": "text",
1266
+ "primaryKey": false,
1267
+ "notNull": true,
1268
+ "autoincrement": false,
1269
+ "default": "'member'"
1270
+ },
1271
+ "token_hash": {
1272
+ "name": "token_hash",
1273
+ "type": "text",
1274
+ "primaryKey": false,
1275
+ "notNull": true,
1276
+ "autoincrement": false
1277
+ },
1278
+ "invited_by": {
1279
+ "name": "invited_by",
1280
+ "type": "text",
1281
+ "primaryKey": false,
1282
+ "notNull": true,
1283
+ "autoincrement": false
1284
+ },
1285
+ "expires_at": {
1286
+ "name": "expires_at",
1287
+ "type": "integer",
1288
+ "primaryKey": false,
1289
+ "notNull": true,
1290
+ "autoincrement": false
1291
+ },
1292
+ "accepted_at": {
1293
+ "name": "accepted_at",
1294
+ "type": "integer",
1295
+ "primaryKey": false,
1296
+ "notNull": false,
1297
+ "autoincrement": false
1298
+ },
1299
+ "created_at": {
1300
+ "name": "created_at",
1301
+ "type": "integer",
1302
+ "primaryKey": false,
1303
+ "notNull": false,
1304
+ "autoincrement": false
1305
+ }
1306
+ },
1307
+ "indexes": {
1308
+ "idx_invites_token_hash": {
1309
+ "name": "idx_invites_token_hash",
1310
+ "columns": [
1311
+ "token_hash"
1312
+ ],
1313
+ "isUnique": false
1314
+ },
1315
+ "idx_invites_tenant": {
1316
+ "name": "idx_invites_tenant",
1317
+ "columns": [
1318
+ "tenant_id"
1319
+ ],
1320
+ "isUnique": false
1321
+ }
1322
+ },
1323
+ "foreignKeys": {
1324
+ "invites_tenant_id_tenants_id_fk": {
1325
+ "name": "invites_tenant_id_tenants_id_fk",
1326
+ "tableFrom": "invites",
1327
+ "tableTo": "tenants",
1328
+ "columnsFrom": [
1329
+ "tenant_id"
1330
+ ],
1331
+ "columnsTo": [
1332
+ "id"
1333
+ ],
1334
+ "onDelete": "no action",
1335
+ "onUpdate": "no action"
1336
+ },
1337
+ "invites_invited_by_users_id_fk": {
1338
+ "name": "invites_invited_by_users_id_fk",
1339
+ "tableFrom": "invites",
1340
+ "tableTo": "users",
1341
+ "columnsFrom": [
1342
+ "invited_by"
1343
+ ],
1344
+ "columnsTo": [
1345
+ "id"
1346
+ ],
1347
+ "onDelete": "no action",
1348
+ "onUpdate": "no action"
1349
+ }
1350
+ },
1351
+ "compositePrimaryKeys": {},
1352
+ "uniqueConstraints": {},
1353
+ "checkConstraints": {}
1354
+ },
1355
+ "kb_entries": {
1356
+ "name": "kb_entries",
1357
+ "columns": {
1358
+ "id": {
1359
+ "name": "id",
1360
+ "type": "text",
1361
+ "primaryKey": true,
1362
+ "notNull": true,
1363
+ "autoincrement": false
1364
+ },
1365
+ "tenant_id": {
1366
+ "name": "tenant_id",
1367
+ "type": "text",
1368
+ "primaryKey": false,
1369
+ "notNull": true,
1370
+ "autoincrement": false
1371
+ },
1372
+ "title": {
1373
+ "name": "title",
1374
+ "type": "text",
1375
+ "primaryKey": false,
1376
+ "notNull": true,
1377
+ "autoincrement": false
1378
+ },
1379
+ "content": {
1380
+ "name": "content",
1381
+ "type": "text",
1382
+ "primaryKey": false,
1383
+ "notNull": true,
1384
+ "autoincrement": false
1385
+ },
1386
+ "content_type": {
1387
+ "name": "content_type",
1388
+ "type": "text",
1389
+ "primaryKey": false,
1390
+ "notNull": false,
1391
+ "autoincrement": false,
1392
+ "default": "'markdown'"
1393
+ },
1394
+ "source": {
1395
+ "name": "source",
1396
+ "type": "text",
1397
+ "primaryKey": false,
1398
+ "notNull": false,
1399
+ "autoincrement": false,
1400
+ "default": "'manual'"
1401
+ },
1402
+ "source_url": {
1403
+ "name": "source_url",
1404
+ "type": "text",
1405
+ "primaryKey": false,
1406
+ "notNull": false,
1407
+ "autoincrement": false
1408
+ },
1409
+ "tags": {
1410
+ "name": "tags",
1411
+ "type": "text",
1412
+ "primaryKey": false,
1413
+ "notNull": false,
1414
+ "autoincrement": false
1415
+ },
1416
+ "embedding": {
1417
+ "name": "embedding",
1418
+ "type": "text",
1419
+ "primaryKey": false,
1420
+ "notNull": false,
1421
+ "autoincrement": false
1422
+ },
1423
+ "embedding_status": {
1424
+ "name": "embedding_status",
1425
+ "type": "text",
1426
+ "primaryKey": false,
1427
+ "notNull": false,
1428
+ "autoincrement": false
1429
+ },
1430
+ "embedding_error": {
1431
+ "name": "embedding_error",
1432
+ "type": "text",
1433
+ "primaryKey": false,
1434
+ "notNull": false,
1435
+ "autoincrement": false
1436
+ },
1437
+ "is_active": {
1438
+ "name": "is_active",
1439
+ "type": "integer",
1440
+ "primaryKey": false,
1441
+ "notNull": false,
1442
+ "autoincrement": false,
1443
+ "default": true
1444
+ },
1445
+ "category": {
1446
+ "name": "category",
1447
+ "type": "text",
1448
+ "primaryKey": false,
1449
+ "notNull": false,
1450
+ "autoincrement": false
1451
+ },
1452
+ "external_key": {
1453
+ "name": "external_key",
1454
+ "type": "text",
1455
+ "primaryKey": false,
1456
+ "notNull": false,
1457
+ "autoincrement": false
1458
+ },
1459
+ "data": {
1460
+ "name": "data",
1461
+ "type": "text",
1462
+ "primaryKey": false,
1463
+ "notNull": false,
1464
+ "autoincrement": false
1465
+ },
1466
+ "pinned": {
1467
+ "name": "pinned",
1468
+ "type": "integer",
1469
+ "primaryKey": false,
1470
+ "notNull": true,
1471
+ "autoincrement": false,
1472
+ "default": false
1473
+ },
1474
+ "imported_at": {
1475
+ "name": "imported_at",
1476
+ "type": "integer",
1477
+ "primaryKey": false,
1478
+ "notNull": false,
1479
+ "autoincrement": false
1480
+ },
1481
+ "created_at": {
1482
+ "name": "created_at",
1483
+ "type": "integer",
1484
+ "primaryKey": false,
1485
+ "notNull": false,
1486
+ "autoincrement": false
1487
+ },
1488
+ "updated_at": {
1489
+ "name": "updated_at",
1490
+ "type": "integer",
1491
+ "primaryKey": false,
1492
+ "notNull": false,
1493
+ "autoincrement": false
1494
+ }
1495
+ },
1496
+ "indexes": {
1497
+ "idx_kb_entries_tenant_created": {
1498
+ "name": "idx_kb_entries_tenant_created",
1499
+ "columns": [
1500
+ "tenant_id",
1501
+ "created_at",
1502
+ "id"
1503
+ ],
1504
+ "isUnique": false
1505
+ },
1506
+ "uq_kb_entries_external_key": {
1507
+ "name": "uq_kb_entries_external_key",
1508
+ "columns": [
1509
+ "tenant_id",
1510
+ "external_key"
1511
+ ],
1512
+ "isUnique": true,
1513
+ "where": "external_key IS NOT NULL"
1514
+ },
1515
+ "idx_kb_entries_category": {
1516
+ "name": "idx_kb_entries_category",
1517
+ "columns": [
1518
+ "tenant_id",
1519
+ "category"
1520
+ ],
1521
+ "isUnique": false
1522
+ }
1523
+ },
1524
+ "foreignKeys": {
1525
+ "kb_entries_tenant_id_tenants_id_fk": {
1526
+ "name": "kb_entries_tenant_id_tenants_id_fk",
1527
+ "tableFrom": "kb_entries",
1528
+ "tableTo": "tenants",
1529
+ "columnsFrom": [
1530
+ "tenant_id"
1531
+ ],
1532
+ "columnsTo": [
1533
+ "id"
1534
+ ],
1535
+ "onDelete": "no action",
1536
+ "onUpdate": "no action"
1537
+ }
1538
+ },
1539
+ "compositePrimaryKeys": {},
1540
+ "uniqueConstraints": {},
1541
+ "checkConstraints": {}
1542
+ },
1543
+ "lifecycle_messages": {
1544
+ "name": "lifecycle_messages",
1545
+ "columns": {
1546
+ "id": {
1547
+ "name": "id",
1548
+ "type": "text",
1549
+ "primaryKey": true,
1550
+ "notNull": true,
1551
+ "autoincrement": false
1552
+ },
1553
+ "tenant_id": {
1554
+ "name": "tenant_id",
1555
+ "type": "text",
1556
+ "primaryKey": false,
1557
+ "notNull": true,
1558
+ "autoincrement": false
1559
+ },
1560
+ "contact_id": {
1561
+ "name": "contact_id",
1562
+ "type": "text",
1563
+ "primaryKey": false,
1564
+ "notNull": true,
1565
+ "autoincrement": false
1566
+ },
1567
+ "flow_id": {
1568
+ "name": "flow_id",
1569
+ "type": "text",
1570
+ "primaryKey": false,
1571
+ "notNull": true,
1572
+ "autoincrement": false
1573
+ },
1574
+ "membership_id": {
1575
+ "name": "membership_id",
1576
+ "type": "text",
1577
+ "primaryKey": false,
1578
+ "notNull": true,
1579
+ "autoincrement": false
1580
+ },
1581
+ "flow_step_order": {
1582
+ "name": "flow_step_order",
1583
+ "type": "integer",
1584
+ "primaryKey": false,
1585
+ "notNull": false,
1586
+ "autoincrement": false
1587
+ },
1588
+ "status": {
1589
+ "name": "status",
1590
+ "type": "text",
1591
+ "primaryKey": false,
1592
+ "notNull": true,
1593
+ "autoincrement": false
1594
+ },
1595
+ "feedback": {
1596
+ "name": "feedback",
1597
+ "type": "text",
1598
+ "primaryKey": false,
1599
+ "notNull": false,
1600
+ "autoincrement": false
1601
+ },
1602
+ "subject": {
1603
+ "name": "subject",
1604
+ "type": "text",
1605
+ "primaryKey": false,
1606
+ "notNull": false,
1607
+ "autoincrement": false
1608
+ },
1609
+ "body_html": {
1610
+ "name": "body_html",
1611
+ "type": "text",
1612
+ "primaryKey": false,
1613
+ "notNull": false,
1614
+ "autoincrement": false
1615
+ },
1616
+ "body_text": {
1617
+ "name": "body_text",
1618
+ "type": "text",
1619
+ "primaryKey": false,
1620
+ "notNull": false,
1621
+ "autoincrement": false
1622
+ },
1623
+ "brain_reasoning": {
1624
+ "name": "brain_reasoning",
1625
+ "type": "text",
1626
+ "primaryKey": false,
1627
+ "notNull": false,
1628
+ "autoincrement": false
1629
+ },
1630
+ "brain_action_type": {
1631
+ "name": "brain_action_type",
1632
+ "type": "text",
1633
+ "primaryKey": false,
1634
+ "notNull": false,
1635
+ "autoincrement": false
1636
+ },
1637
+ "scheduled_send_at": {
1638
+ "name": "scheduled_send_at",
1639
+ "type": "integer",
1640
+ "primaryKey": false,
1641
+ "notNull": false,
1642
+ "autoincrement": false
1643
+ },
1644
+ "approved_at": {
1645
+ "name": "approved_at",
1646
+ "type": "integer",
1647
+ "primaryKey": false,
1648
+ "notNull": false,
1649
+ "autoincrement": false
1650
+ },
1651
+ "sent_at": {
1652
+ "name": "sent_at",
1653
+ "type": "integer",
1654
+ "primaryKey": false,
1655
+ "notNull": false,
1656
+ "autoincrement": false
1657
+ },
1658
+ "retry_count": {
1659
+ "name": "retry_count",
1660
+ "type": "integer",
1661
+ "primaryKey": false,
1662
+ "notNull": false,
1663
+ "autoincrement": false,
1664
+ "default": 0
1665
+ },
1666
+ "provider_message_id": {
1667
+ "name": "provider_message_id",
1668
+ "type": "text",
1669
+ "primaryKey": false,
1670
+ "notNull": false,
1671
+ "autoincrement": false
1672
+ },
1673
+ "recipient_address": {
1674
+ "name": "recipient_address",
1675
+ "type": "text",
1676
+ "primaryKey": false,
1677
+ "notNull": false,
1678
+ "autoincrement": false
1679
+ },
1680
+ "topic_id": {
1681
+ "name": "topic_id",
1682
+ "type": "text",
1683
+ "primaryKey": false,
1684
+ "notNull": false,
1685
+ "autoincrement": false
1686
+ },
1687
+ "transport_id": {
1688
+ "name": "transport_id",
1689
+ "type": "text",
1690
+ "primaryKey": false,
1691
+ "notNull": false,
1692
+ "autoincrement": false
1693
+ },
1694
+ "status_reason": {
1695
+ "name": "status_reason",
1696
+ "type": "text",
1697
+ "primaryKey": false,
1698
+ "notNull": false,
1699
+ "autoincrement": false
1700
+ },
1701
+ "approved_by": {
1702
+ "name": "approved_by",
1703
+ "type": "text",
1704
+ "primaryKey": false,
1705
+ "notNull": false,
1706
+ "autoincrement": false
1707
+ },
1708
+ "rejected_by": {
1709
+ "name": "rejected_by",
1710
+ "type": "text",
1711
+ "primaryKey": false,
1712
+ "notNull": false,
1713
+ "autoincrement": false
1714
+ },
1715
+ "edited_by": {
1716
+ "name": "edited_by",
1717
+ "type": "text",
1718
+ "primaryKey": false,
1719
+ "notNull": false,
1720
+ "autoincrement": false
1721
+ },
1722
+ "edited_at": {
1723
+ "name": "edited_at",
1724
+ "type": "integer",
1725
+ "primaryKey": false,
1726
+ "notNull": false,
1727
+ "autoincrement": false
1728
+ },
1729
+ "original_subject": {
1730
+ "name": "original_subject",
1731
+ "type": "text",
1732
+ "primaryKey": false,
1733
+ "notNull": false,
1734
+ "autoincrement": false
1735
+ },
1736
+ "original_body_html": {
1737
+ "name": "original_body_html",
1738
+ "type": "text",
1739
+ "primaryKey": false,
1740
+ "notNull": false,
1741
+ "autoincrement": false
1742
+ },
1743
+ "original_body_text": {
1744
+ "name": "original_body_text",
1745
+ "type": "text",
1746
+ "primaryKey": false,
1747
+ "notNull": false,
1748
+ "autoincrement": false
1749
+ },
1750
+ "forced_action_type": {
1751
+ "name": "forced_action_type",
1752
+ "type": "text",
1753
+ "primaryKey": false,
1754
+ "notNull": false,
1755
+ "autoincrement": false
1756
+ },
1757
+ "kb_entry_id": {
1758
+ "name": "kb_entry_id",
1759
+ "type": "text",
1760
+ "primaryKey": false,
1761
+ "notNull": false,
1762
+ "autoincrement": false
1763
+ },
1764
+ "imported": {
1765
+ "name": "imported",
1766
+ "type": "integer",
1767
+ "primaryKey": false,
1768
+ "notNull": true,
1769
+ "autoincrement": false,
1770
+ "default": false
1771
+ },
1772
+ "import_key": {
1773
+ "name": "import_key",
1774
+ "type": "text",
1775
+ "primaryKey": false,
1776
+ "notNull": false,
1777
+ "autoincrement": false
1778
+ },
1779
+ "expires_at": {
1780
+ "name": "expires_at",
1781
+ "type": "integer",
1782
+ "primaryKey": false,
1783
+ "notNull": false,
1784
+ "autoincrement": false
1785
+ },
1786
+ "context_snapshot": {
1787
+ "name": "context_snapshot",
1788
+ "type": "text",
1789
+ "primaryKey": false,
1790
+ "notNull": false,
1791
+ "autoincrement": false
1792
+ },
1793
+ "choose_decision": {
1794
+ "name": "choose_decision",
1795
+ "type": "text",
1796
+ "primaryKey": false,
1797
+ "notNull": false,
1798
+ "autoincrement": false
1799
+ },
1800
+ "opening_line": {
1801
+ "name": "opening_line",
1802
+ "type": "text",
1803
+ "primaryKey": false,
1804
+ "notNull": false,
1805
+ "autoincrement": false
1806
+ },
1807
+ "created_at": {
1808
+ "name": "created_at",
1809
+ "type": "integer",
1810
+ "primaryKey": false,
1811
+ "notNull": false,
1812
+ "autoincrement": false
1813
+ },
1814
+ "updated_at": {
1815
+ "name": "updated_at",
1816
+ "type": "integer",
1817
+ "primaryKey": false,
1818
+ "notNull": false,
1819
+ "autoincrement": false
1820
+ }
1821
+ },
1822
+ "indexes": {
1823
+ "idx_messages_drain": {
1824
+ "name": "idx_messages_drain",
1825
+ "columns": [
1826
+ "tenant_id",
1827
+ "status",
1828
+ "scheduled_send_at"
1829
+ ],
1830
+ "isUnique": false,
1831
+ "where": "status IN ('approved', 'sending')"
1832
+ },
1833
+ "idx_messages_contact": {
1834
+ "name": "idx_messages_contact",
1835
+ "columns": [
1836
+ "contact_id",
1837
+ "status",
1838
+ "created_at"
1839
+ ],
1840
+ "isUnique": false
1841
+ },
1842
+ "idx_messages_contact_sent": {
1843
+ "name": "idx_messages_contact_sent",
1844
+ "columns": [
1845
+ "contact_id",
1846
+ "sent_at"
1847
+ ],
1848
+ "isUnique": false,
1849
+ "where": "status IN ('sending', 'sent')"
1850
+ },
1851
+ "uq_messages_membership_step": {
1852
+ "name": "uq_messages_membership_step",
1853
+ "columns": [
1854
+ "membership_id",
1855
+ "flow_step_order"
1856
+ ],
1857
+ "isUnique": true
1858
+ },
1859
+ "idx_messages_generation": {
1860
+ "name": "idx_messages_generation",
1861
+ "columns": [
1862
+ "tenant_id",
1863
+ "status",
1864
+ "created_at"
1865
+ ],
1866
+ "isUnique": false,
1867
+ "where": "status IN ('pending_generation', 'generating')"
1868
+ },
1869
+ "idx_messages_provider_id": {
1870
+ "name": "idx_messages_provider_id",
1871
+ "columns": [
1872
+ "provider_message_id"
1873
+ ],
1874
+ "isUnique": false,
1875
+ "where": "provider_message_id IS NOT NULL"
1876
+ },
1877
+ "idx_messages_tenant_sent": {
1878
+ "name": "idx_messages_tenant_sent",
1879
+ "columns": [
1880
+ "tenant_id",
1881
+ "sent_at"
1882
+ ],
1883
+ "isUnique": false,
1884
+ "where": "sent_at IS NOT NULL"
1885
+ },
1886
+ "uq_messages_import_key": {
1887
+ "name": "uq_messages_import_key",
1888
+ "columns": [
1889
+ "tenant_id",
1890
+ "import_key"
1891
+ ],
1892
+ "isUnique": true,
1893
+ "where": "import_key IS NOT NULL"
1894
+ },
1895
+ "idx_messages_kb_entry": {
1896
+ "name": "idx_messages_kb_entry",
1897
+ "columns": [
1898
+ "tenant_id",
1899
+ "contact_id",
1900
+ "kb_entry_id"
1901
+ ],
1902
+ "isUnique": false,
1903
+ "where": "kb_entry_id IS NOT NULL"
1904
+ },
1905
+ "idx_messages_expires": {
1906
+ "name": "idx_messages_expires",
1907
+ "columns": [
1908
+ "tenant_id",
1909
+ "expires_at"
1910
+ ],
1911
+ "isUnique": false,
1912
+ "where": "expires_at IS NOT NULL"
1913
+ }
1914
+ },
1915
+ "foreignKeys": {
1916
+ "lifecycle_messages_tenant_id_tenants_id_fk": {
1917
+ "name": "lifecycle_messages_tenant_id_tenants_id_fk",
1918
+ "tableFrom": "lifecycle_messages",
1919
+ "tableTo": "tenants",
1920
+ "columnsFrom": [
1921
+ "tenant_id"
1922
+ ],
1923
+ "columnsTo": [
1924
+ "id"
1925
+ ],
1926
+ "onDelete": "no action",
1927
+ "onUpdate": "no action"
1928
+ },
1929
+ "lifecycle_messages_contact_id_contacts_id_fk": {
1930
+ "name": "lifecycle_messages_contact_id_contacts_id_fk",
1931
+ "tableFrom": "lifecycle_messages",
1932
+ "tableTo": "contacts",
1933
+ "columnsFrom": [
1934
+ "contact_id"
1935
+ ],
1936
+ "columnsTo": [
1937
+ "id"
1938
+ ],
1939
+ "onDelete": "no action",
1940
+ "onUpdate": "no action"
1941
+ },
1942
+ "lifecycle_messages_flow_id_flows_id_fk": {
1943
+ "name": "lifecycle_messages_flow_id_flows_id_fk",
1944
+ "tableFrom": "lifecycle_messages",
1945
+ "tableTo": "flows",
1946
+ "columnsFrom": [
1947
+ "flow_id"
1948
+ ],
1949
+ "columnsTo": [
1950
+ "id"
1951
+ ],
1952
+ "onDelete": "no action",
1953
+ "onUpdate": "no action"
1954
+ },
1955
+ "lifecycle_messages_membership_id_flow_memberships_id_fk": {
1956
+ "name": "lifecycle_messages_membership_id_flow_memberships_id_fk",
1957
+ "tableFrom": "lifecycle_messages",
1958
+ "tableTo": "flow_memberships",
1959
+ "columnsFrom": [
1960
+ "membership_id"
1961
+ ],
1962
+ "columnsTo": [
1963
+ "id"
1964
+ ],
1965
+ "onDelete": "no action",
1966
+ "onUpdate": "no action"
1967
+ }
1968
+ },
1969
+ "compositePrimaryKeys": {},
1970
+ "uniqueConstraints": {},
1971
+ "checkConstraints": {}
1972
+ },
1973
+ "lifecycle_transitions": {
1974
+ "name": "lifecycle_transitions",
1975
+ "columns": {
1976
+ "id": {
1977
+ "name": "id",
1978
+ "type": "text",
1979
+ "primaryKey": true,
1980
+ "notNull": true,
1981
+ "autoincrement": false
1982
+ },
1983
+ "tenant_id": {
1984
+ "name": "tenant_id",
1985
+ "type": "text",
1986
+ "primaryKey": false,
1987
+ "notNull": true,
1988
+ "autoincrement": false
1989
+ },
1990
+ "contact_id": {
1991
+ "name": "contact_id",
1992
+ "type": "text",
1993
+ "primaryKey": false,
1994
+ "notNull": true,
1995
+ "autoincrement": false
1996
+ },
1997
+ "from_state": {
1998
+ "name": "from_state",
1999
+ "type": "text",
2000
+ "primaryKey": false,
2001
+ "notNull": true,
2002
+ "autoincrement": false
2003
+ },
2004
+ "to_state": {
2005
+ "name": "to_state",
2006
+ "type": "text",
2007
+ "primaryKey": false,
2008
+ "notNull": true,
2009
+ "autoincrement": false
2010
+ },
2011
+ "trigger_event_id": {
2012
+ "name": "trigger_event_id",
2013
+ "type": "text",
2014
+ "primaryKey": false,
2015
+ "notNull": false,
2016
+ "autoincrement": false
2017
+ },
2018
+ "metadata": {
2019
+ "name": "metadata",
2020
+ "type": "text",
2021
+ "primaryKey": false,
2022
+ "notNull": false,
2023
+ "autoincrement": false
2024
+ },
2025
+ "transitioned_at": {
2026
+ "name": "transitioned_at",
2027
+ "type": "integer",
2028
+ "primaryKey": false,
2029
+ "notNull": true,
2030
+ "autoincrement": false
2031
+ }
2032
+ },
2033
+ "indexes": {
2034
+ "idx_transitions_contact": {
2035
+ "name": "idx_transitions_contact",
2036
+ "columns": [
2037
+ "contact_id",
2038
+ "transitioned_at"
2039
+ ],
2040
+ "isUnique": false
2041
+ },
2042
+ "idx_transitions_tenant_time": {
2043
+ "name": "idx_transitions_tenant_time",
2044
+ "columns": [
2045
+ "tenant_id",
2046
+ "transitioned_at"
2047
+ ],
2048
+ "isUnique": false
2049
+ }
2050
+ },
2051
+ "foreignKeys": {
2052
+ "lifecycle_transitions_tenant_id_tenants_id_fk": {
2053
+ "name": "lifecycle_transitions_tenant_id_tenants_id_fk",
2054
+ "tableFrom": "lifecycle_transitions",
2055
+ "tableTo": "tenants",
2056
+ "columnsFrom": [
2057
+ "tenant_id"
2058
+ ],
2059
+ "columnsTo": [
2060
+ "id"
2061
+ ],
2062
+ "onDelete": "no action",
2063
+ "onUpdate": "no action"
2064
+ },
2065
+ "lifecycle_transitions_contact_id_contacts_id_fk": {
2066
+ "name": "lifecycle_transitions_contact_id_contacts_id_fk",
2067
+ "tableFrom": "lifecycle_transitions",
2068
+ "tableTo": "contacts",
2069
+ "columnsFrom": [
2070
+ "contact_id"
2071
+ ],
2072
+ "columnsTo": [
2073
+ "id"
2074
+ ],
2075
+ "onDelete": "no action",
2076
+ "onUpdate": "no action"
2077
+ }
2078
+ },
2079
+ "compositePrimaryKeys": {},
2080
+ "uniqueConstraints": {},
2081
+ "checkConstraints": {}
2082
+ },
2083
+ "llm_configs": {
2084
+ "name": "llm_configs",
2085
+ "columns": {
2086
+ "id": {
2087
+ "name": "id",
2088
+ "type": "text",
2089
+ "primaryKey": true,
2090
+ "notNull": true,
2091
+ "autoincrement": false
2092
+ },
2093
+ "tenant_id": {
2094
+ "name": "tenant_id",
2095
+ "type": "text",
2096
+ "primaryKey": false,
2097
+ "notNull": true,
2098
+ "autoincrement": false
2099
+ },
2100
+ "provider": {
2101
+ "name": "provider",
2102
+ "type": "text",
2103
+ "primaryKey": false,
2104
+ "notNull": true,
2105
+ "autoincrement": false
2106
+ },
2107
+ "config": {
2108
+ "name": "config",
2109
+ "type": "text",
2110
+ "primaryKey": false,
2111
+ "notNull": true,
2112
+ "autoincrement": false
2113
+ },
2114
+ "is_active": {
2115
+ "name": "is_active",
2116
+ "type": "integer",
2117
+ "primaryKey": false,
2118
+ "notNull": false,
2119
+ "autoincrement": false,
2120
+ "default": true
2121
+ },
2122
+ "created_at": {
2123
+ "name": "created_at",
2124
+ "type": "integer",
2125
+ "primaryKey": false,
2126
+ "notNull": false,
2127
+ "autoincrement": false
2128
+ }
2129
+ },
2130
+ "indexes": {},
2131
+ "foreignKeys": {
2132
+ "llm_configs_tenant_id_tenants_id_fk": {
2133
+ "name": "llm_configs_tenant_id_tenants_id_fk",
2134
+ "tableFrom": "llm_configs",
2135
+ "tableTo": "tenants",
2136
+ "columnsFrom": [
2137
+ "tenant_id"
2138
+ ],
2139
+ "columnsTo": [
2140
+ "id"
2141
+ ],
2142
+ "onDelete": "no action",
2143
+ "onUpdate": "no action"
2144
+ }
2145
+ },
2146
+ "compositePrimaryKeys": {},
2147
+ "uniqueConstraints": {},
2148
+ "checkConstraints": {}
2149
+ },
2150
+ "magic_link_tokens": {
2151
+ "name": "magic_link_tokens",
2152
+ "columns": {
2153
+ "id": {
2154
+ "name": "id",
2155
+ "type": "text",
2156
+ "primaryKey": true,
2157
+ "notNull": true,
2158
+ "autoincrement": false
2159
+ },
2160
+ "tenant_id": {
2161
+ "name": "tenant_id",
2162
+ "type": "text",
2163
+ "primaryKey": false,
2164
+ "notNull": true,
2165
+ "autoincrement": false
2166
+ },
2167
+ "user_id": {
2168
+ "name": "user_id",
2169
+ "type": "text",
2170
+ "primaryKey": false,
2171
+ "notNull": true,
2172
+ "autoincrement": false
2173
+ },
2174
+ "token_hash": {
2175
+ "name": "token_hash",
2176
+ "type": "text",
2177
+ "primaryKey": false,
2178
+ "notNull": true,
2179
+ "autoincrement": false
2180
+ },
2181
+ "expires_at": {
2182
+ "name": "expires_at",
2183
+ "type": "integer",
2184
+ "primaryKey": false,
2185
+ "notNull": true,
2186
+ "autoincrement": false
2187
+ },
2188
+ "consumed_at": {
2189
+ "name": "consumed_at",
2190
+ "type": "integer",
2191
+ "primaryKey": false,
2192
+ "notNull": false,
2193
+ "autoincrement": false
2194
+ },
2195
+ "created_at": {
2196
+ "name": "created_at",
2197
+ "type": "integer",
2198
+ "primaryKey": false,
2199
+ "notNull": false,
2200
+ "autoincrement": false
2201
+ }
2202
+ },
2203
+ "indexes": {
2204
+ "idx_magic_link_tokens_hash": {
2205
+ "name": "idx_magic_link_tokens_hash",
2206
+ "columns": [
2207
+ "token_hash"
2208
+ ],
2209
+ "isUnique": false
2210
+ }
2211
+ },
2212
+ "foreignKeys": {
2213
+ "magic_link_tokens_tenant_id_tenants_id_fk": {
2214
+ "name": "magic_link_tokens_tenant_id_tenants_id_fk",
2215
+ "tableFrom": "magic_link_tokens",
2216
+ "tableTo": "tenants",
2217
+ "columnsFrom": [
2218
+ "tenant_id"
2219
+ ],
2220
+ "columnsTo": [
2221
+ "id"
2222
+ ],
2223
+ "onDelete": "no action",
2224
+ "onUpdate": "no action"
2225
+ },
2226
+ "magic_link_tokens_user_id_users_id_fk": {
2227
+ "name": "magic_link_tokens_user_id_users_id_fk",
2228
+ "tableFrom": "magic_link_tokens",
2229
+ "tableTo": "users",
2230
+ "columnsFrom": [
2231
+ "user_id"
2232
+ ],
2233
+ "columnsTo": [
2234
+ "id"
2235
+ ],
2236
+ "onDelete": "cascade",
2237
+ "onUpdate": "no action"
2238
+ }
2239
+ },
2240
+ "compositePrimaryKeys": {},
2241
+ "uniqueConstraints": {},
2242
+ "checkConstraints": {}
2243
+ },
2244
+ "memberships": {
2245
+ "name": "memberships",
2246
+ "columns": {
2247
+ "user_id": {
2248
+ "name": "user_id",
2249
+ "type": "text",
2250
+ "primaryKey": false,
2251
+ "notNull": true,
2252
+ "autoincrement": false
2253
+ },
2254
+ "tenant_id": {
2255
+ "name": "tenant_id",
2256
+ "type": "text",
2257
+ "primaryKey": false,
2258
+ "notNull": true,
2259
+ "autoincrement": false
2260
+ },
2261
+ "role": {
2262
+ "name": "role",
2263
+ "type": "text",
2264
+ "primaryKey": false,
2265
+ "notNull": true,
2266
+ "autoincrement": false
2267
+ },
2268
+ "created_at": {
2269
+ "name": "created_at",
2270
+ "type": "integer",
2271
+ "primaryKey": false,
2272
+ "notNull": false,
2273
+ "autoincrement": false
2274
+ }
2275
+ },
2276
+ "indexes": {
2277
+ "idx_memberships_tenant": {
2278
+ "name": "idx_memberships_tenant",
2279
+ "columns": [
2280
+ "tenant_id"
2281
+ ],
2282
+ "isUnique": false
2283
+ }
2284
+ },
2285
+ "foreignKeys": {
2286
+ "memberships_user_id_users_id_fk": {
2287
+ "name": "memberships_user_id_users_id_fk",
2288
+ "tableFrom": "memberships",
2289
+ "tableTo": "users",
2290
+ "columnsFrom": [
2291
+ "user_id"
2292
+ ],
2293
+ "columnsTo": [
2294
+ "id"
2295
+ ],
2296
+ "onDelete": "cascade",
2297
+ "onUpdate": "no action"
2298
+ },
2299
+ "memberships_tenant_id_tenants_id_fk": {
2300
+ "name": "memberships_tenant_id_tenants_id_fk",
2301
+ "tableFrom": "memberships",
2302
+ "tableTo": "tenants",
2303
+ "columnsFrom": [
2304
+ "tenant_id"
2305
+ ],
2306
+ "columnsTo": [
2307
+ "id"
2308
+ ],
2309
+ "onDelete": "no action",
2310
+ "onUpdate": "no action"
2311
+ }
2312
+ },
2313
+ "compositePrimaryKeys": {
2314
+ "memberships_pkey": {
2315
+ "columns": [
2316
+ "user_id",
2317
+ "tenant_id"
2318
+ ],
2319
+ "name": "memberships_pkey"
2320
+ }
2321
+ },
2322
+ "uniqueConstraints": {},
2323
+ "checkConstraints": {}
2324
+ },
2325
+ "message_events": {
2326
+ "name": "message_events",
2327
+ "columns": {
2328
+ "id": {
2329
+ "name": "id",
2330
+ "type": "text",
2331
+ "primaryKey": true,
2332
+ "notNull": true,
2333
+ "autoincrement": false
2334
+ },
2335
+ "tenant_id": {
2336
+ "name": "tenant_id",
2337
+ "type": "text",
2338
+ "primaryKey": false,
2339
+ "notNull": true,
2340
+ "autoincrement": false
2341
+ },
2342
+ "message_id": {
2343
+ "name": "message_id",
2344
+ "type": "text",
2345
+ "primaryKey": false,
2346
+ "notNull": true,
2347
+ "autoincrement": false
2348
+ },
2349
+ "event_type": {
2350
+ "name": "event_type",
2351
+ "type": "text",
2352
+ "primaryKey": false,
2353
+ "notNull": true,
2354
+ "autoincrement": false
2355
+ },
2356
+ "occurred_at": {
2357
+ "name": "occurred_at",
2358
+ "type": "integer",
2359
+ "primaryKey": false,
2360
+ "notNull": true,
2361
+ "autoincrement": false
2362
+ },
2363
+ "provider_event_id": {
2364
+ "name": "provider_event_id",
2365
+ "type": "text",
2366
+ "primaryKey": false,
2367
+ "notNull": false,
2368
+ "autoincrement": false
2369
+ },
2370
+ "metadata": {
2371
+ "name": "metadata",
2372
+ "type": "text",
2373
+ "primaryKey": false,
2374
+ "notNull": false,
2375
+ "autoincrement": false
2376
+ },
2377
+ "created_at": {
2378
+ "name": "created_at",
2379
+ "type": "integer",
2380
+ "primaryKey": false,
2381
+ "notNull": false,
2382
+ "autoincrement": false
2383
+ }
2384
+ },
2385
+ "indexes": {
2386
+ "idx_message_events_message": {
2387
+ "name": "idx_message_events_message",
2388
+ "columns": [
2389
+ "message_id",
2390
+ "occurred_at"
2391
+ ],
2392
+ "isUnique": false
2393
+ },
2394
+ "idx_message_events_tenant_type_day": {
2395
+ "name": "idx_message_events_tenant_type_day",
2396
+ "columns": [
2397
+ "tenant_id",
2398
+ "event_type",
2399
+ "occurred_at"
2400
+ ],
2401
+ "isUnique": false
2402
+ },
2403
+ "uq_message_events_provider_dedup": {
2404
+ "name": "uq_message_events_provider_dedup",
2405
+ "columns": [
2406
+ "tenant_id",
2407
+ "provider_event_id"
2408
+ ],
2409
+ "isUnique": true,
2410
+ "where": "provider_event_id IS NOT NULL"
2411
+ }
2412
+ },
2413
+ "foreignKeys": {
2414
+ "message_events_tenant_id_tenants_id_fk": {
2415
+ "name": "message_events_tenant_id_tenants_id_fk",
2416
+ "tableFrom": "message_events",
2417
+ "tableTo": "tenants",
2418
+ "columnsFrom": [
2419
+ "tenant_id"
2420
+ ],
2421
+ "columnsTo": [
2422
+ "id"
2423
+ ],
2424
+ "onDelete": "no action",
2425
+ "onUpdate": "no action"
2426
+ },
2427
+ "message_events_message_id_lifecycle_messages_id_fk": {
2428
+ "name": "message_events_message_id_lifecycle_messages_id_fk",
2429
+ "tableFrom": "message_events",
2430
+ "tableTo": "lifecycle_messages",
2431
+ "columnsFrom": [
2432
+ "message_id"
2433
+ ],
2434
+ "columnsTo": [
2435
+ "id"
2436
+ ],
2437
+ "onDelete": "no action",
2438
+ "onUpdate": "no action"
2439
+ }
2440
+ },
2441
+ "compositePrimaryKeys": {},
2442
+ "uniqueConstraints": {},
2443
+ "checkConstraints": {}
2444
+ },
2445
+ "ops_alerts": {
2446
+ "name": "ops_alerts",
2447
+ "columns": {
2448
+ "fingerprint": {
2449
+ "name": "fingerprint",
2450
+ "type": "text",
2451
+ "primaryKey": true,
2452
+ "notNull": true,
2453
+ "autoincrement": false
2454
+ },
2455
+ "kind": {
2456
+ "name": "kind",
2457
+ "type": "text",
2458
+ "primaryKey": false,
2459
+ "notNull": true,
2460
+ "autoincrement": false
2461
+ },
2462
+ "tenant_id": {
2463
+ "name": "tenant_id",
2464
+ "type": "text",
2465
+ "primaryKey": false,
2466
+ "notNull": false,
2467
+ "autoincrement": false
2468
+ },
2469
+ "severity": {
2470
+ "name": "severity",
2471
+ "type": "text",
2472
+ "primaryKey": false,
2473
+ "notNull": true,
2474
+ "autoincrement": false
2475
+ },
2476
+ "message": {
2477
+ "name": "message",
2478
+ "type": "text",
2479
+ "primaryKey": false,
2480
+ "notNull": true,
2481
+ "autoincrement": false
2482
+ },
2483
+ "first_at": {
2484
+ "name": "first_at",
2485
+ "type": "integer",
2486
+ "primaryKey": false,
2487
+ "notNull": true,
2488
+ "autoincrement": false
2489
+ },
2490
+ "last_at": {
2491
+ "name": "last_at",
2492
+ "type": "integer",
2493
+ "primaryKey": false,
2494
+ "notNull": true,
2495
+ "autoincrement": false
2496
+ },
2497
+ "count": {
2498
+ "name": "count",
2499
+ "type": "integer",
2500
+ "primaryKey": false,
2501
+ "notNull": true,
2502
+ "autoincrement": false,
2503
+ "default": 1
2504
+ },
2505
+ "last_notified_at": {
2506
+ "name": "last_notified_at",
2507
+ "type": "integer",
2508
+ "primaryKey": false,
2509
+ "notNull": false,
2510
+ "autoincrement": false
2511
+ },
2512
+ "notified_count": {
2513
+ "name": "notified_count",
2514
+ "type": "integer",
2515
+ "primaryKey": false,
2516
+ "notNull": true,
2517
+ "autoincrement": false,
2518
+ "default": 0
2519
+ },
2520
+ "status": {
2521
+ "name": "status",
2522
+ "type": "text",
2523
+ "primaryKey": false,
2524
+ "notNull": true,
2525
+ "autoincrement": false,
2526
+ "default": "'open'"
2527
+ },
2528
+ "muted_until": {
2529
+ "name": "muted_until",
2530
+ "type": "integer",
2531
+ "primaryKey": false,
2532
+ "notNull": false,
2533
+ "autoincrement": false
2534
+ }
2535
+ },
2536
+ "indexes": {},
2537
+ "foreignKeys": {},
2538
+ "compositePrimaryKeys": {},
2539
+ "uniqueConstraints": {},
2540
+ "checkConstraints": {}
2541
+ },
2542
+ "ops_events": {
2543
+ "name": "ops_events",
2544
+ "columns": {
2545
+ "id": {
2546
+ "name": "id",
2547
+ "type": "text",
2548
+ "primaryKey": true,
2549
+ "notNull": true,
2550
+ "autoincrement": false
2551
+ },
2552
+ "at": {
2553
+ "name": "at",
2554
+ "type": "integer",
2555
+ "primaryKey": false,
2556
+ "notNull": true,
2557
+ "autoincrement": false
2558
+ },
2559
+ "tenant_id": {
2560
+ "name": "tenant_id",
2561
+ "type": "text",
2562
+ "primaryKey": false,
2563
+ "notNull": false,
2564
+ "autoincrement": false
2565
+ },
2566
+ "kind": {
2567
+ "name": "kind",
2568
+ "type": "text",
2569
+ "primaryKey": false,
2570
+ "notNull": true,
2571
+ "autoincrement": false
2572
+ },
2573
+ "severity": {
2574
+ "name": "severity",
2575
+ "type": "text",
2576
+ "primaryKey": false,
2577
+ "notNull": true,
2578
+ "autoincrement": false
2579
+ },
2580
+ "fingerprint": {
2581
+ "name": "fingerprint",
2582
+ "type": "text",
2583
+ "primaryKey": false,
2584
+ "notNull": true,
2585
+ "autoincrement": false
2586
+ },
2587
+ "message": {
2588
+ "name": "message",
2589
+ "type": "text",
2590
+ "primaryKey": false,
2591
+ "notNull": true,
2592
+ "autoincrement": false
2593
+ },
2594
+ "context": {
2595
+ "name": "context",
2596
+ "type": "text",
2597
+ "primaryKey": false,
2598
+ "notNull": false,
2599
+ "autoincrement": false
2600
+ }
2601
+ },
2602
+ "indexes": {
2603
+ "idx_ops_events_fingerprint_at": {
2604
+ "name": "idx_ops_events_fingerprint_at",
2605
+ "columns": [
2606
+ "fingerprint",
2607
+ "at"
2608
+ ],
2609
+ "isUnique": false
2610
+ },
2611
+ "idx_ops_events_at": {
2612
+ "name": "idx_ops_events_at",
2613
+ "columns": [
2614
+ "at"
2615
+ ],
2616
+ "isUnique": false
2617
+ }
2618
+ },
2619
+ "foreignKeys": {},
2620
+ "compositePrimaryKeys": {},
2621
+ "uniqueConstraints": {},
2622
+ "checkConstraints": {}
2623
+ },
2624
+ "retention_grid_snapshots": {
2625
+ "name": "retention_grid_snapshots",
2626
+ "columns": {
2627
+ "tenant_id": {
2628
+ "name": "tenant_id",
2629
+ "type": "text",
2630
+ "primaryKey": false,
2631
+ "notNull": true,
2632
+ "autoincrement": false
2633
+ },
2634
+ "snapshot_date": {
2635
+ "name": "snapshot_date",
2636
+ "type": "text",
2637
+ "primaryKey": false,
2638
+ "notNull": true,
2639
+ "autoincrement": false
2640
+ },
2641
+ "tenure_bucket": {
2642
+ "name": "tenure_bucket",
2643
+ "type": "text",
2644
+ "primaryKey": false,
2645
+ "notNull": true,
2646
+ "autoincrement": false
2647
+ },
2648
+ "recency_bucket": {
2649
+ "name": "recency_bucket",
2650
+ "type": "text",
2651
+ "primaryKey": false,
2652
+ "notNull": true,
2653
+ "autoincrement": false
2654
+ },
2655
+ "contact_count": {
2656
+ "name": "contact_count",
2657
+ "type": "integer",
2658
+ "primaryKey": false,
2659
+ "notNull": true,
2660
+ "autoincrement": false
2661
+ },
2662
+ "paying_count": {
2663
+ "name": "paying_count",
2664
+ "type": "integer",
2665
+ "primaryKey": false,
2666
+ "notNull": true,
2667
+ "autoincrement": false
2668
+ }
2669
+ },
2670
+ "indexes": {},
2671
+ "foreignKeys": {
2672
+ "retention_grid_snapshots_tenant_id_tenants_id_fk": {
2673
+ "name": "retention_grid_snapshots_tenant_id_tenants_id_fk",
2674
+ "tableFrom": "retention_grid_snapshots",
2675
+ "tableTo": "tenants",
2676
+ "columnsFrom": [
2677
+ "tenant_id"
2678
+ ],
2679
+ "columnsTo": [
2680
+ "id"
2681
+ ],
2682
+ "onDelete": "no action",
2683
+ "onUpdate": "no action"
2684
+ }
2685
+ },
2686
+ "compositePrimaryKeys": {
2687
+ "retention_grid_snapshots_tenant_id_snapshot_date_tenure_bucket_recency_bucket_pk": {
2688
+ "columns": [
2689
+ "tenant_id",
2690
+ "snapshot_date",
2691
+ "tenure_bucket",
2692
+ "recency_bucket"
2693
+ ],
2694
+ "name": "retention_grid_snapshots_tenant_id_snapshot_date_tenure_bucket_recency_bucket_pk"
2695
+ }
2696
+ },
2697
+ "uniqueConstraints": {},
2698
+ "checkConstraints": {}
2699
+ },
2700
+ "scan_checkpoints": {
2701
+ "name": "scan_checkpoints",
2702
+ "columns": {
2703
+ "scan_phase": {
2704
+ "name": "scan_phase",
2705
+ "type": "text",
2706
+ "primaryKey": false,
2707
+ "notNull": true,
2708
+ "autoincrement": false
2709
+ },
2710
+ "tenant_id": {
2711
+ "name": "tenant_id",
2712
+ "type": "text",
2713
+ "primaryKey": false,
2714
+ "notNull": true,
2715
+ "autoincrement": false
2716
+ },
2717
+ "last_id": {
2718
+ "name": "last_id",
2719
+ "type": "text",
2720
+ "primaryKey": false,
2721
+ "notNull": true,
2722
+ "autoincrement": false
2723
+ },
2724
+ "started_at": {
2725
+ "name": "started_at",
2726
+ "type": "integer",
2727
+ "primaryKey": false,
2728
+ "notNull": true,
2729
+ "autoincrement": false
2730
+ },
2731
+ "discard_count": {
2732
+ "name": "discard_count",
2733
+ "type": "integer",
2734
+ "primaryKey": false,
2735
+ "notNull": true,
2736
+ "autoincrement": false,
2737
+ "default": 0
2738
+ }
2739
+ },
2740
+ "indexes": {},
2741
+ "foreignKeys": {
2742
+ "scan_checkpoints_tenant_id_tenants_id_fk": {
2743
+ "name": "scan_checkpoints_tenant_id_tenants_id_fk",
2744
+ "tableFrom": "scan_checkpoints",
2745
+ "tableTo": "tenants",
2746
+ "columnsFrom": [
2747
+ "tenant_id"
2748
+ ],
2749
+ "columnsTo": [
2750
+ "id"
2751
+ ],
2752
+ "onDelete": "no action",
2753
+ "onUpdate": "no action"
2754
+ }
2755
+ },
2756
+ "compositePrimaryKeys": {
2757
+ "scan_checkpoints_scan_phase_tenant_id_pk": {
2758
+ "columns": [
2759
+ "scan_phase",
2760
+ "tenant_id"
2761
+ ],
2762
+ "name": "scan_checkpoints_scan_phase_tenant_id_pk"
2763
+ }
2764
+ },
2765
+ "uniqueConstraints": {},
2766
+ "checkConstraints": {}
2767
+ },
2768
+ "sessions": {
2769
+ "name": "sessions",
2770
+ "columns": {
2771
+ "id": {
2772
+ "name": "id",
2773
+ "type": "text",
2774
+ "primaryKey": true,
2775
+ "notNull": true,
2776
+ "autoincrement": false
2777
+ },
2778
+ "tenant_id": {
2779
+ "name": "tenant_id",
2780
+ "type": "text",
2781
+ "primaryKey": false,
2782
+ "notNull": true,
2783
+ "autoincrement": false
2784
+ },
2785
+ "user_id": {
2786
+ "name": "user_id",
2787
+ "type": "text",
2788
+ "primaryKey": false,
2789
+ "notNull": true,
2790
+ "autoincrement": false
2791
+ },
2792
+ "expires_at": {
2793
+ "name": "expires_at",
2794
+ "type": "integer",
2795
+ "primaryKey": false,
2796
+ "notNull": true,
2797
+ "autoincrement": false
2798
+ },
2799
+ "created_at": {
2800
+ "name": "created_at",
2801
+ "type": "integer",
2802
+ "primaryKey": false,
2803
+ "notNull": false,
2804
+ "autoincrement": false
2805
+ }
2806
+ },
2807
+ "indexes": {},
2808
+ "foreignKeys": {
2809
+ "sessions_tenant_id_tenants_id_fk": {
2810
+ "name": "sessions_tenant_id_tenants_id_fk",
2811
+ "tableFrom": "sessions",
2812
+ "tableTo": "tenants",
2813
+ "columnsFrom": [
2814
+ "tenant_id"
2815
+ ],
2816
+ "columnsTo": [
2817
+ "id"
2818
+ ],
2819
+ "onDelete": "no action",
2820
+ "onUpdate": "no action"
2821
+ },
2822
+ "sessions_user_id_users_id_fk": {
2823
+ "name": "sessions_user_id_users_id_fk",
2824
+ "tableFrom": "sessions",
2825
+ "tableTo": "users",
2826
+ "columnsFrom": [
2827
+ "user_id"
2828
+ ],
2829
+ "columnsTo": [
2830
+ "id"
2831
+ ],
2832
+ "onDelete": "cascade",
2833
+ "onUpdate": "no action"
2834
+ }
2835
+ },
2836
+ "compositePrimaryKeys": {},
2837
+ "uniqueConstraints": {},
2838
+ "checkConstraints": {}
2839
+ },
2840
+ "suppressions": {
2841
+ "name": "suppressions",
2842
+ "columns": {
2843
+ "id": {
2844
+ "name": "id",
2845
+ "type": "text",
2846
+ "primaryKey": true,
2847
+ "notNull": true,
2848
+ "autoincrement": false
2849
+ },
2850
+ "tenant_id": {
2851
+ "name": "tenant_id",
2852
+ "type": "text",
2853
+ "primaryKey": false,
2854
+ "notNull": true,
2855
+ "autoincrement": false
2856
+ },
2857
+ "email": {
2858
+ "name": "email",
2859
+ "type": "text",
2860
+ "primaryKey": false,
2861
+ "notNull": true,
2862
+ "autoincrement": false
2863
+ },
2864
+ "reason": {
2865
+ "name": "reason",
2866
+ "type": "text",
2867
+ "primaryKey": false,
2868
+ "notNull": true,
2869
+ "autoincrement": false
2870
+ },
2871
+ "source": {
2872
+ "name": "source",
2873
+ "type": "text",
2874
+ "primaryKey": false,
2875
+ "notNull": false,
2876
+ "autoincrement": false
2877
+ },
2878
+ "created_at": {
2879
+ "name": "created_at",
2880
+ "type": "integer",
2881
+ "primaryKey": false,
2882
+ "notNull": false,
2883
+ "autoincrement": false
2884
+ }
2885
+ },
2886
+ "indexes": {},
2887
+ "foreignKeys": {
2888
+ "suppressions_tenant_id_tenants_id_fk": {
2889
+ "name": "suppressions_tenant_id_tenants_id_fk",
2890
+ "tableFrom": "suppressions",
2891
+ "tableTo": "tenants",
2892
+ "columnsFrom": [
2893
+ "tenant_id"
2894
+ ],
2895
+ "columnsTo": [
2896
+ "id"
2897
+ ],
2898
+ "onDelete": "no action",
2899
+ "onUpdate": "no action"
2900
+ }
2901
+ },
2902
+ "compositePrimaryKeys": {},
2903
+ "uniqueConstraints": {},
2904
+ "checkConstraints": {}
2905
+ },
2906
+ "templates": {
2907
+ "name": "templates",
2908
+ "columns": {
2909
+ "id": {
2910
+ "name": "id",
2911
+ "type": "text",
2912
+ "primaryKey": true,
2913
+ "notNull": true,
2914
+ "autoincrement": false
2915
+ },
2916
+ "tenant_id": {
2917
+ "name": "tenant_id",
2918
+ "type": "text",
2919
+ "primaryKey": false,
2920
+ "notNull": true,
2921
+ "autoincrement": false
2922
+ },
2923
+ "name": {
2924
+ "name": "name",
2925
+ "type": "text",
2926
+ "primaryKey": false,
2927
+ "notNull": true,
2928
+ "autoincrement": false
2929
+ },
2930
+ "slug": {
2931
+ "name": "slug",
2932
+ "type": "text",
2933
+ "primaryKey": false,
2934
+ "notNull": true,
2935
+ "autoincrement": false
2936
+ },
2937
+ "subject": {
2938
+ "name": "subject",
2939
+ "type": "text",
2940
+ "primaryKey": false,
2941
+ "notNull": true,
2942
+ "autoincrement": false
2943
+ },
2944
+ "body_html": {
2945
+ "name": "body_html",
2946
+ "type": "text",
2947
+ "primaryKey": false,
2948
+ "notNull": true,
2949
+ "autoincrement": false
2950
+ },
2951
+ "body_text": {
2952
+ "name": "body_text",
2953
+ "type": "text",
2954
+ "primaryKey": false,
2955
+ "notNull": false,
2956
+ "autoincrement": false
2957
+ },
2958
+ "variables": {
2959
+ "name": "variables",
2960
+ "type": "text",
2961
+ "primaryKey": false,
2962
+ "notNull": false,
2963
+ "autoincrement": false
2964
+ },
2965
+ "category": {
2966
+ "name": "category",
2967
+ "type": "text",
2968
+ "primaryKey": false,
2969
+ "notNull": false,
2970
+ "autoincrement": false
2971
+ },
2972
+ "is_active": {
2973
+ "name": "is_active",
2974
+ "type": "integer",
2975
+ "primaryKey": false,
2976
+ "notNull": false,
2977
+ "autoincrement": false,
2978
+ "default": true
2979
+ },
2980
+ "created_at": {
2981
+ "name": "created_at",
2982
+ "type": "integer",
2983
+ "primaryKey": false,
2984
+ "notNull": false,
2985
+ "autoincrement": false
2986
+ }
2987
+ },
2988
+ "indexes": {
2989
+ "uq_templates_tenant_slug": {
2990
+ "name": "uq_templates_tenant_slug",
2991
+ "columns": [
2992
+ "tenant_id",
2993
+ "slug"
2994
+ ],
2995
+ "isUnique": true
2996
+ }
2997
+ },
2998
+ "foreignKeys": {
2999
+ "templates_tenant_id_tenants_id_fk": {
3000
+ "name": "templates_tenant_id_tenants_id_fk",
3001
+ "tableFrom": "templates",
3002
+ "tableTo": "tenants",
3003
+ "columnsFrom": [
3004
+ "tenant_id"
3005
+ ],
3006
+ "columnsTo": [
3007
+ "id"
3008
+ ],
3009
+ "onDelete": "no action",
3010
+ "onUpdate": "no action"
3011
+ }
3012
+ },
3013
+ "compositePrimaryKeys": {},
3014
+ "uniqueConstraints": {},
3015
+ "checkConstraints": {}
3016
+ },
3017
+ "tenants": {
3018
+ "name": "tenants",
3019
+ "columns": {
3020
+ "id": {
3021
+ "name": "id",
3022
+ "type": "text",
3023
+ "primaryKey": true,
3024
+ "notNull": true,
3025
+ "autoincrement": false
3026
+ },
3027
+ "name": {
3028
+ "name": "name",
3029
+ "type": "text",
3030
+ "primaryKey": false,
3031
+ "notNull": true,
3032
+ "autoincrement": false
3033
+ },
3034
+ "slug": {
3035
+ "name": "slug",
3036
+ "type": "text",
3037
+ "primaryKey": false,
3038
+ "notNull": true,
3039
+ "autoincrement": false
3040
+ },
3041
+ "plan": {
3042
+ "name": "plan",
3043
+ "type": "text",
3044
+ "primaryKey": false,
3045
+ "notNull": false,
3046
+ "autoincrement": false,
3047
+ "default": "'free'"
3048
+ },
3049
+ "settings": {
3050
+ "name": "settings",
3051
+ "type": "text",
3052
+ "primaryKey": false,
3053
+ "notNull": false,
3054
+ "autoincrement": false
3055
+ },
3056
+ "business_model": {
3057
+ "name": "business_model",
3058
+ "type": "text",
3059
+ "primaryKey": false,
3060
+ "notNull": false,
3061
+ "autoincrement": false
3062
+ },
3063
+ "created_at": {
3064
+ "name": "created_at",
3065
+ "type": "integer",
3066
+ "primaryKey": false,
3067
+ "notNull": false,
3068
+ "autoincrement": false
3069
+ },
3070
+ "archived_at": {
3071
+ "name": "archived_at",
3072
+ "type": "integer",
3073
+ "primaryKey": false,
3074
+ "notNull": false,
3075
+ "autoincrement": false
3076
+ },
3077
+ "public_host": {
3078
+ "name": "public_host",
3079
+ "type": "text",
3080
+ "primaryKey": false,
3081
+ "notNull": false,
3082
+ "autoincrement": false
3083
+ },
3084
+ "locale": {
3085
+ "name": "locale",
3086
+ "type": "text",
3087
+ "primaryKey": false,
3088
+ "notNull": false,
3089
+ "autoincrement": false
3090
+ },
3091
+ "config_version": {
3092
+ "name": "config_version",
3093
+ "type": "integer",
3094
+ "primaryKey": false,
3095
+ "notNull": true,
3096
+ "autoincrement": false,
3097
+ "default": 0
3098
+ }
3099
+ },
3100
+ "indexes": {
3101
+ "tenants_slug_unique": {
3102
+ "name": "tenants_slug_unique",
3103
+ "columns": [
3104
+ "slug"
3105
+ ],
3106
+ "isUnique": true
3107
+ },
3108
+ "uq_tenants_public_host": {
3109
+ "name": "uq_tenants_public_host",
3110
+ "columns": [
3111
+ "public_host"
3112
+ ],
3113
+ "isUnique": true,
3114
+ "where": "public_host IS NOT NULL"
3115
+ }
3116
+ },
3117
+ "foreignKeys": {},
3118
+ "compositePrimaryKeys": {},
3119
+ "uniqueConstraints": {},
3120
+ "checkConstraints": {}
3121
+ },
3122
+ "topics": {
3123
+ "name": "topics",
3124
+ "columns": {
3125
+ "id": {
3126
+ "name": "id",
3127
+ "type": "text",
3128
+ "primaryKey": true,
3129
+ "notNull": true,
3130
+ "autoincrement": false
3131
+ },
3132
+ "tenant_id": {
3133
+ "name": "tenant_id",
3134
+ "type": "text",
3135
+ "primaryKey": false,
3136
+ "notNull": true,
3137
+ "autoincrement": false
3138
+ },
3139
+ "slug": {
3140
+ "name": "slug",
3141
+ "type": "text",
3142
+ "primaryKey": false,
3143
+ "notNull": true,
3144
+ "autoincrement": false
3145
+ },
3146
+ "name": {
3147
+ "name": "name",
3148
+ "type": "text",
3149
+ "primaryKey": false,
3150
+ "notNull": true,
3151
+ "autoincrement": false
3152
+ },
3153
+ "kind": {
3154
+ "name": "kind",
3155
+ "type": "text",
3156
+ "primaryKey": false,
3157
+ "notNull": true,
3158
+ "autoincrement": false
3159
+ },
3160
+ "description": {
3161
+ "name": "description",
3162
+ "type": "text",
3163
+ "primaryKey": false,
3164
+ "notNull": false,
3165
+ "autoincrement": false
3166
+ },
3167
+ "default_subscribed": {
3168
+ "name": "default_subscribed",
3169
+ "type": "integer",
3170
+ "primaryKey": false,
3171
+ "notNull": true,
3172
+ "autoincrement": false,
3173
+ "default": true
3174
+ },
3175
+ "created_at": {
3176
+ "name": "created_at",
3177
+ "type": "integer",
3178
+ "primaryKey": false,
3179
+ "notNull": false,
3180
+ "autoincrement": false
3181
+ }
3182
+ },
3183
+ "indexes": {
3184
+ "uq_topics_tenant_slug": {
3185
+ "name": "uq_topics_tenant_slug",
3186
+ "columns": [
3187
+ "tenant_id",
3188
+ "slug"
3189
+ ],
3190
+ "isUnique": true
3191
+ }
3192
+ },
3193
+ "foreignKeys": {
3194
+ "topics_tenant_id_tenants_id_fk": {
3195
+ "name": "topics_tenant_id_tenants_id_fk",
3196
+ "tableFrom": "topics",
3197
+ "tableTo": "tenants",
3198
+ "columnsFrom": [
3199
+ "tenant_id"
3200
+ ],
3201
+ "columnsTo": [
3202
+ "id"
3203
+ ],
3204
+ "onDelete": "no action",
3205
+ "onUpdate": "no action"
3206
+ }
3207
+ },
3208
+ "compositePrimaryKeys": {},
3209
+ "uniqueConstraints": {},
3210
+ "checkConstraints": {}
3211
+ },
3212
+ "transport_configs": {
3213
+ "name": "transport_configs",
3214
+ "columns": {
3215
+ "id": {
3216
+ "name": "id",
3217
+ "type": "text",
3218
+ "primaryKey": true,
3219
+ "notNull": true,
3220
+ "autoincrement": false
3221
+ },
3222
+ "tenant_id": {
3223
+ "name": "tenant_id",
3224
+ "type": "text",
3225
+ "primaryKey": false,
3226
+ "notNull": true,
3227
+ "autoincrement": false
3228
+ },
3229
+ "provider": {
3230
+ "name": "provider",
3231
+ "type": "text",
3232
+ "primaryKey": false,
3233
+ "notNull": true,
3234
+ "autoincrement": false
3235
+ },
3236
+ "config": {
3237
+ "name": "config",
3238
+ "type": "text",
3239
+ "primaryKey": false,
3240
+ "notNull": true,
3241
+ "autoincrement": false
3242
+ },
3243
+ "is_active": {
3244
+ "name": "is_active",
3245
+ "type": "integer",
3246
+ "primaryKey": false,
3247
+ "notNull": false,
3248
+ "autoincrement": false,
3249
+ "default": true
3250
+ },
3251
+ "dkim_verified": {
3252
+ "name": "dkim_verified",
3253
+ "type": "integer",
3254
+ "primaryKey": false,
3255
+ "notNull": false,
3256
+ "autoincrement": false,
3257
+ "default": false
3258
+ },
3259
+ "from_email": {
3260
+ "name": "from_email",
3261
+ "type": "text",
3262
+ "primaryKey": false,
3263
+ "notNull": true,
3264
+ "autoincrement": false
3265
+ },
3266
+ "from_name": {
3267
+ "name": "from_name",
3268
+ "type": "text",
3269
+ "primaryKey": false,
3270
+ "notNull": false,
3271
+ "autoincrement": false
3272
+ },
3273
+ "daily_limit": {
3274
+ "name": "daily_limit",
3275
+ "type": "integer",
3276
+ "primaryKey": false,
3277
+ "notNull": false,
3278
+ "autoincrement": false
3279
+ },
3280
+ "kind": {
3281
+ "name": "kind",
3282
+ "type": "text",
3283
+ "primaryKey": false,
3284
+ "notNull": false,
3285
+ "autoincrement": false
3286
+ },
3287
+ "name": {
3288
+ "name": "name",
3289
+ "type": "text",
3290
+ "primaryKey": false,
3291
+ "notNull": false,
3292
+ "autoincrement": false
3293
+ },
3294
+ "reply_to": {
3295
+ "name": "reply_to",
3296
+ "type": "text",
3297
+ "primaryKey": false,
3298
+ "notNull": false,
3299
+ "autoincrement": false
3300
+ },
3301
+ "created_at": {
3302
+ "name": "created_at",
3303
+ "type": "integer",
3304
+ "primaryKey": false,
3305
+ "notNull": false,
3306
+ "autoincrement": false
3307
+ }
3308
+ },
3309
+ "indexes": {},
3310
+ "foreignKeys": {
3311
+ "transport_configs_tenant_id_tenants_id_fk": {
3312
+ "name": "transport_configs_tenant_id_tenants_id_fk",
3313
+ "tableFrom": "transport_configs",
3314
+ "tableTo": "tenants",
3315
+ "columnsFrom": [
3316
+ "tenant_id"
3317
+ ],
3318
+ "columnsTo": [
3319
+ "id"
3320
+ ],
3321
+ "onDelete": "no action",
3322
+ "onUpdate": "no action"
3323
+ }
3324
+ },
3325
+ "compositePrimaryKeys": {},
3326
+ "uniqueConstraints": {},
3327
+ "checkConstraints": {}
3328
+ },
3329
+ "users": {
3330
+ "name": "users",
3331
+ "columns": {
3332
+ "id": {
3333
+ "name": "id",
3334
+ "type": "text",
3335
+ "primaryKey": true,
3336
+ "notNull": true,
3337
+ "autoincrement": false
3338
+ },
3339
+ "tenant_id": {
3340
+ "name": "tenant_id",
3341
+ "type": "text",
3342
+ "primaryKey": false,
3343
+ "notNull": true,
3344
+ "autoincrement": false
3345
+ },
3346
+ "email": {
3347
+ "name": "email",
3348
+ "type": "text",
3349
+ "primaryKey": false,
3350
+ "notNull": true,
3351
+ "autoincrement": false
3352
+ },
3353
+ "name": {
3354
+ "name": "name",
3355
+ "type": "text",
3356
+ "primaryKey": false,
3357
+ "notNull": false,
3358
+ "autoincrement": false
3359
+ },
3360
+ "role": {
3361
+ "name": "role",
3362
+ "type": "text",
3363
+ "primaryKey": false,
3364
+ "notNull": true,
3365
+ "autoincrement": false,
3366
+ "default": "'member'"
3367
+ },
3368
+ "instance_role": {
3369
+ "name": "instance_role",
3370
+ "type": "text",
3371
+ "primaryKey": false,
3372
+ "notNull": false,
3373
+ "autoincrement": false
3374
+ },
3375
+ "last_login_at": {
3376
+ "name": "last_login_at",
3377
+ "type": "integer",
3378
+ "primaryKey": false,
3379
+ "notNull": false,
3380
+ "autoincrement": false
3381
+ },
3382
+ "deactivated_at": {
3383
+ "name": "deactivated_at",
3384
+ "type": "integer",
3385
+ "primaryKey": false,
3386
+ "notNull": false,
3387
+ "autoincrement": false
3388
+ },
3389
+ "pending_email": {
3390
+ "name": "pending_email",
3391
+ "type": "text",
3392
+ "primaryKey": false,
3393
+ "notNull": false,
3394
+ "autoincrement": false
3395
+ },
3396
+ "pending_email_token_hash": {
3397
+ "name": "pending_email_token_hash",
3398
+ "type": "text",
3399
+ "primaryKey": false,
3400
+ "notNull": false,
3401
+ "autoincrement": false
3402
+ },
3403
+ "pending_email_expires_at": {
3404
+ "name": "pending_email_expires_at",
3405
+ "type": "integer",
3406
+ "primaryKey": false,
3407
+ "notNull": false,
3408
+ "autoincrement": false
3409
+ },
3410
+ "created_at": {
3411
+ "name": "created_at",
3412
+ "type": "integer",
3413
+ "primaryKey": false,
3414
+ "notNull": false,
3415
+ "autoincrement": false
3416
+ }
3417
+ },
3418
+ "indexes": {
3419
+ "uq_users_tenant_email": {
3420
+ "name": "uq_users_tenant_email",
3421
+ "columns": [
3422
+ "tenant_id",
3423
+ "email"
3424
+ ],
3425
+ "isUnique": true
3426
+ }
3427
+ },
3428
+ "foreignKeys": {
3429
+ "users_tenant_id_tenants_id_fk": {
3430
+ "name": "users_tenant_id_tenants_id_fk",
3431
+ "tableFrom": "users",
3432
+ "tableTo": "tenants",
3433
+ "columnsFrom": [
3434
+ "tenant_id"
3435
+ ],
3436
+ "columnsTo": [
3437
+ "id"
3438
+ ],
3439
+ "onDelete": "no action",
3440
+ "onUpdate": "no action"
3441
+ }
3442
+ },
3443
+ "compositePrimaryKeys": {},
3444
+ "uniqueConstraints": {},
3445
+ "checkConstraints": {}
3446
+ },
3447
+ "webhook_endpoints": {
3448
+ "name": "webhook_endpoints",
3449
+ "columns": {
3450
+ "id": {
3451
+ "name": "id",
3452
+ "type": "text",
3453
+ "primaryKey": true,
3454
+ "notNull": true,
3455
+ "autoincrement": false
3456
+ },
3457
+ "tenant_id": {
3458
+ "name": "tenant_id",
3459
+ "type": "text",
3460
+ "primaryKey": false,
3461
+ "notNull": true,
3462
+ "autoincrement": false
3463
+ },
3464
+ "slug": {
3465
+ "name": "slug",
3466
+ "type": "text",
3467
+ "primaryKey": false,
3468
+ "notNull": true,
3469
+ "autoincrement": false
3470
+ },
3471
+ "kind": {
3472
+ "name": "kind",
3473
+ "type": "text",
3474
+ "primaryKey": false,
3475
+ "notNull": true,
3476
+ "autoincrement": false,
3477
+ "default": "'webhook'"
3478
+ },
3479
+ "url": {
3480
+ "name": "url",
3481
+ "type": "text",
3482
+ "primaryKey": false,
3483
+ "notNull": true,
3484
+ "autoincrement": false
3485
+ },
3486
+ "secret": {
3487
+ "name": "secret",
3488
+ "type": "text",
3489
+ "primaryKey": false,
3490
+ "notNull": false,
3491
+ "autoincrement": false
3492
+ },
3493
+ "events": {
3494
+ "name": "events",
3495
+ "type": "text",
3496
+ "primaryKey": false,
3497
+ "notNull": true,
3498
+ "autoincrement": false
3499
+ },
3500
+ "config": {
3501
+ "name": "config",
3502
+ "type": "text",
3503
+ "primaryKey": false,
3504
+ "notNull": false,
3505
+ "autoincrement": false
3506
+ },
3507
+ "enabled": {
3508
+ "name": "enabled",
3509
+ "type": "integer",
3510
+ "primaryKey": false,
3511
+ "notNull": true,
3512
+ "autoincrement": false,
3513
+ "default": true
3514
+ },
3515
+ "created_at": {
3516
+ "name": "created_at",
3517
+ "type": "integer",
3518
+ "primaryKey": false,
3519
+ "notNull": false,
3520
+ "autoincrement": false
3521
+ },
3522
+ "updated_at": {
3523
+ "name": "updated_at",
3524
+ "type": "integer",
3525
+ "primaryKey": false,
3526
+ "notNull": false,
3527
+ "autoincrement": false
3528
+ }
3529
+ },
3530
+ "indexes": {
3531
+ "uq_webhook_endpoints_tenant_slug": {
3532
+ "name": "uq_webhook_endpoints_tenant_slug",
3533
+ "columns": [
3534
+ "tenant_id",
3535
+ "slug"
3536
+ ],
3537
+ "isUnique": true
3538
+ }
3539
+ },
3540
+ "foreignKeys": {
3541
+ "webhook_endpoints_tenant_id_tenants_id_fk": {
3542
+ "name": "webhook_endpoints_tenant_id_tenants_id_fk",
3543
+ "tableFrom": "webhook_endpoints",
3544
+ "tableTo": "tenants",
3545
+ "columnsFrom": [
3546
+ "tenant_id"
3547
+ ],
3548
+ "columnsTo": [
3549
+ "id"
3550
+ ],
3551
+ "onDelete": "no action",
3552
+ "onUpdate": "no action"
3553
+ }
3554
+ },
3555
+ "compositePrimaryKeys": {},
3556
+ "uniqueConstraints": {},
3557
+ "checkConstraints": {}
3558
+ },
3559
+ "webhook_outbox": {
3560
+ "name": "webhook_outbox",
3561
+ "columns": {
3562
+ "id": {
3563
+ "name": "id",
3564
+ "type": "text",
3565
+ "primaryKey": true,
3566
+ "notNull": true,
3567
+ "autoincrement": false
3568
+ },
3569
+ "tenant_id": {
3570
+ "name": "tenant_id",
3571
+ "type": "text",
3572
+ "primaryKey": false,
3573
+ "notNull": true,
3574
+ "autoincrement": false
3575
+ },
3576
+ "endpoint_id": {
3577
+ "name": "endpoint_id",
3578
+ "type": "text",
3579
+ "primaryKey": false,
3580
+ "notNull": true,
3581
+ "autoincrement": false
3582
+ },
3583
+ "event": {
3584
+ "name": "event",
3585
+ "type": "text",
3586
+ "primaryKey": false,
3587
+ "notNull": true,
3588
+ "autoincrement": false
3589
+ },
3590
+ "payload": {
3591
+ "name": "payload",
3592
+ "type": "text",
3593
+ "primaryKey": false,
3594
+ "notNull": true,
3595
+ "autoincrement": false
3596
+ },
3597
+ "status": {
3598
+ "name": "status",
3599
+ "type": "text",
3600
+ "primaryKey": false,
3601
+ "notNull": true,
3602
+ "autoincrement": false,
3603
+ "default": "'pending'"
3604
+ },
3605
+ "attempts": {
3606
+ "name": "attempts",
3607
+ "type": "integer",
3608
+ "primaryKey": false,
3609
+ "notNull": true,
3610
+ "autoincrement": false,
3611
+ "default": 0
3612
+ },
3613
+ "next_attempt_at": {
3614
+ "name": "next_attempt_at",
3615
+ "type": "integer",
3616
+ "primaryKey": false,
3617
+ "notNull": true,
3618
+ "autoincrement": false
3619
+ },
3620
+ "last_error": {
3621
+ "name": "last_error",
3622
+ "type": "text",
3623
+ "primaryKey": false,
3624
+ "notNull": false,
3625
+ "autoincrement": false
3626
+ },
3627
+ "dedup_key": {
3628
+ "name": "dedup_key",
3629
+ "type": "text",
3630
+ "primaryKey": false,
3631
+ "notNull": false,
3632
+ "autoincrement": false
3633
+ },
3634
+ "created_at": {
3635
+ "name": "created_at",
3636
+ "type": "integer",
3637
+ "primaryKey": false,
3638
+ "notNull": true,
3639
+ "autoincrement": false
3640
+ },
3641
+ "delivered_at": {
3642
+ "name": "delivered_at",
3643
+ "type": "integer",
3644
+ "primaryKey": false,
3645
+ "notNull": false,
3646
+ "autoincrement": false
3647
+ }
3648
+ },
3649
+ "indexes": {
3650
+ "idx_webhook_outbox_due": {
3651
+ "name": "idx_webhook_outbox_due",
3652
+ "columns": [
3653
+ "tenant_id",
3654
+ "next_attempt_at"
3655
+ ],
3656
+ "isUnique": false,
3657
+ "where": "status = 'pending'"
3658
+ },
3659
+ "idx_webhook_outbox_tenant_event": {
3660
+ "name": "idx_webhook_outbox_tenant_event",
3661
+ "columns": [
3662
+ "tenant_id",
3663
+ "event",
3664
+ "created_at"
3665
+ ],
3666
+ "isUnique": false
3667
+ },
3668
+ "uq_webhook_outbox_dedup": {
3669
+ "name": "uq_webhook_outbox_dedup",
3670
+ "columns": [
3671
+ "tenant_id",
3672
+ "endpoint_id",
3673
+ "dedup_key"
3674
+ ],
3675
+ "isUnique": true,
3676
+ "where": "dedup_key IS NOT NULL"
3677
+ }
3678
+ },
3679
+ "foreignKeys": {
3680
+ "webhook_outbox_tenant_id_tenants_id_fk": {
3681
+ "name": "webhook_outbox_tenant_id_tenants_id_fk",
3682
+ "tableFrom": "webhook_outbox",
3683
+ "tableTo": "tenants",
3684
+ "columnsFrom": [
3685
+ "tenant_id"
3686
+ ],
3687
+ "columnsTo": [
3688
+ "id"
3689
+ ],
3690
+ "onDelete": "no action",
3691
+ "onUpdate": "no action"
3692
+ }
3693
+ },
3694
+ "compositePrimaryKeys": {},
3695
+ "uniqueConstraints": {},
3696
+ "checkConstraints": {}
3697
+ }
3698
+ },
3699
+ "views": {},
3700
+ "enums": {},
3701
+ "_meta": {
3702
+ "schemas": {},
3703
+ "tables": {},
3704
+ "columns": {}
3705
+ },
3706
+ "internal": {
3707
+ "indexes": {}
3708
+ }
3709
+ }