@claroshq/claros 0.0.0-stage → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -2
  3. package/assets/dashboard/apple-touch-icon.png +0 -0
  4. package/assets/dashboard/assets/bricolage-grotesque-latin-ext-wght-normal-CcLUaPy7.woff2 +0 -0
  5. package/assets/dashboard/assets/bricolage-grotesque-latin-wght-normal-DLoelf7F.woff2 +0 -0
  6. package/assets/dashboard/assets/bricolage-grotesque-vietnamese-wght-normal-BUzh504Q.woff2 +0 -0
  7. package/assets/dashboard/assets/index-Dvs1k10B.js +23 -0
  8. package/assets/dashboard/assets/index-gR64IOwq.css +1 -0
  9. package/assets/dashboard/assets/instrument-sans-latin-ext-wght-normal-B5bTHO_g.woff2 +0 -0
  10. package/assets/dashboard/assets/instrument-sans-latin-wght-normal-BbzFLZTg.woff2 +0 -0
  11. package/assets/dashboard/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
  12. package/assets/dashboard/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  13. package/assets/dashboard/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  14. package/assets/dashboard/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  15. package/assets/dashboard/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  16. package/assets/dashboard/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  17. package/assets/dashboard/assets/quicksand-latin-ext-wght-normal-CrJ75Ewg.woff2 +0 -0
  18. package/assets/dashboard/assets/quicksand-latin-wght-normal-Buj9m_3d.woff2 +0 -0
  19. package/assets/dashboard/assets/quicksand-vietnamese-wght-normal-ei70gACF.woff2 +0 -0
  20. package/assets/dashboard/claros.js +122 -0
  21. package/assets/dashboard/favicon-16.png +0 -0
  22. package/assets/dashboard/favicon-32.png +0 -0
  23. package/assets/dashboard/favicon.ico +0 -0
  24. package/assets/dashboard/favicon.svg +17 -0
  25. package/assets/dashboard/fonts-license.txt +119 -0
  26. package/assets/dashboard/index.html +34 -0
  27. package/assets/migrations/0000_baseline.sql +343 -0
  28. package/assets/migrations/0001_kb_fts.sql +22 -0
  29. package/assets/migrations/0002_instance_layer.sql +51 -0
  30. package/assets/migrations/0003_suppressions_lower_email.sql +22 -0
  31. package/assets/migrations/0004_claim_tokens.sql +9 -0
  32. package/assets/migrations/0005_topics_transports.sql +36 -0
  33. package/assets/migrations/0006_ops_alerts.sql +28 -0
  34. package/assets/migrations/0007_integration_surface.sql +46 -0
  35. package/assets/migrations/0008_p5_engine.sql +31 -0
  36. package/assets/migrations/0009_p5b_readiness.sql +11 -0
  37. package/assets/migrations/meta/0000_snapshot.json +2489 -0
  38. package/assets/migrations/meta/0002_snapshot.json +2645 -0
  39. package/assets/migrations/meta/0004_snapshot.json +2698 -0
  40. package/assets/migrations/meta/0005_snapshot.json +2959 -0
  41. package/assets/migrations/meta/0006_snapshot.json +3138 -0
  42. package/assets/migrations/meta/0007_snapshot.json +3469 -0
  43. package/assets/migrations/meta/0008_snapshot.json +3709 -0
  44. package/assets/migrations/meta/0009_snapshot.json +3785 -0
  45. package/assets/migrations/meta/_journal.json +76 -0
  46. package/assets/worker/index.js +57902 -0
  47. package/bin/claros.mjs +13 -0
  48. package/dist/apply.d.ts +10 -0
  49. package/dist/apply.d.ts.map +1 -0
  50. package/dist/apply.js +72 -0
  51. package/dist/apply.js.map +1 -0
  52. package/dist/assets.d.ts +15 -0
  53. package/dist/assets.d.ts.map +1 -0
  54. package/dist/assets.js +48 -0
  55. package/dist/assets.js.map +1 -0
  56. package/dist/claim.d.ts +12 -0
  57. package/dist/claim.d.ts.map +1 -0
  58. package/dist/claim.js +26 -0
  59. package/dist/claim.js.map +1 -0
  60. package/dist/cli.d.ts +13 -0
  61. package/dist/cli.d.ts.map +1 -0
  62. package/dist/cli.js +158 -0
  63. package/dist/cli.js.map +1 -0
  64. package/dist/cloudflare-api.d.ts +48 -0
  65. package/dist/cloudflare-api.d.ts.map +1 -0
  66. package/dist/cloudflare-api.js +94 -0
  67. package/dist/cloudflare-api.js.map +1 -0
  68. package/dist/import.d.ts +16 -0
  69. package/dist/import.d.ts.map +1 -0
  70. package/dist/import.js +97 -0
  71. package/dist/import.js.map +1 -0
  72. package/dist/ops.d.ts +84 -0
  73. package/dist/ops.d.ts.map +1 -0
  74. package/dist/ops.js +552 -0
  75. package/dist/ops.js.map +1 -0
  76. package/dist/state.d.ts +53 -0
  77. package/dist/state.d.ts.map +1 -0
  78. package/dist/state.js +87 -0
  79. package/dist/state.js.map +1 -0
  80. package/dist/template.d.ts +77 -0
  81. package/dist/template.d.ts.map +1 -0
  82. package/dist/template.js +127 -0
  83. package/dist/template.js.map +1 -0
  84. package/dist/version.d.ts +3 -0
  85. package/dist/version.d.ts.map +1 -0
  86. package/dist/version.js +36 -0
  87. package/dist/version.js.map +1 -0
  88. package/dist/wrangler.d.ts +116 -0
  89. package/dist/wrangler.d.ts.map +1 -0
  90. package/dist/wrangler.js +210 -0
  91. package/dist/wrangler.js.map +1 -0
  92. package/package.json +53 -4
@@ -0,0 +1,2698 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "88741939-e981-4d5e-b531-3f24fd1e8c3d",
5
+ "prevId": "b4fae80a-a550-4ee1-a3cb-afe65e5a76b6",
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
+ "last_used_at": {
61
+ "name": "last_used_at",
62
+ "type": "integer",
63
+ "primaryKey": false,
64
+ "notNull": false,
65
+ "autoincrement": false
66
+ },
67
+ "created_at": {
68
+ "name": "created_at",
69
+ "type": "integer",
70
+ "primaryKey": false,
71
+ "notNull": false,
72
+ "autoincrement": false
73
+ },
74
+ "revoked_at": {
75
+ "name": "revoked_at",
76
+ "type": "integer",
77
+ "primaryKey": false,
78
+ "notNull": false,
79
+ "autoincrement": false
80
+ }
81
+ },
82
+ "indexes": {
83
+ "uq_api_keys_hash_active": {
84
+ "name": "uq_api_keys_hash_active",
85
+ "columns": [
86
+ "key_hash"
87
+ ],
88
+ "isUnique": true,
89
+ "where": "revoked_at IS NULL"
90
+ },
91
+ "idx_api_keys_tenant": {
92
+ "name": "idx_api_keys_tenant",
93
+ "columns": [
94
+ "tenant_id"
95
+ ],
96
+ "isUnique": false
97
+ }
98
+ },
99
+ "foreignKeys": {
100
+ "api_keys_tenant_id_tenants_id_fk": {
101
+ "name": "api_keys_tenant_id_tenants_id_fk",
102
+ "tableFrom": "api_keys",
103
+ "tableTo": "tenants",
104
+ "columnsFrom": [
105
+ "tenant_id"
106
+ ],
107
+ "columnsTo": [
108
+ "id"
109
+ ],
110
+ "onDelete": "no action",
111
+ "onUpdate": "no action"
112
+ }
113
+ },
114
+ "compositePrimaryKeys": {},
115
+ "uniqueConstraints": {},
116
+ "checkConstraints": {}
117
+ },
118
+ "claim_tokens": {
119
+ "name": "claim_tokens",
120
+ "columns": {
121
+ "id": {
122
+ "name": "id",
123
+ "type": "text",
124
+ "primaryKey": true,
125
+ "notNull": true,
126
+ "autoincrement": false
127
+ },
128
+ "token_hash": {
129
+ "name": "token_hash",
130
+ "type": "text",
131
+ "primaryKey": false,
132
+ "notNull": true,
133
+ "autoincrement": false
134
+ },
135
+ "expires_at": {
136
+ "name": "expires_at",
137
+ "type": "integer",
138
+ "primaryKey": false,
139
+ "notNull": true,
140
+ "autoincrement": false
141
+ },
142
+ "consumed_at": {
143
+ "name": "consumed_at",
144
+ "type": "integer",
145
+ "primaryKey": false,
146
+ "notNull": false,
147
+ "autoincrement": false
148
+ },
149
+ "created_at": {
150
+ "name": "created_at",
151
+ "type": "integer",
152
+ "primaryKey": false,
153
+ "notNull": false,
154
+ "autoincrement": false
155
+ }
156
+ },
157
+ "indexes": {
158
+ "uq_claim_tokens_token_hash": {
159
+ "name": "uq_claim_tokens_token_hash",
160
+ "columns": [
161
+ "token_hash"
162
+ ],
163
+ "isUnique": true
164
+ }
165
+ },
166
+ "foreignKeys": {},
167
+ "compositePrimaryKeys": {},
168
+ "uniqueConstraints": {},
169
+ "checkConstraints": {}
170
+ },
171
+ "contact_conflicts": {
172
+ "name": "contact_conflicts",
173
+ "columns": {
174
+ "id": {
175
+ "name": "id",
176
+ "type": "text",
177
+ "primaryKey": true,
178
+ "notNull": true,
179
+ "autoincrement": false
180
+ },
181
+ "tenant_id": {
182
+ "name": "tenant_id",
183
+ "type": "text",
184
+ "primaryKey": false,
185
+ "notNull": true,
186
+ "autoincrement": false
187
+ },
188
+ "contact_id": {
189
+ "name": "contact_id",
190
+ "type": "text",
191
+ "primaryKey": false,
192
+ "notNull": true,
193
+ "autoincrement": false
194
+ },
195
+ "field": {
196
+ "name": "field",
197
+ "type": "text",
198
+ "primaryKey": false,
199
+ "notNull": true,
200
+ "autoincrement": false
201
+ },
202
+ "rejected_value": {
203
+ "name": "rejected_value",
204
+ "type": "text",
205
+ "primaryKey": false,
206
+ "notNull": true,
207
+ "autoincrement": false
208
+ },
209
+ "event_id": {
210
+ "name": "event_id",
211
+ "type": "text",
212
+ "primaryKey": false,
213
+ "notNull": true,
214
+ "autoincrement": false
215
+ },
216
+ "created_at": {
217
+ "name": "created_at",
218
+ "type": "integer",
219
+ "primaryKey": false,
220
+ "notNull": false,
221
+ "autoincrement": false
222
+ }
223
+ },
224
+ "indexes": {
225
+ "idx_contact_conflicts_tenant": {
226
+ "name": "idx_contact_conflicts_tenant",
227
+ "columns": [
228
+ "tenant_id",
229
+ "created_at"
230
+ ],
231
+ "isUnique": false
232
+ },
233
+ "idx_contact_conflicts_contact": {
234
+ "name": "idx_contact_conflicts_contact",
235
+ "columns": [
236
+ "contact_id"
237
+ ],
238
+ "isUnique": false
239
+ }
240
+ },
241
+ "foreignKeys": {
242
+ "contact_conflicts_tenant_id_tenants_id_fk": {
243
+ "name": "contact_conflicts_tenant_id_tenants_id_fk",
244
+ "tableFrom": "contact_conflicts",
245
+ "tableTo": "tenants",
246
+ "columnsFrom": [
247
+ "tenant_id"
248
+ ],
249
+ "columnsTo": [
250
+ "id"
251
+ ],
252
+ "onDelete": "no action",
253
+ "onUpdate": "no action"
254
+ },
255
+ "contact_conflicts_contact_id_contacts_id_fk": {
256
+ "name": "contact_conflicts_contact_id_contacts_id_fk",
257
+ "tableFrom": "contact_conflicts",
258
+ "tableTo": "contacts",
259
+ "columnsFrom": [
260
+ "contact_id"
261
+ ],
262
+ "columnsTo": [
263
+ "id"
264
+ ],
265
+ "onDelete": "no action",
266
+ "onUpdate": "no action"
267
+ }
268
+ },
269
+ "compositePrimaryKeys": {},
270
+ "uniqueConstraints": {},
271
+ "checkConstraints": {}
272
+ },
273
+ "contacts": {
274
+ "name": "contacts",
275
+ "columns": {
276
+ "id": {
277
+ "name": "id",
278
+ "type": "text",
279
+ "primaryKey": true,
280
+ "notNull": true,
281
+ "autoincrement": false
282
+ },
283
+ "tenant_id": {
284
+ "name": "tenant_id",
285
+ "type": "text",
286
+ "primaryKey": false,
287
+ "notNull": true,
288
+ "autoincrement": false
289
+ },
290
+ "external_id": {
291
+ "name": "external_id",
292
+ "type": "text",
293
+ "primaryKey": false,
294
+ "notNull": true,
295
+ "autoincrement": false
296
+ },
297
+ "email": {
298
+ "name": "email",
299
+ "type": "text",
300
+ "primaryKey": false,
301
+ "notNull": false,
302
+ "autoincrement": false
303
+ },
304
+ "name": {
305
+ "name": "name",
306
+ "type": "text",
307
+ "primaryKey": false,
308
+ "notNull": false,
309
+ "autoincrement": false
310
+ },
311
+ "company": {
312
+ "name": "company",
313
+ "type": "text",
314
+ "primaryKey": false,
315
+ "notNull": false,
316
+ "autoincrement": false
317
+ },
318
+ "properties": {
319
+ "name": "properties",
320
+ "type": "text",
321
+ "primaryKey": false,
322
+ "notNull": false,
323
+ "autoincrement": false
324
+ },
325
+ "lifecycle_state": {
326
+ "name": "lifecycle_state",
327
+ "type": "text",
328
+ "primaryKey": false,
329
+ "notNull": true,
330
+ "autoincrement": false
331
+ },
332
+ "engagement_depth": {
333
+ "name": "engagement_depth",
334
+ "type": "text",
335
+ "primaryKey": false,
336
+ "notNull": false,
337
+ "autoincrement": false
338
+ },
339
+ "payment_status": {
340
+ "name": "payment_status",
341
+ "type": "text",
342
+ "primaryKey": false,
343
+ "notNull": false,
344
+ "autoincrement": false,
345
+ "default": "'free'"
346
+ },
347
+ "first_seen_at": {
348
+ "name": "first_seen_at",
349
+ "type": "integer",
350
+ "primaryKey": false,
351
+ "notNull": false,
352
+ "autoincrement": false
353
+ },
354
+ "last_seen_at": {
355
+ "name": "last_seen_at",
356
+ "type": "integer",
357
+ "primaryKey": false,
358
+ "notNull": false,
359
+ "autoincrement": false
360
+ },
361
+ "activated_at": {
362
+ "name": "activated_at",
363
+ "type": "integer",
364
+ "primaryKey": false,
365
+ "notNull": false,
366
+ "autoincrement": false
367
+ },
368
+ "created_at": {
369
+ "name": "created_at",
370
+ "type": "integer",
371
+ "primaryKey": false,
372
+ "notNull": false,
373
+ "autoincrement": false
374
+ },
375
+ "event_count_bucket_current": {
376
+ "name": "event_count_bucket_current",
377
+ "type": "integer",
378
+ "primaryKey": false,
379
+ "notNull": false,
380
+ "autoincrement": false,
381
+ "default": 0
382
+ },
383
+ "event_count_bucket_prev": {
384
+ "name": "event_count_bucket_prev",
385
+ "type": "integer",
386
+ "primaryKey": false,
387
+ "notNull": false,
388
+ "autoincrement": false,
389
+ "default": 0
390
+ },
391
+ "last_counter_reset_at": {
392
+ "name": "last_counter_reset_at",
393
+ "type": "integer",
394
+ "primaryKey": false,
395
+ "notNull": false,
396
+ "autoincrement": false
397
+ }
398
+ },
399
+ "indexes": {
400
+ "uq_contacts_tenant_external_id": {
401
+ "name": "uq_contacts_tenant_external_id",
402
+ "columns": [
403
+ "tenant_id",
404
+ "external_id"
405
+ ],
406
+ "isUnique": true
407
+ },
408
+ "uq_contacts_tenant_email": {
409
+ "name": "uq_contacts_tenant_email",
410
+ "columns": [
411
+ "tenant_id",
412
+ "email"
413
+ ],
414
+ "isUnique": true,
415
+ "where": "email IS NOT NULL"
416
+ },
417
+ "idx_contacts_tenant_state": {
418
+ "name": "idx_contacts_tenant_state",
419
+ "columns": [
420
+ "tenant_id",
421
+ "lifecycle_state"
422
+ ],
423
+ "isUnique": false
424
+ },
425
+ "idx_contacts_last_seen": {
426
+ "name": "idx_contacts_last_seen",
427
+ "columns": [
428
+ "tenant_id",
429
+ "last_seen_at"
430
+ ],
431
+ "isUnique": false
432
+ },
433
+ "idx_contacts_tenant_created": {
434
+ "name": "idx_contacts_tenant_created",
435
+ "columns": [
436
+ "tenant_id",
437
+ "created_at",
438
+ "id"
439
+ ],
440
+ "isUnique": false
441
+ }
442
+ },
443
+ "foreignKeys": {
444
+ "contacts_tenant_id_tenants_id_fk": {
445
+ "name": "contacts_tenant_id_tenants_id_fk",
446
+ "tableFrom": "contacts",
447
+ "tableTo": "tenants",
448
+ "columnsFrom": [
449
+ "tenant_id"
450
+ ],
451
+ "columnsTo": [
452
+ "id"
453
+ ],
454
+ "onDelete": "no action",
455
+ "onUpdate": "no action"
456
+ }
457
+ },
458
+ "compositePrimaryKeys": {},
459
+ "uniqueConstraints": {},
460
+ "checkConstraints": {}
461
+ },
462
+ "events": {
463
+ "name": "events",
464
+ "columns": {
465
+ "id": {
466
+ "name": "id",
467
+ "type": "text",
468
+ "primaryKey": true,
469
+ "notNull": true,
470
+ "autoincrement": false
471
+ },
472
+ "tenant_id": {
473
+ "name": "tenant_id",
474
+ "type": "text",
475
+ "primaryKey": false,
476
+ "notNull": true,
477
+ "autoincrement": false
478
+ },
479
+ "contact_id": {
480
+ "name": "contact_id",
481
+ "type": "text",
482
+ "primaryKey": false,
483
+ "notNull": true,
484
+ "autoincrement": false
485
+ },
486
+ "type": {
487
+ "name": "type",
488
+ "type": "text",
489
+ "primaryKey": false,
490
+ "notNull": true,
491
+ "autoincrement": false
492
+ },
493
+ "event_name": {
494
+ "name": "event_name",
495
+ "type": "text",
496
+ "primaryKey": false,
497
+ "notNull": false,
498
+ "autoincrement": false
499
+ },
500
+ "properties": {
501
+ "name": "properties",
502
+ "type": "text",
503
+ "primaryKey": false,
504
+ "notNull": false,
505
+ "autoincrement": false
506
+ },
507
+ "context": {
508
+ "name": "context",
509
+ "type": "text",
510
+ "primaryKey": false,
511
+ "notNull": false,
512
+ "autoincrement": false
513
+ },
514
+ "message_id": {
515
+ "name": "message_id",
516
+ "type": "text",
517
+ "primaryKey": false,
518
+ "notNull": false,
519
+ "autoincrement": false
520
+ },
521
+ "timestamp": {
522
+ "name": "timestamp",
523
+ "type": "integer",
524
+ "primaryKey": false,
525
+ "notNull": true,
526
+ "autoincrement": false
527
+ },
528
+ "received_at": {
529
+ "name": "received_at",
530
+ "type": "integer",
531
+ "primaryKey": false,
532
+ "notNull": true,
533
+ "autoincrement": false
534
+ }
535
+ },
536
+ "indexes": {
537
+ "idx_events_contact_time": {
538
+ "name": "idx_events_contact_time",
539
+ "columns": [
540
+ "contact_id",
541
+ "timestamp"
542
+ ],
543
+ "isUnique": false
544
+ },
545
+ "idx_events_tenant_name": {
546
+ "name": "idx_events_tenant_name",
547
+ "columns": [
548
+ "tenant_id",
549
+ "event_name",
550
+ "timestamp"
551
+ ],
552
+ "isUnique": false
553
+ },
554
+ "idx_events_tenant_time": {
555
+ "name": "idx_events_tenant_time",
556
+ "columns": [
557
+ "tenant_id",
558
+ "timestamp"
559
+ ],
560
+ "isUnique": false
561
+ },
562
+ "idx_events_dedup_lookup": {
563
+ "name": "idx_events_dedup_lookup",
564
+ "columns": [
565
+ "tenant_id",
566
+ "message_id"
567
+ ],
568
+ "isUnique": false,
569
+ "where": "message_id IS NOT NULL"
570
+ }
571
+ },
572
+ "foreignKeys": {
573
+ "events_tenant_id_tenants_id_fk": {
574
+ "name": "events_tenant_id_tenants_id_fk",
575
+ "tableFrom": "events",
576
+ "tableTo": "tenants",
577
+ "columnsFrom": [
578
+ "tenant_id"
579
+ ],
580
+ "columnsTo": [
581
+ "id"
582
+ ],
583
+ "onDelete": "no action",
584
+ "onUpdate": "no action"
585
+ },
586
+ "events_contact_id_contacts_id_fk": {
587
+ "name": "events_contact_id_contacts_id_fk",
588
+ "tableFrom": "events",
589
+ "tableTo": "contacts",
590
+ "columnsFrom": [
591
+ "contact_id"
592
+ ],
593
+ "columnsTo": [
594
+ "id"
595
+ ],
596
+ "onDelete": "no action",
597
+ "onUpdate": "no action"
598
+ }
599
+ },
600
+ "compositePrimaryKeys": {},
601
+ "uniqueConstraints": {},
602
+ "checkConstraints": {}
603
+ },
604
+ "flow_memberships": {
605
+ "name": "flow_memberships",
606
+ "columns": {
607
+ "id": {
608
+ "name": "id",
609
+ "type": "text",
610
+ "primaryKey": true,
611
+ "notNull": true,
612
+ "autoincrement": false
613
+ },
614
+ "tenant_id": {
615
+ "name": "tenant_id",
616
+ "type": "text",
617
+ "primaryKey": false,
618
+ "notNull": true,
619
+ "autoincrement": false
620
+ },
621
+ "contact_id": {
622
+ "name": "contact_id",
623
+ "type": "text",
624
+ "primaryKey": false,
625
+ "notNull": true,
626
+ "autoincrement": false
627
+ },
628
+ "flow_id": {
629
+ "name": "flow_id",
630
+ "type": "text",
631
+ "primaryKey": false,
632
+ "notNull": true,
633
+ "autoincrement": false
634
+ },
635
+ "current_step": {
636
+ "name": "current_step",
637
+ "type": "integer",
638
+ "primaryKey": false,
639
+ "notNull": true,
640
+ "autoincrement": false,
641
+ "default": 1
642
+ },
643
+ "status": {
644
+ "name": "status",
645
+ "type": "text",
646
+ "primaryKey": false,
647
+ "notNull": true,
648
+ "autoincrement": false,
649
+ "default": "'active'"
650
+ },
651
+ "entered_at": {
652
+ "name": "entered_at",
653
+ "type": "integer",
654
+ "primaryKey": false,
655
+ "notNull": true,
656
+ "autoincrement": false
657
+ },
658
+ "completed_at": {
659
+ "name": "completed_at",
660
+ "type": "integer",
661
+ "primaryKey": false,
662
+ "notNull": false,
663
+ "autoincrement": false
664
+ },
665
+ "exited_at": {
666
+ "name": "exited_at",
667
+ "type": "integer",
668
+ "primaryKey": false,
669
+ "notNull": false,
670
+ "autoincrement": false
671
+ },
672
+ "exit_reason": {
673
+ "name": "exit_reason",
674
+ "type": "text",
675
+ "primaryKey": false,
676
+ "notNull": false,
677
+ "autoincrement": false
678
+ },
679
+ "condition_error": {
680
+ "name": "condition_error",
681
+ "type": "text",
682
+ "primaryKey": false,
683
+ "notNull": false,
684
+ "autoincrement": false
685
+ }
686
+ },
687
+ "indexes": {
688
+ "uq_flow_membership_active": {
689
+ "name": "uq_flow_membership_active",
690
+ "columns": [
691
+ "contact_id",
692
+ "flow_id"
693
+ ],
694
+ "isUnique": true,
695
+ "where": "status = 'active'"
696
+ },
697
+ "idx_flow_members_contact": {
698
+ "name": "idx_flow_members_contact",
699
+ "columns": [
700
+ "contact_id",
701
+ "status"
702
+ ],
703
+ "isUnique": false
704
+ },
705
+ "idx_flow_members_flow": {
706
+ "name": "idx_flow_members_flow",
707
+ "columns": [
708
+ "flow_id",
709
+ "status",
710
+ "current_step"
711
+ ],
712
+ "isUnique": false
713
+ }
714
+ },
715
+ "foreignKeys": {
716
+ "flow_memberships_tenant_id_tenants_id_fk": {
717
+ "name": "flow_memberships_tenant_id_tenants_id_fk",
718
+ "tableFrom": "flow_memberships",
719
+ "tableTo": "tenants",
720
+ "columnsFrom": [
721
+ "tenant_id"
722
+ ],
723
+ "columnsTo": [
724
+ "id"
725
+ ],
726
+ "onDelete": "no action",
727
+ "onUpdate": "no action"
728
+ },
729
+ "flow_memberships_contact_id_contacts_id_fk": {
730
+ "name": "flow_memberships_contact_id_contacts_id_fk",
731
+ "tableFrom": "flow_memberships",
732
+ "tableTo": "contacts",
733
+ "columnsFrom": [
734
+ "contact_id"
735
+ ],
736
+ "columnsTo": [
737
+ "id"
738
+ ],
739
+ "onDelete": "no action",
740
+ "onUpdate": "no action"
741
+ },
742
+ "flow_memberships_flow_id_flows_id_fk": {
743
+ "name": "flow_memberships_flow_id_flows_id_fk",
744
+ "tableFrom": "flow_memberships",
745
+ "tableTo": "flows",
746
+ "columnsFrom": [
747
+ "flow_id"
748
+ ],
749
+ "columnsTo": [
750
+ "id"
751
+ ],
752
+ "onDelete": "no action",
753
+ "onUpdate": "no action"
754
+ }
755
+ },
756
+ "compositePrimaryKeys": {},
757
+ "uniqueConstraints": {},
758
+ "checkConstraints": {}
759
+ },
760
+ "flows": {
761
+ "name": "flows",
762
+ "columns": {
763
+ "id": {
764
+ "name": "id",
765
+ "type": "text",
766
+ "primaryKey": true,
767
+ "notNull": true,
768
+ "autoincrement": false
769
+ },
770
+ "tenant_id": {
771
+ "name": "tenant_id",
772
+ "type": "text",
773
+ "primaryKey": false,
774
+ "notNull": true,
775
+ "autoincrement": false
776
+ },
777
+ "name": {
778
+ "name": "name",
779
+ "type": "text",
780
+ "primaryKey": false,
781
+ "notNull": true,
782
+ "autoincrement": false
783
+ },
784
+ "description": {
785
+ "name": "description",
786
+ "type": "text",
787
+ "primaryKey": false,
788
+ "notNull": false,
789
+ "autoincrement": false
790
+ },
791
+ "priority": {
792
+ "name": "priority",
793
+ "type": "integer",
794
+ "primaryKey": false,
795
+ "notNull": false,
796
+ "autoincrement": false,
797
+ "default": 0
798
+ },
799
+ "trigger_type": {
800
+ "name": "trigger_type",
801
+ "type": "text",
802
+ "primaryKey": false,
803
+ "notNull": true,
804
+ "autoincrement": false
805
+ },
806
+ "trigger_config": {
807
+ "name": "trigger_config",
808
+ "type": "text",
809
+ "primaryKey": false,
810
+ "notNull": true,
811
+ "autoincrement": false
812
+ },
813
+ "steps": {
814
+ "name": "steps",
815
+ "type": "text",
816
+ "primaryKey": false,
817
+ "notNull": true,
818
+ "autoincrement": false
819
+ },
820
+ "source": {
821
+ "name": "source",
822
+ "type": "text",
823
+ "primaryKey": false,
824
+ "notNull": false,
825
+ "autoincrement": false,
826
+ "default": "'manual'"
827
+ },
828
+ "content_mode": {
829
+ "name": "content_mode",
830
+ "type": "text",
831
+ "primaryKey": false,
832
+ "notNull": false,
833
+ "autoincrement": false,
834
+ "default": "'ai_drafted'"
835
+ },
836
+ "status": {
837
+ "name": "status",
838
+ "type": "text",
839
+ "primaryKey": false,
840
+ "notNull": false,
841
+ "autoincrement": false,
842
+ "default": "'draft'"
843
+ },
844
+ "approval_mode": {
845
+ "name": "approval_mode",
846
+ "type": "text",
847
+ "primaryKey": false,
848
+ "notNull": false,
849
+ "autoincrement": false,
850
+ "default": "'require'"
851
+ },
852
+ "flow_class": {
853
+ "name": "flow_class",
854
+ "type": "text",
855
+ "primaryKey": false,
856
+ "notNull": true,
857
+ "autoincrement": false,
858
+ "default": "'nurture'"
859
+ },
860
+ "reentry_policy": {
861
+ "name": "reentry_policy",
862
+ "type": "text",
863
+ "primaryKey": false,
864
+ "notNull": true,
865
+ "autoincrement": false,
866
+ "default": "'cooldown'"
867
+ },
868
+ "reentry_cooldown_days": {
869
+ "name": "reentry_cooldown_days",
870
+ "type": "integer",
871
+ "primaryKey": false,
872
+ "notNull": false,
873
+ "autoincrement": false,
874
+ "default": 30
875
+ },
876
+ "prompt_source": {
877
+ "name": "prompt_source",
878
+ "type": "text",
879
+ "primaryKey": false,
880
+ "notNull": false,
881
+ "autoincrement": false
882
+ },
883
+ "compiled_plan": {
884
+ "name": "compiled_plan",
885
+ "type": "text",
886
+ "primaryKey": false,
887
+ "notNull": false,
888
+ "autoincrement": false
889
+ },
890
+ "compiled_at": {
891
+ "name": "compiled_at",
892
+ "type": "integer",
893
+ "primaryKey": false,
894
+ "notNull": false,
895
+ "autoincrement": false
896
+ },
897
+ "compile_status": {
898
+ "name": "compile_status",
899
+ "type": "text",
900
+ "primaryKey": false,
901
+ "notNull": false,
902
+ "autoincrement": false
903
+ },
904
+ "compile_error": {
905
+ "name": "compile_error",
906
+ "type": "text",
907
+ "primaryKey": false,
908
+ "notNull": false,
909
+ "autoincrement": false
910
+ },
911
+ "created_at": {
912
+ "name": "created_at",
913
+ "type": "integer",
914
+ "primaryKey": false,
915
+ "notNull": false,
916
+ "autoincrement": false
917
+ },
918
+ "updated_at": {
919
+ "name": "updated_at",
920
+ "type": "integer",
921
+ "primaryKey": false,
922
+ "notNull": false,
923
+ "autoincrement": false
924
+ }
925
+ },
926
+ "indexes": {},
927
+ "foreignKeys": {
928
+ "flows_tenant_id_tenants_id_fk": {
929
+ "name": "flows_tenant_id_tenants_id_fk",
930
+ "tableFrom": "flows",
931
+ "tableTo": "tenants",
932
+ "columnsFrom": [
933
+ "tenant_id"
934
+ ],
935
+ "columnsTo": [
936
+ "id"
937
+ ],
938
+ "onDelete": "no action",
939
+ "onUpdate": "no action"
940
+ }
941
+ },
942
+ "compositePrimaryKeys": {},
943
+ "uniqueConstraints": {},
944
+ "checkConstraints": {}
945
+ },
946
+ "instance_settings": {
947
+ "name": "instance_settings",
948
+ "columns": {
949
+ "key": {
950
+ "name": "key",
951
+ "type": "text",
952
+ "primaryKey": true,
953
+ "notNull": true,
954
+ "autoincrement": false
955
+ },
956
+ "value": {
957
+ "name": "value",
958
+ "type": "text",
959
+ "primaryKey": false,
960
+ "notNull": true,
961
+ "autoincrement": false
962
+ },
963
+ "updated_at": {
964
+ "name": "updated_at",
965
+ "type": "integer",
966
+ "primaryKey": false,
967
+ "notNull": false,
968
+ "autoincrement": false
969
+ }
970
+ },
971
+ "indexes": {},
972
+ "foreignKeys": {},
973
+ "compositePrimaryKeys": {},
974
+ "uniqueConstraints": {},
975
+ "checkConstraints": {}
976
+ },
977
+ "invites": {
978
+ "name": "invites",
979
+ "columns": {
980
+ "id": {
981
+ "name": "id",
982
+ "type": "text",
983
+ "primaryKey": true,
984
+ "notNull": true,
985
+ "autoincrement": false
986
+ },
987
+ "tenant_id": {
988
+ "name": "tenant_id",
989
+ "type": "text",
990
+ "primaryKey": false,
991
+ "notNull": true,
992
+ "autoincrement": false
993
+ },
994
+ "email": {
995
+ "name": "email",
996
+ "type": "text",
997
+ "primaryKey": false,
998
+ "notNull": true,
999
+ "autoincrement": false
1000
+ },
1001
+ "role": {
1002
+ "name": "role",
1003
+ "type": "text",
1004
+ "primaryKey": false,
1005
+ "notNull": true,
1006
+ "autoincrement": false,
1007
+ "default": "'member'"
1008
+ },
1009
+ "token_hash": {
1010
+ "name": "token_hash",
1011
+ "type": "text",
1012
+ "primaryKey": false,
1013
+ "notNull": true,
1014
+ "autoincrement": false
1015
+ },
1016
+ "invited_by": {
1017
+ "name": "invited_by",
1018
+ "type": "text",
1019
+ "primaryKey": false,
1020
+ "notNull": true,
1021
+ "autoincrement": false
1022
+ },
1023
+ "expires_at": {
1024
+ "name": "expires_at",
1025
+ "type": "integer",
1026
+ "primaryKey": false,
1027
+ "notNull": true,
1028
+ "autoincrement": false
1029
+ },
1030
+ "accepted_at": {
1031
+ "name": "accepted_at",
1032
+ "type": "integer",
1033
+ "primaryKey": false,
1034
+ "notNull": false,
1035
+ "autoincrement": false
1036
+ },
1037
+ "created_at": {
1038
+ "name": "created_at",
1039
+ "type": "integer",
1040
+ "primaryKey": false,
1041
+ "notNull": false,
1042
+ "autoincrement": false
1043
+ }
1044
+ },
1045
+ "indexes": {
1046
+ "idx_invites_token_hash": {
1047
+ "name": "idx_invites_token_hash",
1048
+ "columns": [
1049
+ "token_hash"
1050
+ ],
1051
+ "isUnique": false
1052
+ },
1053
+ "idx_invites_tenant": {
1054
+ "name": "idx_invites_tenant",
1055
+ "columns": [
1056
+ "tenant_id"
1057
+ ],
1058
+ "isUnique": false
1059
+ }
1060
+ },
1061
+ "foreignKeys": {
1062
+ "invites_tenant_id_tenants_id_fk": {
1063
+ "name": "invites_tenant_id_tenants_id_fk",
1064
+ "tableFrom": "invites",
1065
+ "tableTo": "tenants",
1066
+ "columnsFrom": [
1067
+ "tenant_id"
1068
+ ],
1069
+ "columnsTo": [
1070
+ "id"
1071
+ ],
1072
+ "onDelete": "no action",
1073
+ "onUpdate": "no action"
1074
+ },
1075
+ "invites_invited_by_users_id_fk": {
1076
+ "name": "invites_invited_by_users_id_fk",
1077
+ "tableFrom": "invites",
1078
+ "tableTo": "users",
1079
+ "columnsFrom": [
1080
+ "invited_by"
1081
+ ],
1082
+ "columnsTo": [
1083
+ "id"
1084
+ ],
1085
+ "onDelete": "no action",
1086
+ "onUpdate": "no action"
1087
+ }
1088
+ },
1089
+ "compositePrimaryKeys": {},
1090
+ "uniqueConstraints": {},
1091
+ "checkConstraints": {}
1092
+ },
1093
+ "kb_entries": {
1094
+ "name": "kb_entries",
1095
+ "columns": {
1096
+ "id": {
1097
+ "name": "id",
1098
+ "type": "text",
1099
+ "primaryKey": true,
1100
+ "notNull": true,
1101
+ "autoincrement": false
1102
+ },
1103
+ "tenant_id": {
1104
+ "name": "tenant_id",
1105
+ "type": "text",
1106
+ "primaryKey": false,
1107
+ "notNull": true,
1108
+ "autoincrement": false
1109
+ },
1110
+ "title": {
1111
+ "name": "title",
1112
+ "type": "text",
1113
+ "primaryKey": false,
1114
+ "notNull": true,
1115
+ "autoincrement": false
1116
+ },
1117
+ "content": {
1118
+ "name": "content",
1119
+ "type": "text",
1120
+ "primaryKey": false,
1121
+ "notNull": true,
1122
+ "autoincrement": false
1123
+ },
1124
+ "content_type": {
1125
+ "name": "content_type",
1126
+ "type": "text",
1127
+ "primaryKey": false,
1128
+ "notNull": false,
1129
+ "autoincrement": false,
1130
+ "default": "'markdown'"
1131
+ },
1132
+ "source": {
1133
+ "name": "source",
1134
+ "type": "text",
1135
+ "primaryKey": false,
1136
+ "notNull": false,
1137
+ "autoincrement": false,
1138
+ "default": "'manual'"
1139
+ },
1140
+ "source_url": {
1141
+ "name": "source_url",
1142
+ "type": "text",
1143
+ "primaryKey": false,
1144
+ "notNull": false,
1145
+ "autoincrement": false
1146
+ },
1147
+ "tags": {
1148
+ "name": "tags",
1149
+ "type": "text",
1150
+ "primaryKey": false,
1151
+ "notNull": false,
1152
+ "autoincrement": false
1153
+ },
1154
+ "embedding": {
1155
+ "name": "embedding",
1156
+ "type": "text",
1157
+ "primaryKey": false,
1158
+ "notNull": false,
1159
+ "autoincrement": false
1160
+ },
1161
+ "embedding_status": {
1162
+ "name": "embedding_status",
1163
+ "type": "text",
1164
+ "primaryKey": false,
1165
+ "notNull": false,
1166
+ "autoincrement": false
1167
+ },
1168
+ "embedding_error": {
1169
+ "name": "embedding_error",
1170
+ "type": "text",
1171
+ "primaryKey": false,
1172
+ "notNull": false,
1173
+ "autoincrement": false
1174
+ },
1175
+ "is_active": {
1176
+ "name": "is_active",
1177
+ "type": "integer",
1178
+ "primaryKey": false,
1179
+ "notNull": false,
1180
+ "autoincrement": false,
1181
+ "default": true
1182
+ },
1183
+ "created_at": {
1184
+ "name": "created_at",
1185
+ "type": "integer",
1186
+ "primaryKey": false,
1187
+ "notNull": false,
1188
+ "autoincrement": false
1189
+ },
1190
+ "updated_at": {
1191
+ "name": "updated_at",
1192
+ "type": "integer",
1193
+ "primaryKey": false,
1194
+ "notNull": false,
1195
+ "autoincrement": false
1196
+ }
1197
+ },
1198
+ "indexes": {
1199
+ "idx_kb_entries_tenant_created": {
1200
+ "name": "idx_kb_entries_tenant_created",
1201
+ "columns": [
1202
+ "tenant_id",
1203
+ "created_at",
1204
+ "id"
1205
+ ],
1206
+ "isUnique": false
1207
+ }
1208
+ },
1209
+ "foreignKeys": {
1210
+ "kb_entries_tenant_id_tenants_id_fk": {
1211
+ "name": "kb_entries_tenant_id_tenants_id_fk",
1212
+ "tableFrom": "kb_entries",
1213
+ "tableTo": "tenants",
1214
+ "columnsFrom": [
1215
+ "tenant_id"
1216
+ ],
1217
+ "columnsTo": [
1218
+ "id"
1219
+ ],
1220
+ "onDelete": "no action",
1221
+ "onUpdate": "no action"
1222
+ }
1223
+ },
1224
+ "compositePrimaryKeys": {},
1225
+ "uniqueConstraints": {},
1226
+ "checkConstraints": {}
1227
+ },
1228
+ "lifecycle_messages": {
1229
+ "name": "lifecycle_messages",
1230
+ "columns": {
1231
+ "id": {
1232
+ "name": "id",
1233
+ "type": "text",
1234
+ "primaryKey": true,
1235
+ "notNull": true,
1236
+ "autoincrement": false
1237
+ },
1238
+ "tenant_id": {
1239
+ "name": "tenant_id",
1240
+ "type": "text",
1241
+ "primaryKey": false,
1242
+ "notNull": true,
1243
+ "autoincrement": false
1244
+ },
1245
+ "contact_id": {
1246
+ "name": "contact_id",
1247
+ "type": "text",
1248
+ "primaryKey": false,
1249
+ "notNull": true,
1250
+ "autoincrement": false
1251
+ },
1252
+ "flow_id": {
1253
+ "name": "flow_id",
1254
+ "type": "text",
1255
+ "primaryKey": false,
1256
+ "notNull": true,
1257
+ "autoincrement": false
1258
+ },
1259
+ "membership_id": {
1260
+ "name": "membership_id",
1261
+ "type": "text",
1262
+ "primaryKey": false,
1263
+ "notNull": true,
1264
+ "autoincrement": false
1265
+ },
1266
+ "flow_step_order": {
1267
+ "name": "flow_step_order",
1268
+ "type": "integer",
1269
+ "primaryKey": false,
1270
+ "notNull": false,
1271
+ "autoincrement": false
1272
+ },
1273
+ "status": {
1274
+ "name": "status",
1275
+ "type": "text",
1276
+ "primaryKey": false,
1277
+ "notNull": true,
1278
+ "autoincrement": false
1279
+ },
1280
+ "feedback": {
1281
+ "name": "feedback",
1282
+ "type": "text",
1283
+ "primaryKey": false,
1284
+ "notNull": false,
1285
+ "autoincrement": false
1286
+ },
1287
+ "subject": {
1288
+ "name": "subject",
1289
+ "type": "text",
1290
+ "primaryKey": false,
1291
+ "notNull": false,
1292
+ "autoincrement": false
1293
+ },
1294
+ "body_html": {
1295
+ "name": "body_html",
1296
+ "type": "text",
1297
+ "primaryKey": false,
1298
+ "notNull": false,
1299
+ "autoincrement": false
1300
+ },
1301
+ "body_text": {
1302
+ "name": "body_text",
1303
+ "type": "text",
1304
+ "primaryKey": false,
1305
+ "notNull": false,
1306
+ "autoincrement": false
1307
+ },
1308
+ "brain_reasoning": {
1309
+ "name": "brain_reasoning",
1310
+ "type": "text",
1311
+ "primaryKey": false,
1312
+ "notNull": false,
1313
+ "autoincrement": false
1314
+ },
1315
+ "brain_action_type": {
1316
+ "name": "brain_action_type",
1317
+ "type": "text",
1318
+ "primaryKey": false,
1319
+ "notNull": false,
1320
+ "autoincrement": false
1321
+ },
1322
+ "scheduled_send_at": {
1323
+ "name": "scheduled_send_at",
1324
+ "type": "integer",
1325
+ "primaryKey": false,
1326
+ "notNull": false,
1327
+ "autoincrement": false
1328
+ },
1329
+ "approved_at": {
1330
+ "name": "approved_at",
1331
+ "type": "integer",
1332
+ "primaryKey": false,
1333
+ "notNull": false,
1334
+ "autoincrement": false
1335
+ },
1336
+ "sent_at": {
1337
+ "name": "sent_at",
1338
+ "type": "integer",
1339
+ "primaryKey": false,
1340
+ "notNull": false,
1341
+ "autoincrement": false
1342
+ },
1343
+ "retry_count": {
1344
+ "name": "retry_count",
1345
+ "type": "integer",
1346
+ "primaryKey": false,
1347
+ "notNull": false,
1348
+ "autoincrement": false,
1349
+ "default": 0
1350
+ },
1351
+ "provider_message_id": {
1352
+ "name": "provider_message_id",
1353
+ "type": "text",
1354
+ "primaryKey": false,
1355
+ "notNull": false,
1356
+ "autoincrement": false
1357
+ },
1358
+ "recipient_address": {
1359
+ "name": "recipient_address",
1360
+ "type": "text",
1361
+ "primaryKey": false,
1362
+ "notNull": false,
1363
+ "autoincrement": false
1364
+ },
1365
+ "created_at": {
1366
+ "name": "created_at",
1367
+ "type": "integer",
1368
+ "primaryKey": false,
1369
+ "notNull": false,
1370
+ "autoincrement": false
1371
+ },
1372
+ "updated_at": {
1373
+ "name": "updated_at",
1374
+ "type": "integer",
1375
+ "primaryKey": false,
1376
+ "notNull": false,
1377
+ "autoincrement": false
1378
+ }
1379
+ },
1380
+ "indexes": {
1381
+ "idx_messages_drain": {
1382
+ "name": "idx_messages_drain",
1383
+ "columns": [
1384
+ "tenant_id",
1385
+ "status",
1386
+ "scheduled_send_at"
1387
+ ],
1388
+ "isUnique": false,
1389
+ "where": "status IN ('approved', 'sending')"
1390
+ },
1391
+ "idx_messages_contact": {
1392
+ "name": "idx_messages_contact",
1393
+ "columns": [
1394
+ "contact_id",
1395
+ "status",
1396
+ "created_at"
1397
+ ],
1398
+ "isUnique": false
1399
+ },
1400
+ "idx_messages_contact_sent": {
1401
+ "name": "idx_messages_contact_sent",
1402
+ "columns": [
1403
+ "contact_id",
1404
+ "sent_at"
1405
+ ],
1406
+ "isUnique": false,
1407
+ "where": "status IN ('sending', 'sent')"
1408
+ },
1409
+ "uq_messages_membership_step": {
1410
+ "name": "uq_messages_membership_step",
1411
+ "columns": [
1412
+ "membership_id",
1413
+ "flow_step_order"
1414
+ ],
1415
+ "isUnique": true
1416
+ },
1417
+ "idx_messages_generation": {
1418
+ "name": "idx_messages_generation",
1419
+ "columns": [
1420
+ "tenant_id",
1421
+ "status",
1422
+ "created_at"
1423
+ ],
1424
+ "isUnique": false,
1425
+ "where": "status IN ('pending_generation', 'generating')"
1426
+ },
1427
+ "idx_messages_provider_id": {
1428
+ "name": "idx_messages_provider_id",
1429
+ "columns": [
1430
+ "provider_message_id"
1431
+ ],
1432
+ "isUnique": false,
1433
+ "where": "provider_message_id IS NOT NULL"
1434
+ },
1435
+ "idx_messages_tenant_sent": {
1436
+ "name": "idx_messages_tenant_sent",
1437
+ "columns": [
1438
+ "tenant_id",
1439
+ "sent_at"
1440
+ ],
1441
+ "isUnique": false,
1442
+ "where": "sent_at IS NOT NULL"
1443
+ }
1444
+ },
1445
+ "foreignKeys": {
1446
+ "lifecycle_messages_tenant_id_tenants_id_fk": {
1447
+ "name": "lifecycle_messages_tenant_id_tenants_id_fk",
1448
+ "tableFrom": "lifecycle_messages",
1449
+ "tableTo": "tenants",
1450
+ "columnsFrom": [
1451
+ "tenant_id"
1452
+ ],
1453
+ "columnsTo": [
1454
+ "id"
1455
+ ],
1456
+ "onDelete": "no action",
1457
+ "onUpdate": "no action"
1458
+ },
1459
+ "lifecycle_messages_contact_id_contacts_id_fk": {
1460
+ "name": "lifecycle_messages_contact_id_contacts_id_fk",
1461
+ "tableFrom": "lifecycle_messages",
1462
+ "tableTo": "contacts",
1463
+ "columnsFrom": [
1464
+ "contact_id"
1465
+ ],
1466
+ "columnsTo": [
1467
+ "id"
1468
+ ],
1469
+ "onDelete": "no action",
1470
+ "onUpdate": "no action"
1471
+ },
1472
+ "lifecycle_messages_flow_id_flows_id_fk": {
1473
+ "name": "lifecycle_messages_flow_id_flows_id_fk",
1474
+ "tableFrom": "lifecycle_messages",
1475
+ "tableTo": "flows",
1476
+ "columnsFrom": [
1477
+ "flow_id"
1478
+ ],
1479
+ "columnsTo": [
1480
+ "id"
1481
+ ],
1482
+ "onDelete": "no action",
1483
+ "onUpdate": "no action"
1484
+ },
1485
+ "lifecycle_messages_membership_id_flow_memberships_id_fk": {
1486
+ "name": "lifecycle_messages_membership_id_flow_memberships_id_fk",
1487
+ "tableFrom": "lifecycle_messages",
1488
+ "tableTo": "flow_memberships",
1489
+ "columnsFrom": [
1490
+ "membership_id"
1491
+ ],
1492
+ "columnsTo": [
1493
+ "id"
1494
+ ],
1495
+ "onDelete": "no action",
1496
+ "onUpdate": "no action"
1497
+ }
1498
+ },
1499
+ "compositePrimaryKeys": {},
1500
+ "uniqueConstraints": {},
1501
+ "checkConstraints": {}
1502
+ },
1503
+ "lifecycle_transitions": {
1504
+ "name": "lifecycle_transitions",
1505
+ "columns": {
1506
+ "id": {
1507
+ "name": "id",
1508
+ "type": "text",
1509
+ "primaryKey": true,
1510
+ "notNull": true,
1511
+ "autoincrement": false
1512
+ },
1513
+ "tenant_id": {
1514
+ "name": "tenant_id",
1515
+ "type": "text",
1516
+ "primaryKey": false,
1517
+ "notNull": true,
1518
+ "autoincrement": false
1519
+ },
1520
+ "contact_id": {
1521
+ "name": "contact_id",
1522
+ "type": "text",
1523
+ "primaryKey": false,
1524
+ "notNull": true,
1525
+ "autoincrement": false
1526
+ },
1527
+ "from_state": {
1528
+ "name": "from_state",
1529
+ "type": "text",
1530
+ "primaryKey": false,
1531
+ "notNull": true,
1532
+ "autoincrement": false
1533
+ },
1534
+ "to_state": {
1535
+ "name": "to_state",
1536
+ "type": "text",
1537
+ "primaryKey": false,
1538
+ "notNull": true,
1539
+ "autoincrement": false
1540
+ },
1541
+ "trigger_event_id": {
1542
+ "name": "trigger_event_id",
1543
+ "type": "text",
1544
+ "primaryKey": false,
1545
+ "notNull": false,
1546
+ "autoincrement": false
1547
+ },
1548
+ "metadata": {
1549
+ "name": "metadata",
1550
+ "type": "text",
1551
+ "primaryKey": false,
1552
+ "notNull": false,
1553
+ "autoincrement": false
1554
+ },
1555
+ "transitioned_at": {
1556
+ "name": "transitioned_at",
1557
+ "type": "integer",
1558
+ "primaryKey": false,
1559
+ "notNull": true,
1560
+ "autoincrement": false
1561
+ }
1562
+ },
1563
+ "indexes": {
1564
+ "idx_transitions_contact": {
1565
+ "name": "idx_transitions_contact",
1566
+ "columns": [
1567
+ "contact_id",
1568
+ "transitioned_at"
1569
+ ],
1570
+ "isUnique": false
1571
+ },
1572
+ "idx_transitions_tenant_time": {
1573
+ "name": "idx_transitions_tenant_time",
1574
+ "columns": [
1575
+ "tenant_id",
1576
+ "transitioned_at"
1577
+ ],
1578
+ "isUnique": false
1579
+ }
1580
+ },
1581
+ "foreignKeys": {
1582
+ "lifecycle_transitions_tenant_id_tenants_id_fk": {
1583
+ "name": "lifecycle_transitions_tenant_id_tenants_id_fk",
1584
+ "tableFrom": "lifecycle_transitions",
1585
+ "tableTo": "tenants",
1586
+ "columnsFrom": [
1587
+ "tenant_id"
1588
+ ],
1589
+ "columnsTo": [
1590
+ "id"
1591
+ ],
1592
+ "onDelete": "no action",
1593
+ "onUpdate": "no action"
1594
+ },
1595
+ "lifecycle_transitions_contact_id_contacts_id_fk": {
1596
+ "name": "lifecycle_transitions_contact_id_contacts_id_fk",
1597
+ "tableFrom": "lifecycle_transitions",
1598
+ "tableTo": "contacts",
1599
+ "columnsFrom": [
1600
+ "contact_id"
1601
+ ],
1602
+ "columnsTo": [
1603
+ "id"
1604
+ ],
1605
+ "onDelete": "no action",
1606
+ "onUpdate": "no action"
1607
+ }
1608
+ },
1609
+ "compositePrimaryKeys": {},
1610
+ "uniqueConstraints": {},
1611
+ "checkConstraints": {}
1612
+ },
1613
+ "llm_configs": {
1614
+ "name": "llm_configs",
1615
+ "columns": {
1616
+ "id": {
1617
+ "name": "id",
1618
+ "type": "text",
1619
+ "primaryKey": true,
1620
+ "notNull": true,
1621
+ "autoincrement": false
1622
+ },
1623
+ "tenant_id": {
1624
+ "name": "tenant_id",
1625
+ "type": "text",
1626
+ "primaryKey": false,
1627
+ "notNull": true,
1628
+ "autoincrement": false
1629
+ },
1630
+ "provider": {
1631
+ "name": "provider",
1632
+ "type": "text",
1633
+ "primaryKey": false,
1634
+ "notNull": true,
1635
+ "autoincrement": false
1636
+ },
1637
+ "config": {
1638
+ "name": "config",
1639
+ "type": "text",
1640
+ "primaryKey": false,
1641
+ "notNull": true,
1642
+ "autoincrement": false
1643
+ },
1644
+ "is_active": {
1645
+ "name": "is_active",
1646
+ "type": "integer",
1647
+ "primaryKey": false,
1648
+ "notNull": false,
1649
+ "autoincrement": false,
1650
+ "default": true
1651
+ },
1652
+ "created_at": {
1653
+ "name": "created_at",
1654
+ "type": "integer",
1655
+ "primaryKey": false,
1656
+ "notNull": false,
1657
+ "autoincrement": false
1658
+ }
1659
+ },
1660
+ "indexes": {},
1661
+ "foreignKeys": {
1662
+ "llm_configs_tenant_id_tenants_id_fk": {
1663
+ "name": "llm_configs_tenant_id_tenants_id_fk",
1664
+ "tableFrom": "llm_configs",
1665
+ "tableTo": "tenants",
1666
+ "columnsFrom": [
1667
+ "tenant_id"
1668
+ ],
1669
+ "columnsTo": [
1670
+ "id"
1671
+ ],
1672
+ "onDelete": "no action",
1673
+ "onUpdate": "no action"
1674
+ }
1675
+ },
1676
+ "compositePrimaryKeys": {},
1677
+ "uniqueConstraints": {},
1678
+ "checkConstraints": {}
1679
+ },
1680
+ "magic_link_tokens": {
1681
+ "name": "magic_link_tokens",
1682
+ "columns": {
1683
+ "id": {
1684
+ "name": "id",
1685
+ "type": "text",
1686
+ "primaryKey": true,
1687
+ "notNull": true,
1688
+ "autoincrement": false
1689
+ },
1690
+ "tenant_id": {
1691
+ "name": "tenant_id",
1692
+ "type": "text",
1693
+ "primaryKey": false,
1694
+ "notNull": true,
1695
+ "autoincrement": false
1696
+ },
1697
+ "user_id": {
1698
+ "name": "user_id",
1699
+ "type": "text",
1700
+ "primaryKey": false,
1701
+ "notNull": true,
1702
+ "autoincrement": false
1703
+ },
1704
+ "token_hash": {
1705
+ "name": "token_hash",
1706
+ "type": "text",
1707
+ "primaryKey": false,
1708
+ "notNull": true,
1709
+ "autoincrement": false
1710
+ },
1711
+ "expires_at": {
1712
+ "name": "expires_at",
1713
+ "type": "integer",
1714
+ "primaryKey": false,
1715
+ "notNull": true,
1716
+ "autoincrement": false
1717
+ },
1718
+ "consumed_at": {
1719
+ "name": "consumed_at",
1720
+ "type": "integer",
1721
+ "primaryKey": false,
1722
+ "notNull": false,
1723
+ "autoincrement": false
1724
+ },
1725
+ "created_at": {
1726
+ "name": "created_at",
1727
+ "type": "integer",
1728
+ "primaryKey": false,
1729
+ "notNull": false,
1730
+ "autoincrement": false
1731
+ }
1732
+ },
1733
+ "indexes": {
1734
+ "idx_magic_link_tokens_hash": {
1735
+ "name": "idx_magic_link_tokens_hash",
1736
+ "columns": [
1737
+ "token_hash"
1738
+ ],
1739
+ "isUnique": false
1740
+ }
1741
+ },
1742
+ "foreignKeys": {
1743
+ "magic_link_tokens_tenant_id_tenants_id_fk": {
1744
+ "name": "magic_link_tokens_tenant_id_tenants_id_fk",
1745
+ "tableFrom": "magic_link_tokens",
1746
+ "tableTo": "tenants",
1747
+ "columnsFrom": [
1748
+ "tenant_id"
1749
+ ],
1750
+ "columnsTo": [
1751
+ "id"
1752
+ ],
1753
+ "onDelete": "no action",
1754
+ "onUpdate": "no action"
1755
+ },
1756
+ "magic_link_tokens_user_id_users_id_fk": {
1757
+ "name": "magic_link_tokens_user_id_users_id_fk",
1758
+ "tableFrom": "magic_link_tokens",
1759
+ "tableTo": "users",
1760
+ "columnsFrom": [
1761
+ "user_id"
1762
+ ],
1763
+ "columnsTo": [
1764
+ "id"
1765
+ ],
1766
+ "onDelete": "cascade",
1767
+ "onUpdate": "no action"
1768
+ }
1769
+ },
1770
+ "compositePrimaryKeys": {},
1771
+ "uniqueConstraints": {},
1772
+ "checkConstraints": {}
1773
+ },
1774
+ "memberships": {
1775
+ "name": "memberships",
1776
+ "columns": {
1777
+ "user_id": {
1778
+ "name": "user_id",
1779
+ "type": "text",
1780
+ "primaryKey": false,
1781
+ "notNull": true,
1782
+ "autoincrement": false
1783
+ },
1784
+ "tenant_id": {
1785
+ "name": "tenant_id",
1786
+ "type": "text",
1787
+ "primaryKey": false,
1788
+ "notNull": true,
1789
+ "autoincrement": false
1790
+ },
1791
+ "role": {
1792
+ "name": "role",
1793
+ "type": "text",
1794
+ "primaryKey": false,
1795
+ "notNull": true,
1796
+ "autoincrement": false
1797
+ },
1798
+ "created_at": {
1799
+ "name": "created_at",
1800
+ "type": "integer",
1801
+ "primaryKey": false,
1802
+ "notNull": false,
1803
+ "autoincrement": false
1804
+ }
1805
+ },
1806
+ "indexes": {
1807
+ "idx_memberships_tenant": {
1808
+ "name": "idx_memberships_tenant",
1809
+ "columns": [
1810
+ "tenant_id"
1811
+ ],
1812
+ "isUnique": false
1813
+ }
1814
+ },
1815
+ "foreignKeys": {
1816
+ "memberships_user_id_users_id_fk": {
1817
+ "name": "memberships_user_id_users_id_fk",
1818
+ "tableFrom": "memberships",
1819
+ "tableTo": "users",
1820
+ "columnsFrom": [
1821
+ "user_id"
1822
+ ],
1823
+ "columnsTo": [
1824
+ "id"
1825
+ ],
1826
+ "onDelete": "cascade",
1827
+ "onUpdate": "no action"
1828
+ },
1829
+ "memberships_tenant_id_tenants_id_fk": {
1830
+ "name": "memberships_tenant_id_tenants_id_fk",
1831
+ "tableFrom": "memberships",
1832
+ "tableTo": "tenants",
1833
+ "columnsFrom": [
1834
+ "tenant_id"
1835
+ ],
1836
+ "columnsTo": [
1837
+ "id"
1838
+ ],
1839
+ "onDelete": "no action",
1840
+ "onUpdate": "no action"
1841
+ }
1842
+ },
1843
+ "compositePrimaryKeys": {
1844
+ "memberships_pkey": {
1845
+ "columns": [
1846
+ "user_id",
1847
+ "tenant_id"
1848
+ ],
1849
+ "name": "memberships_pkey"
1850
+ }
1851
+ },
1852
+ "uniqueConstraints": {},
1853
+ "checkConstraints": {}
1854
+ },
1855
+ "message_events": {
1856
+ "name": "message_events",
1857
+ "columns": {
1858
+ "id": {
1859
+ "name": "id",
1860
+ "type": "text",
1861
+ "primaryKey": true,
1862
+ "notNull": true,
1863
+ "autoincrement": false
1864
+ },
1865
+ "tenant_id": {
1866
+ "name": "tenant_id",
1867
+ "type": "text",
1868
+ "primaryKey": false,
1869
+ "notNull": true,
1870
+ "autoincrement": false
1871
+ },
1872
+ "message_id": {
1873
+ "name": "message_id",
1874
+ "type": "text",
1875
+ "primaryKey": false,
1876
+ "notNull": true,
1877
+ "autoincrement": false
1878
+ },
1879
+ "event_type": {
1880
+ "name": "event_type",
1881
+ "type": "text",
1882
+ "primaryKey": false,
1883
+ "notNull": true,
1884
+ "autoincrement": false
1885
+ },
1886
+ "occurred_at": {
1887
+ "name": "occurred_at",
1888
+ "type": "integer",
1889
+ "primaryKey": false,
1890
+ "notNull": true,
1891
+ "autoincrement": false
1892
+ },
1893
+ "provider_event_id": {
1894
+ "name": "provider_event_id",
1895
+ "type": "text",
1896
+ "primaryKey": false,
1897
+ "notNull": false,
1898
+ "autoincrement": false
1899
+ },
1900
+ "metadata": {
1901
+ "name": "metadata",
1902
+ "type": "text",
1903
+ "primaryKey": false,
1904
+ "notNull": false,
1905
+ "autoincrement": false
1906
+ },
1907
+ "created_at": {
1908
+ "name": "created_at",
1909
+ "type": "integer",
1910
+ "primaryKey": false,
1911
+ "notNull": false,
1912
+ "autoincrement": false
1913
+ }
1914
+ },
1915
+ "indexes": {
1916
+ "idx_message_events_message": {
1917
+ "name": "idx_message_events_message",
1918
+ "columns": [
1919
+ "message_id",
1920
+ "occurred_at"
1921
+ ],
1922
+ "isUnique": false
1923
+ },
1924
+ "idx_message_events_tenant_type_day": {
1925
+ "name": "idx_message_events_tenant_type_day",
1926
+ "columns": [
1927
+ "tenant_id",
1928
+ "event_type",
1929
+ "occurred_at"
1930
+ ],
1931
+ "isUnique": false
1932
+ },
1933
+ "uq_message_events_provider_dedup": {
1934
+ "name": "uq_message_events_provider_dedup",
1935
+ "columns": [
1936
+ "tenant_id",
1937
+ "provider_event_id"
1938
+ ],
1939
+ "isUnique": true,
1940
+ "where": "provider_event_id IS NOT NULL"
1941
+ }
1942
+ },
1943
+ "foreignKeys": {
1944
+ "message_events_tenant_id_tenants_id_fk": {
1945
+ "name": "message_events_tenant_id_tenants_id_fk",
1946
+ "tableFrom": "message_events",
1947
+ "tableTo": "tenants",
1948
+ "columnsFrom": [
1949
+ "tenant_id"
1950
+ ],
1951
+ "columnsTo": [
1952
+ "id"
1953
+ ],
1954
+ "onDelete": "no action",
1955
+ "onUpdate": "no action"
1956
+ },
1957
+ "message_events_message_id_lifecycle_messages_id_fk": {
1958
+ "name": "message_events_message_id_lifecycle_messages_id_fk",
1959
+ "tableFrom": "message_events",
1960
+ "tableTo": "lifecycle_messages",
1961
+ "columnsFrom": [
1962
+ "message_id"
1963
+ ],
1964
+ "columnsTo": [
1965
+ "id"
1966
+ ],
1967
+ "onDelete": "no action",
1968
+ "onUpdate": "no action"
1969
+ }
1970
+ },
1971
+ "compositePrimaryKeys": {},
1972
+ "uniqueConstraints": {},
1973
+ "checkConstraints": {}
1974
+ },
1975
+ "retention_grid_snapshots": {
1976
+ "name": "retention_grid_snapshots",
1977
+ "columns": {
1978
+ "tenant_id": {
1979
+ "name": "tenant_id",
1980
+ "type": "text",
1981
+ "primaryKey": false,
1982
+ "notNull": true,
1983
+ "autoincrement": false
1984
+ },
1985
+ "snapshot_date": {
1986
+ "name": "snapshot_date",
1987
+ "type": "text",
1988
+ "primaryKey": false,
1989
+ "notNull": true,
1990
+ "autoincrement": false
1991
+ },
1992
+ "tenure_bucket": {
1993
+ "name": "tenure_bucket",
1994
+ "type": "text",
1995
+ "primaryKey": false,
1996
+ "notNull": true,
1997
+ "autoincrement": false
1998
+ },
1999
+ "recency_bucket": {
2000
+ "name": "recency_bucket",
2001
+ "type": "text",
2002
+ "primaryKey": false,
2003
+ "notNull": true,
2004
+ "autoincrement": false
2005
+ },
2006
+ "contact_count": {
2007
+ "name": "contact_count",
2008
+ "type": "integer",
2009
+ "primaryKey": false,
2010
+ "notNull": true,
2011
+ "autoincrement": false
2012
+ },
2013
+ "paying_count": {
2014
+ "name": "paying_count",
2015
+ "type": "integer",
2016
+ "primaryKey": false,
2017
+ "notNull": true,
2018
+ "autoincrement": false
2019
+ }
2020
+ },
2021
+ "indexes": {},
2022
+ "foreignKeys": {
2023
+ "retention_grid_snapshots_tenant_id_tenants_id_fk": {
2024
+ "name": "retention_grid_snapshots_tenant_id_tenants_id_fk",
2025
+ "tableFrom": "retention_grid_snapshots",
2026
+ "tableTo": "tenants",
2027
+ "columnsFrom": [
2028
+ "tenant_id"
2029
+ ],
2030
+ "columnsTo": [
2031
+ "id"
2032
+ ],
2033
+ "onDelete": "no action",
2034
+ "onUpdate": "no action"
2035
+ }
2036
+ },
2037
+ "compositePrimaryKeys": {
2038
+ "retention_grid_snapshots_tenant_id_snapshot_date_tenure_bucket_recency_bucket_pk": {
2039
+ "columns": [
2040
+ "tenant_id",
2041
+ "snapshot_date",
2042
+ "tenure_bucket",
2043
+ "recency_bucket"
2044
+ ],
2045
+ "name": "retention_grid_snapshots_tenant_id_snapshot_date_tenure_bucket_recency_bucket_pk"
2046
+ }
2047
+ },
2048
+ "uniqueConstraints": {},
2049
+ "checkConstraints": {}
2050
+ },
2051
+ "scan_checkpoints": {
2052
+ "name": "scan_checkpoints",
2053
+ "columns": {
2054
+ "scan_phase": {
2055
+ "name": "scan_phase",
2056
+ "type": "text",
2057
+ "primaryKey": false,
2058
+ "notNull": true,
2059
+ "autoincrement": false
2060
+ },
2061
+ "tenant_id": {
2062
+ "name": "tenant_id",
2063
+ "type": "text",
2064
+ "primaryKey": false,
2065
+ "notNull": true,
2066
+ "autoincrement": false
2067
+ },
2068
+ "last_id": {
2069
+ "name": "last_id",
2070
+ "type": "text",
2071
+ "primaryKey": false,
2072
+ "notNull": true,
2073
+ "autoincrement": false
2074
+ },
2075
+ "started_at": {
2076
+ "name": "started_at",
2077
+ "type": "integer",
2078
+ "primaryKey": false,
2079
+ "notNull": true,
2080
+ "autoincrement": false
2081
+ },
2082
+ "discard_count": {
2083
+ "name": "discard_count",
2084
+ "type": "integer",
2085
+ "primaryKey": false,
2086
+ "notNull": true,
2087
+ "autoincrement": false,
2088
+ "default": 0
2089
+ }
2090
+ },
2091
+ "indexes": {},
2092
+ "foreignKeys": {
2093
+ "scan_checkpoints_tenant_id_tenants_id_fk": {
2094
+ "name": "scan_checkpoints_tenant_id_tenants_id_fk",
2095
+ "tableFrom": "scan_checkpoints",
2096
+ "tableTo": "tenants",
2097
+ "columnsFrom": [
2098
+ "tenant_id"
2099
+ ],
2100
+ "columnsTo": [
2101
+ "id"
2102
+ ],
2103
+ "onDelete": "no action",
2104
+ "onUpdate": "no action"
2105
+ }
2106
+ },
2107
+ "compositePrimaryKeys": {
2108
+ "scan_checkpoints_scan_phase_tenant_id_pk": {
2109
+ "columns": [
2110
+ "scan_phase",
2111
+ "tenant_id"
2112
+ ],
2113
+ "name": "scan_checkpoints_scan_phase_tenant_id_pk"
2114
+ }
2115
+ },
2116
+ "uniqueConstraints": {},
2117
+ "checkConstraints": {}
2118
+ },
2119
+ "sessions": {
2120
+ "name": "sessions",
2121
+ "columns": {
2122
+ "id": {
2123
+ "name": "id",
2124
+ "type": "text",
2125
+ "primaryKey": true,
2126
+ "notNull": true,
2127
+ "autoincrement": false
2128
+ },
2129
+ "tenant_id": {
2130
+ "name": "tenant_id",
2131
+ "type": "text",
2132
+ "primaryKey": false,
2133
+ "notNull": true,
2134
+ "autoincrement": false
2135
+ },
2136
+ "user_id": {
2137
+ "name": "user_id",
2138
+ "type": "text",
2139
+ "primaryKey": false,
2140
+ "notNull": true,
2141
+ "autoincrement": false
2142
+ },
2143
+ "expires_at": {
2144
+ "name": "expires_at",
2145
+ "type": "integer",
2146
+ "primaryKey": false,
2147
+ "notNull": true,
2148
+ "autoincrement": false
2149
+ },
2150
+ "created_at": {
2151
+ "name": "created_at",
2152
+ "type": "integer",
2153
+ "primaryKey": false,
2154
+ "notNull": false,
2155
+ "autoincrement": false
2156
+ }
2157
+ },
2158
+ "indexes": {},
2159
+ "foreignKeys": {
2160
+ "sessions_tenant_id_tenants_id_fk": {
2161
+ "name": "sessions_tenant_id_tenants_id_fk",
2162
+ "tableFrom": "sessions",
2163
+ "tableTo": "tenants",
2164
+ "columnsFrom": [
2165
+ "tenant_id"
2166
+ ],
2167
+ "columnsTo": [
2168
+ "id"
2169
+ ],
2170
+ "onDelete": "no action",
2171
+ "onUpdate": "no action"
2172
+ },
2173
+ "sessions_user_id_users_id_fk": {
2174
+ "name": "sessions_user_id_users_id_fk",
2175
+ "tableFrom": "sessions",
2176
+ "tableTo": "users",
2177
+ "columnsFrom": [
2178
+ "user_id"
2179
+ ],
2180
+ "columnsTo": [
2181
+ "id"
2182
+ ],
2183
+ "onDelete": "cascade",
2184
+ "onUpdate": "no action"
2185
+ }
2186
+ },
2187
+ "compositePrimaryKeys": {},
2188
+ "uniqueConstraints": {},
2189
+ "checkConstraints": {}
2190
+ },
2191
+ "suppressions": {
2192
+ "name": "suppressions",
2193
+ "columns": {
2194
+ "id": {
2195
+ "name": "id",
2196
+ "type": "text",
2197
+ "primaryKey": true,
2198
+ "notNull": true,
2199
+ "autoincrement": false
2200
+ },
2201
+ "tenant_id": {
2202
+ "name": "tenant_id",
2203
+ "type": "text",
2204
+ "primaryKey": false,
2205
+ "notNull": true,
2206
+ "autoincrement": false
2207
+ },
2208
+ "email": {
2209
+ "name": "email",
2210
+ "type": "text",
2211
+ "primaryKey": false,
2212
+ "notNull": true,
2213
+ "autoincrement": false
2214
+ },
2215
+ "reason": {
2216
+ "name": "reason",
2217
+ "type": "text",
2218
+ "primaryKey": false,
2219
+ "notNull": true,
2220
+ "autoincrement": false
2221
+ },
2222
+ "source": {
2223
+ "name": "source",
2224
+ "type": "text",
2225
+ "primaryKey": false,
2226
+ "notNull": false,
2227
+ "autoincrement": false
2228
+ },
2229
+ "created_at": {
2230
+ "name": "created_at",
2231
+ "type": "integer",
2232
+ "primaryKey": false,
2233
+ "notNull": false,
2234
+ "autoincrement": false
2235
+ }
2236
+ },
2237
+ "indexes": {},
2238
+ "foreignKeys": {
2239
+ "suppressions_tenant_id_tenants_id_fk": {
2240
+ "name": "suppressions_tenant_id_tenants_id_fk",
2241
+ "tableFrom": "suppressions",
2242
+ "tableTo": "tenants",
2243
+ "columnsFrom": [
2244
+ "tenant_id"
2245
+ ],
2246
+ "columnsTo": [
2247
+ "id"
2248
+ ],
2249
+ "onDelete": "no action",
2250
+ "onUpdate": "no action"
2251
+ }
2252
+ },
2253
+ "compositePrimaryKeys": {},
2254
+ "uniqueConstraints": {},
2255
+ "checkConstraints": {}
2256
+ },
2257
+ "templates": {
2258
+ "name": "templates",
2259
+ "columns": {
2260
+ "id": {
2261
+ "name": "id",
2262
+ "type": "text",
2263
+ "primaryKey": true,
2264
+ "notNull": true,
2265
+ "autoincrement": false
2266
+ },
2267
+ "tenant_id": {
2268
+ "name": "tenant_id",
2269
+ "type": "text",
2270
+ "primaryKey": false,
2271
+ "notNull": true,
2272
+ "autoincrement": false
2273
+ },
2274
+ "name": {
2275
+ "name": "name",
2276
+ "type": "text",
2277
+ "primaryKey": false,
2278
+ "notNull": true,
2279
+ "autoincrement": false
2280
+ },
2281
+ "slug": {
2282
+ "name": "slug",
2283
+ "type": "text",
2284
+ "primaryKey": false,
2285
+ "notNull": true,
2286
+ "autoincrement": false
2287
+ },
2288
+ "subject": {
2289
+ "name": "subject",
2290
+ "type": "text",
2291
+ "primaryKey": false,
2292
+ "notNull": true,
2293
+ "autoincrement": false
2294
+ },
2295
+ "body_html": {
2296
+ "name": "body_html",
2297
+ "type": "text",
2298
+ "primaryKey": false,
2299
+ "notNull": true,
2300
+ "autoincrement": false
2301
+ },
2302
+ "body_text": {
2303
+ "name": "body_text",
2304
+ "type": "text",
2305
+ "primaryKey": false,
2306
+ "notNull": false,
2307
+ "autoincrement": false
2308
+ },
2309
+ "variables": {
2310
+ "name": "variables",
2311
+ "type": "text",
2312
+ "primaryKey": false,
2313
+ "notNull": false,
2314
+ "autoincrement": false
2315
+ },
2316
+ "category": {
2317
+ "name": "category",
2318
+ "type": "text",
2319
+ "primaryKey": false,
2320
+ "notNull": false,
2321
+ "autoincrement": false
2322
+ },
2323
+ "is_active": {
2324
+ "name": "is_active",
2325
+ "type": "integer",
2326
+ "primaryKey": false,
2327
+ "notNull": false,
2328
+ "autoincrement": false,
2329
+ "default": true
2330
+ },
2331
+ "created_at": {
2332
+ "name": "created_at",
2333
+ "type": "integer",
2334
+ "primaryKey": false,
2335
+ "notNull": false,
2336
+ "autoincrement": false
2337
+ }
2338
+ },
2339
+ "indexes": {
2340
+ "uq_templates_tenant_slug": {
2341
+ "name": "uq_templates_tenant_slug",
2342
+ "columns": [
2343
+ "tenant_id",
2344
+ "slug"
2345
+ ],
2346
+ "isUnique": true
2347
+ }
2348
+ },
2349
+ "foreignKeys": {
2350
+ "templates_tenant_id_tenants_id_fk": {
2351
+ "name": "templates_tenant_id_tenants_id_fk",
2352
+ "tableFrom": "templates",
2353
+ "tableTo": "tenants",
2354
+ "columnsFrom": [
2355
+ "tenant_id"
2356
+ ],
2357
+ "columnsTo": [
2358
+ "id"
2359
+ ],
2360
+ "onDelete": "no action",
2361
+ "onUpdate": "no action"
2362
+ }
2363
+ },
2364
+ "compositePrimaryKeys": {},
2365
+ "uniqueConstraints": {},
2366
+ "checkConstraints": {}
2367
+ },
2368
+ "tenants": {
2369
+ "name": "tenants",
2370
+ "columns": {
2371
+ "id": {
2372
+ "name": "id",
2373
+ "type": "text",
2374
+ "primaryKey": true,
2375
+ "notNull": true,
2376
+ "autoincrement": false
2377
+ },
2378
+ "name": {
2379
+ "name": "name",
2380
+ "type": "text",
2381
+ "primaryKey": false,
2382
+ "notNull": true,
2383
+ "autoincrement": false
2384
+ },
2385
+ "slug": {
2386
+ "name": "slug",
2387
+ "type": "text",
2388
+ "primaryKey": false,
2389
+ "notNull": true,
2390
+ "autoincrement": false
2391
+ },
2392
+ "plan": {
2393
+ "name": "plan",
2394
+ "type": "text",
2395
+ "primaryKey": false,
2396
+ "notNull": false,
2397
+ "autoincrement": false,
2398
+ "default": "'free'"
2399
+ },
2400
+ "settings": {
2401
+ "name": "settings",
2402
+ "type": "text",
2403
+ "primaryKey": false,
2404
+ "notNull": false,
2405
+ "autoincrement": false
2406
+ },
2407
+ "business_model": {
2408
+ "name": "business_model",
2409
+ "type": "text",
2410
+ "primaryKey": false,
2411
+ "notNull": false,
2412
+ "autoincrement": false
2413
+ },
2414
+ "created_at": {
2415
+ "name": "created_at",
2416
+ "type": "integer",
2417
+ "primaryKey": false,
2418
+ "notNull": false,
2419
+ "autoincrement": false
2420
+ },
2421
+ "archived_at": {
2422
+ "name": "archived_at",
2423
+ "type": "integer",
2424
+ "primaryKey": false,
2425
+ "notNull": false,
2426
+ "autoincrement": false
2427
+ },
2428
+ "public_host": {
2429
+ "name": "public_host",
2430
+ "type": "text",
2431
+ "primaryKey": false,
2432
+ "notNull": false,
2433
+ "autoincrement": false
2434
+ },
2435
+ "locale": {
2436
+ "name": "locale",
2437
+ "type": "text",
2438
+ "primaryKey": false,
2439
+ "notNull": false,
2440
+ "autoincrement": false
2441
+ },
2442
+ "config_version": {
2443
+ "name": "config_version",
2444
+ "type": "integer",
2445
+ "primaryKey": false,
2446
+ "notNull": true,
2447
+ "autoincrement": false,
2448
+ "default": 0
2449
+ }
2450
+ },
2451
+ "indexes": {
2452
+ "tenants_slug_unique": {
2453
+ "name": "tenants_slug_unique",
2454
+ "columns": [
2455
+ "slug"
2456
+ ],
2457
+ "isUnique": true
2458
+ },
2459
+ "uq_tenants_public_host": {
2460
+ "name": "uq_tenants_public_host",
2461
+ "columns": [
2462
+ "public_host"
2463
+ ],
2464
+ "isUnique": true,
2465
+ "where": "public_host IS NOT NULL"
2466
+ }
2467
+ },
2468
+ "foreignKeys": {},
2469
+ "compositePrimaryKeys": {},
2470
+ "uniqueConstraints": {},
2471
+ "checkConstraints": {}
2472
+ },
2473
+ "transport_configs": {
2474
+ "name": "transport_configs",
2475
+ "columns": {
2476
+ "id": {
2477
+ "name": "id",
2478
+ "type": "text",
2479
+ "primaryKey": true,
2480
+ "notNull": true,
2481
+ "autoincrement": false
2482
+ },
2483
+ "tenant_id": {
2484
+ "name": "tenant_id",
2485
+ "type": "text",
2486
+ "primaryKey": false,
2487
+ "notNull": true,
2488
+ "autoincrement": false
2489
+ },
2490
+ "provider": {
2491
+ "name": "provider",
2492
+ "type": "text",
2493
+ "primaryKey": false,
2494
+ "notNull": true,
2495
+ "autoincrement": false
2496
+ },
2497
+ "config": {
2498
+ "name": "config",
2499
+ "type": "text",
2500
+ "primaryKey": false,
2501
+ "notNull": true,
2502
+ "autoincrement": false
2503
+ },
2504
+ "is_active": {
2505
+ "name": "is_active",
2506
+ "type": "integer",
2507
+ "primaryKey": false,
2508
+ "notNull": false,
2509
+ "autoincrement": false,
2510
+ "default": true
2511
+ },
2512
+ "dkim_verified": {
2513
+ "name": "dkim_verified",
2514
+ "type": "integer",
2515
+ "primaryKey": false,
2516
+ "notNull": false,
2517
+ "autoincrement": false,
2518
+ "default": false
2519
+ },
2520
+ "from_email": {
2521
+ "name": "from_email",
2522
+ "type": "text",
2523
+ "primaryKey": false,
2524
+ "notNull": true,
2525
+ "autoincrement": false
2526
+ },
2527
+ "from_name": {
2528
+ "name": "from_name",
2529
+ "type": "text",
2530
+ "primaryKey": false,
2531
+ "notNull": false,
2532
+ "autoincrement": false
2533
+ },
2534
+ "daily_limit": {
2535
+ "name": "daily_limit",
2536
+ "type": "integer",
2537
+ "primaryKey": false,
2538
+ "notNull": false,
2539
+ "autoincrement": false
2540
+ },
2541
+ "created_at": {
2542
+ "name": "created_at",
2543
+ "type": "integer",
2544
+ "primaryKey": false,
2545
+ "notNull": false,
2546
+ "autoincrement": false
2547
+ }
2548
+ },
2549
+ "indexes": {},
2550
+ "foreignKeys": {
2551
+ "transport_configs_tenant_id_tenants_id_fk": {
2552
+ "name": "transport_configs_tenant_id_tenants_id_fk",
2553
+ "tableFrom": "transport_configs",
2554
+ "tableTo": "tenants",
2555
+ "columnsFrom": [
2556
+ "tenant_id"
2557
+ ],
2558
+ "columnsTo": [
2559
+ "id"
2560
+ ],
2561
+ "onDelete": "no action",
2562
+ "onUpdate": "no action"
2563
+ }
2564
+ },
2565
+ "compositePrimaryKeys": {},
2566
+ "uniqueConstraints": {},
2567
+ "checkConstraints": {}
2568
+ },
2569
+ "users": {
2570
+ "name": "users",
2571
+ "columns": {
2572
+ "id": {
2573
+ "name": "id",
2574
+ "type": "text",
2575
+ "primaryKey": true,
2576
+ "notNull": true,
2577
+ "autoincrement": false
2578
+ },
2579
+ "tenant_id": {
2580
+ "name": "tenant_id",
2581
+ "type": "text",
2582
+ "primaryKey": false,
2583
+ "notNull": true,
2584
+ "autoincrement": false
2585
+ },
2586
+ "email": {
2587
+ "name": "email",
2588
+ "type": "text",
2589
+ "primaryKey": false,
2590
+ "notNull": true,
2591
+ "autoincrement": false
2592
+ },
2593
+ "name": {
2594
+ "name": "name",
2595
+ "type": "text",
2596
+ "primaryKey": false,
2597
+ "notNull": false,
2598
+ "autoincrement": false
2599
+ },
2600
+ "role": {
2601
+ "name": "role",
2602
+ "type": "text",
2603
+ "primaryKey": false,
2604
+ "notNull": true,
2605
+ "autoincrement": false,
2606
+ "default": "'member'"
2607
+ },
2608
+ "instance_role": {
2609
+ "name": "instance_role",
2610
+ "type": "text",
2611
+ "primaryKey": false,
2612
+ "notNull": false,
2613
+ "autoincrement": false
2614
+ },
2615
+ "last_login_at": {
2616
+ "name": "last_login_at",
2617
+ "type": "integer",
2618
+ "primaryKey": false,
2619
+ "notNull": false,
2620
+ "autoincrement": false
2621
+ },
2622
+ "deactivated_at": {
2623
+ "name": "deactivated_at",
2624
+ "type": "integer",
2625
+ "primaryKey": false,
2626
+ "notNull": false,
2627
+ "autoincrement": false
2628
+ },
2629
+ "pending_email": {
2630
+ "name": "pending_email",
2631
+ "type": "text",
2632
+ "primaryKey": false,
2633
+ "notNull": false,
2634
+ "autoincrement": false
2635
+ },
2636
+ "pending_email_token_hash": {
2637
+ "name": "pending_email_token_hash",
2638
+ "type": "text",
2639
+ "primaryKey": false,
2640
+ "notNull": false,
2641
+ "autoincrement": false
2642
+ },
2643
+ "pending_email_expires_at": {
2644
+ "name": "pending_email_expires_at",
2645
+ "type": "integer",
2646
+ "primaryKey": false,
2647
+ "notNull": false,
2648
+ "autoincrement": false
2649
+ },
2650
+ "created_at": {
2651
+ "name": "created_at",
2652
+ "type": "integer",
2653
+ "primaryKey": false,
2654
+ "notNull": false,
2655
+ "autoincrement": false
2656
+ }
2657
+ },
2658
+ "indexes": {
2659
+ "uq_users_tenant_email": {
2660
+ "name": "uq_users_tenant_email",
2661
+ "columns": [
2662
+ "tenant_id",
2663
+ "email"
2664
+ ],
2665
+ "isUnique": true
2666
+ }
2667
+ },
2668
+ "foreignKeys": {
2669
+ "users_tenant_id_tenants_id_fk": {
2670
+ "name": "users_tenant_id_tenants_id_fk",
2671
+ "tableFrom": "users",
2672
+ "tableTo": "tenants",
2673
+ "columnsFrom": [
2674
+ "tenant_id"
2675
+ ],
2676
+ "columnsTo": [
2677
+ "id"
2678
+ ],
2679
+ "onDelete": "no action",
2680
+ "onUpdate": "no action"
2681
+ }
2682
+ },
2683
+ "compositePrimaryKeys": {},
2684
+ "uniqueConstraints": {},
2685
+ "checkConstraints": {}
2686
+ }
2687
+ },
2688
+ "views": {},
2689
+ "enums": {},
2690
+ "_meta": {
2691
+ "schemas": {},
2692
+ "tables": {},
2693
+ "columns": {}
2694
+ },
2695
+ "internal": {
2696
+ "indexes": {}
2697
+ }
2698
+ }