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