@claroshq/claros 0.0.0-stage → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -2
  3. package/assets/dashboard/apple-touch-icon.png +0 -0
  4. package/assets/dashboard/assets/bricolage-grotesque-latin-ext-wght-normal-CcLUaPy7.woff2 +0 -0
  5. package/assets/dashboard/assets/bricolage-grotesque-latin-wght-normal-DLoelf7F.woff2 +0 -0
  6. package/assets/dashboard/assets/bricolage-grotesque-vietnamese-wght-normal-BUzh504Q.woff2 +0 -0
  7. package/assets/dashboard/assets/index-Dvs1k10B.js +23 -0
  8. package/assets/dashboard/assets/index-gR64IOwq.css +1 -0
  9. package/assets/dashboard/assets/instrument-sans-latin-ext-wght-normal-B5bTHO_g.woff2 +0 -0
  10. package/assets/dashboard/assets/instrument-sans-latin-wght-normal-BbzFLZTg.woff2 +0 -0
  11. package/assets/dashboard/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
  12. package/assets/dashboard/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  13. package/assets/dashboard/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  14. package/assets/dashboard/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  15. package/assets/dashboard/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  16. package/assets/dashboard/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  17. package/assets/dashboard/assets/quicksand-latin-ext-wght-normal-CrJ75Ewg.woff2 +0 -0
  18. package/assets/dashboard/assets/quicksand-latin-wght-normal-Buj9m_3d.woff2 +0 -0
  19. package/assets/dashboard/assets/quicksand-vietnamese-wght-normal-ei70gACF.woff2 +0 -0
  20. package/assets/dashboard/claros.js +122 -0
  21. package/assets/dashboard/favicon-16.png +0 -0
  22. package/assets/dashboard/favicon-32.png +0 -0
  23. package/assets/dashboard/favicon.ico +0 -0
  24. package/assets/dashboard/favicon.svg +17 -0
  25. package/assets/dashboard/fonts-license.txt +119 -0
  26. package/assets/dashboard/index.html +34 -0
  27. package/assets/migrations/0000_baseline.sql +343 -0
  28. package/assets/migrations/0001_kb_fts.sql +22 -0
  29. package/assets/migrations/0002_instance_layer.sql +51 -0
  30. package/assets/migrations/0003_suppressions_lower_email.sql +22 -0
  31. package/assets/migrations/0004_claim_tokens.sql +9 -0
  32. package/assets/migrations/0005_topics_transports.sql +36 -0
  33. package/assets/migrations/0006_ops_alerts.sql +28 -0
  34. package/assets/migrations/0007_integration_surface.sql +46 -0
  35. package/assets/migrations/0008_p5_engine.sql +31 -0
  36. package/assets/migrations/0009_p5b_readiness.sql +11 -0
  37. package/assets/migrations/meta/0000_snapshot.json +2489 -0
  38. package/assets/migrations/meta/0002_snapshot.json +2645 -0
  39. package/assets/migrations/meta/0004_snapshot.json +2698 -0
  40. package/assets/migrations/meta/0005_snapshot.json +2959 -0
  41. package/assets/migrations/meta/0006_snapshot.json +3138 -0
  42. package/assets/migrations/meta/0007_snapshot.json +3469 -0
  43. package/assets/migrations/meta/0008_snapshot.json +3709 -0
  44. package/assets/migrations/meta/0009_snapshot.json +3785 -0
  45. package/assets/migrations/meta/_journal.json +76 -0
  46. package/assets/worker/index.js +57863 -0
  47. package/bin/claros.mjs +13 -0
  48. package/dist/apply.d.ts +10 -0
  49. package/dist/apply.d.ts.map +1 -0
  50. package/dist/apply.js +72 -0
  51. package/dist/apply.js.map +1 -0
  52. package/dist/assets.d.ts +15 -0
  53. package/dist/assets.d.ts.map +1 -0
  54. package/dist/assets.js +48 -0
  55. package/dist/assets.js.map +1 -0
  56. package/dist/claim.d.ts +12 -0
  57. package/dist/claim.d.ts.map +1 -0
  58. package/dist/claim.js +26 -0
  59. package/dist/claim.js.map +1 -0
  60. package/dist/cli.d.ts +13 -0
  61. package/dist/cli.d.ts.map +1 -0
  62. package/dist/cli.js +158 -0
  63. package/dist/cli.js.map +1 -0
  64. package/dist/cloudflare-api.d.ts +48 -0
  65. package/dist/cloudflare-api.d.ts.map +1 -0
  66. package/dist/cloudflare-api.js +94 -0
  67. package/dist/cloudflare-api.js.map +1 -0
  68. package/dist/import.d.ts +16 -0
  69. package/dist/import.d.ts.map +1 -0
  70. package/dist/import.js +97 -0
  71. package/dist/import.js.map +1 -0
  72. package/dist/ops.d.ts +84 -0
  73. package/dist/ops.d.ts.map +1 -0
  74. package/dist/ops.js +552 -0
  75. package/dist/ops.js.map +1 -0
  76. package/dist/state.d.ts +53 -0
  77. package/dist/state.d.ts.map +1 -0
  78. package/dist/state.js +87 -0
  79. package/dist/state.js.map +1 -0
  80. package/dist/template.d.ts +77 -0
  81. package/dist/template.d.ts.map +1 -0
  82. package/dist/template.js +127 -0
  83. package/dist/template.js.map +1 -0
  84. package/dist/version.d.ts +3 -0
  85. package/dist/version.d.ts.map +1 -0
  86. package/dist/version.js +36 -0
  87. package/dist/version.js.map +1 -0
  88. package/dist/wrangler.d.ts +116 -0
  89. package/dist/wrangler.d.ts.map +1 -0
  90. package/dist/wrangler.js +210 -0
  91. package/dist/wrangler.js.map +1 -0
  92. package/package.json +53 -4
@@ -0,0 +1,2489 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "cca91dc2-0ff7-47ad-afcb-77382cb048fd",
5
+ "prevId": "00000000-0000-0000-0000-000000000000",
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": true,
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
+ "invites": {
894
+ "name": "invites",
895
+ "columns": {
896
+ "id": {
897
+ "name": "id",
898
+ "type": "text",
899
+ "primaryKey": true,
900
+ "notNull": true,
901
+ "autoincrement": false
902
+ },
903
+ "tenant_id": {
904
+ "name": "tenant_id",
905
+ "type": "text",
906
+ "primaryKey": false,
907
+ "notNull": true,
908
+ "autoincrement": false
909
+ },
910
+ "email": {
911
+ "name": "email",
912
+ "type": "text",
913
+ "primaryKey": false,
914
+ "notNull": true,
915
+ "autoincrement": false
916
+ },
917
+ "role": {
918
+ "name": "role",
919
+ "type": "text",
920
+ "primaryKey": false,
921
+ "notNull": true,
922
+ "autoincrement": false,
923
+ "default": "'member'"
924
+ },
925
+ "token_hash": {
926
+ "name": "token_hash",
927
+ "type": "text",
928
+ "primaryKey": false,
929
+ "notNull": true,
930
+ "autoincrement": false
931
+ },
932
+ "invited_by": {
933
+ "name": "invited_by",
934
+ "type": "text",
935
+ "primaryKey": false,
936
+ "notNull": true,
937
+ "autoincrement": false
938
+ },
939
+ "expires_at": {
940
+ "name": "expires_at",
941
+ "type": "integer",
942
+ "primaryKey": false,
943
+ "notNull": true,
944
+ "autoincrement": false
945
+ },
946
+ "accepted_at": {
947
+ "name": "accepted_at",
948
+ "type": "integer",
949
+ "primaryKey": false,
950
+ "notNull": false,
951
+ "autoincrement": false
952
+ },
953
+ "created_at": {
954
+ "name": "created_at",
955
+ "type": "integer",
956
+ "primaryKey": false,
957
+ "notNull": false,
958
+ "autoincrement": false
959
+ }
960
+ },
961
+ "indexes": {
962
+ "idx_invites_token_hash": {
963
+ "name": "idx_invites_token_hash",
964
+ "columns": [
965
+ "token_hash"
966
+ ],
967
+ "isUnique": false
968
+ },
969
+ "idx_invites_tenant": {
970
+ "name": "idx_invites_tenant",
971
+ "columns": [
972
+ "tenant_id"
973
+ ],
974
+ "isUnique": false
975
+ }
976
+ },
977
+ "foreignKeys": {
978
+ "invites_tenant_id_tenants_id_fk": {
979
+ "name": "invites_tenant_id_tenants_id_fk",
980
+ "tableFrom": "invites",
981
+ "tableTo": "tenants",
982
+ "columnsFrom": [
983
+ "tenant_id"
984
+ ],
985
+ "columnsTo": [
986
+ "id"
987
+ ],
988
+ "onDelete": "no action",
989
+ "onUpdate": "no action"
990
+ },
991
+ "invites_invited_by_users_id_fk": {
992
+ "name": "invites_invited_by_users_id_fk",
993
+ "tableFrom": "invites",
994
+ "tableTo": "users",
995
+ "columnsFrom": [
996
+ "invited_by"
997
+ ],
998
+ "columnsTo": [
999
+ "id"
1000
+ ],
1001
+ "onDelete": "no action",
1002
+ "onUpdate": "no action"
1003
+ }
1004
+ },
1005
+ "compositePrimaryKeys": {},
1006
+ "uniqueConstraints": {},
1007
+ "checkConstraints": {}
1008
+ },
1009
+ "kb_entries": {
1010
+ "name": "kb_entries",
1011
+ "columns": {
1012
+ "id": {
1013
+ "name": "id",
1014
+ "type": "text",
1015
+ "primaryKey": true,
1016
+ "notNull": true,
1017
+ "autoincrement": false
1018
+ },
1019
+ "tenant_id": {
1020
+ "name": "tenant_id",
1021
+ "type": "text",
1022
+ "primaryKey": false,
1023
+ "notNull": true,
1024
+ "autoincrement": false
1025
+ },
1026
+ "title": {
1027
+ "name": "title",
1028
+ "type": "text",
1029
+ "primaryKey": false,
1030
+ "notNull": true,
1031
+ "autoincrement": false
1032
+ },
1033
+ "content": {
1034
+ "name": "content",
1035
+ "type": "text",
1036
+ "primaryKey": false,
1037
+ "notNull": true,
1038
+ "autoincrement": false
1039
+ },
1040
+ "content_type": {
1041
+ "name": "content_type",
1042
+ "type": "text",
1043
+ "primaryKey": false,
1044
+ "notNull": false,
1045
+ "autoincrement": false,
1046
+ "default": "'markdown'"
1047
+ },
1048
+ "source": {
1049
+ "name": "source",
1050
+ "type": "text",
1051
+ "primaryKey": false,
1052
+ "notNull": false,
1053
+ "autoincrement": false,
1054
+ "default": "'manual'"
1055
+ },
1056
+ "source_url": {
1057
+ "name": "source_url",
1058
+ "type": "text",
1059
+ "primaryKey": false,
1060
+ "notNull": false,
1061
+ "autoincrement": false
1062
+ },
1063
+ "tags": {
1064
+ "name": "tags",
1065
+ "type": "text",
1066
+ "primaryKey": false,
1067
+ "notNull": false,
1068
+ "autoincrement": false
1069
+ },
1070
+ "embedding": {
1071
+ "name": "embedding",
1072
+ "type": "text",
1073
+ "primaryKey": false,
1074
+ "notNull": false,
1075
+ "autoincrement": false
1076
+ },
1077
+ "embedding_status": {
1078
+ "name": "embedding_status",
1079
+ "type": "text",
1080
+ "primaryKey": false,
1081
+ "notNull": false,
1082
+ "autoincrement": false
1083
+ },
1084
+ "embedding_error": {
1085
+ "name": "embedding_error",
1086
+ "type": "text",
1087
+ "primaryKey": false,
1088
+ "notNull": false,
1089
+ "autoincrement": false
1090
+ },
1091
+ "is_active": {
1092
+ "name": "is_active",
1093
+ "type": "integer",
1094
+ "primaryKey": false,
1095
+ "notNull": false,
1096
+ "autoincrement": false,
1097
+ "default": true
1098
+ },
1099
+ "created_at": {
1100
+ "name": "created_at",
1101
+ "type": "integer",
1102
+ "primaryKey": false,
1103
+ "notNull": false,
1104
+ "autoincrement": false
1105
+ },
1106
+ "updated_at": {
1107
+ "name": "updated_at",
1108
+ "type": "integer",
1109
+ "primaryKey": false,
1110
+ "notNull": false,
1111
+ "autoincrement": false
1112
+ }
1113
+ },
1114
+ "indexes": {
1115
+ "idx_kb_entries_tenant_created": {
1116
+ "name": "idx_kb_entries_tenant_created",
1117
+ "columns": [
1118
+ "tenant_id",
1119
+ "created_at",
1120
+ "id"
1121
+ ],
1122
+ "isUnique": false
1123
+ }
1124
+ },
1125
+ "foreignKeys": {
1126
+ "kb_entries_tenant_id_tenants_id_fk": {
1127
+ "name": "kb_entries_tenant_id_tenants_id_fk",
1128
+ "tableFrom": "kb_entries",
1129
+ "tableTo": "tenants",
1130
+ "columnsFrom": [
1131
+ "tenant_id"
1132
+ ],
1133
+ "columnsTo": [
1134
+ "id"
1135
+ ],
1136
+ "onDelete": "no action",
1137
+ "onUpdate": "no action"
1138
+ }
1139
+ },
1140
+ "compositePrimaryKeys": {},
1141
+ "uniqueConstraints": {},
1142
+ "checkConstraints": {}
1143
+ },
1144
+ "lifecycle_messages": {
1145
+ "name": "lifecycle_messages",
1146
+ "columns": {
1147
+ "id": {
1148
+ "name": "id",
1149
+ "type": "text",
1150
+ "primaryKey": true,
1151
+ "notNull": true,
1152
+ "autoincrement": false
1153
+ },
1154
+ "tenant_id": {
1155
+ "name": "tenant_id",
1156
+ "type": "text",
1157
+ "primaryKey": false,
1158
+ "notNull": true,
1159
+ "autoincrement": false
1160
+ },
1161
+ "contact_id": {
1162
+ "name": "contact_id",
1163
+ "type": "text",
1164
+ "primaryKey": false,
1165
+ "notNull": true,
1166
+ "autoincrement": false
1167
+ },
1168
+ "flow_id": {
1169
+ "name": "flow_id",
1170
+ "type": "text",
1171
+ "primaryKey": false,
1172
+ "notNull": true,
1173
+ "autoincrement": false
1174
+ },
1175
+ "membership_id": {
1176
+ "name": "membership_id",
1177
+ "type": "text",
1178
+ "primaryKey": false,
1179
+ "notNull": true,
1180
+ "autoincrement": false
1181
+ },
1182
+ "flow_step_order": {
1183
+ "name": "flow_step_order",
1184
+ "type": "integer",
1185
+ "primaryKey": false,
1186
+ "notNull": false,
1187
+ "autoincrement": false
1188
+ },
1189
+ "status": {
1190
+ "name": "status",
1191
+ "type": "text",
1192
+ "primaryKey": false,
1193
+ "notNull": true,
1194
+ "autoincrement": false
1195
+ },
1196
+ "feedback": {
1197
+ "name": "feedback",
1198
+ "type": "text",
1199
+ "primaryKey": false,
1200
+ "notNull": false,
1201
+ "autoincrement": false
1202
+ },
1203
+ "subject": {
1204
+ "name": "subject",
1205
+ "type": "text",
1206
+ "primaryKey": false,
1207
+ "notNull": false,
1208
+ "autoincrement": false
1209
+ },
1210
+ "body_html": {
1211
+ "name": "body_html",
1212
+ "type": "text",
1213
+ "primaryKey": false,
1214
+ "notNull": false,
1215
+ "autoincrement": false
1216
+ },
1217
+ "body_text": {
1218
+ "name": "body_text",
1219
+ "type": "text",
1220
+ "primaryKey": false,
1221
+ "notNull": false,
1222
+ "autoincrement": false
1223
+ },
1224
+ "brain_reasoning": {
1225
+ "name": "brain_reasoning",
1226
+ "type": "text",
1227
+ "primaryKey": false,
1228
+ "notNull": false,
1229
+ "autoincrement": false
1230
+ },
1231
+ "brain_action_type": {
1232
+ "name": "brain_action_type",
1233
+ "type": "text",
1234
+ "primaryKey": false,
1235
+ "notNull": false,
1236
+ "autoincrement": false
1237
+ },
1238
+ "scheduled_send_at": {
1239
+ "name": "scheduled_send_at",
1240
+ "type": "integer",
1241
+ "primaryKey": false,
1242
+ "notNull": false,
1243
+ "autoincrement": false
1244
+ },
1245
+ "approved_at": {
1246
+ "name": "approved_at",
1247
+ "type": "integer",
1248
+ "primaryKey": false,
1249
+ "notNull": false,
1250
+ "autoincrement": false
1251
+ },
1252
+ "sent_at": {
1253
+ "name": "sent_at",
1254
+ "type": "integer",
1255
+ "primaryKey": false,
1256
+ "notNull": false,
1257
+ "autoincrement": false
1258
+ },
1259
+ "retry_count": {
1260
+ "name": "retry_count",
1261
+ "type": "integer",
1262
+ "primaryKey": false,
1263
+ "notNull": false,
1264
+ "autoincrement": false,
1265
+ "default": 0
1266
+ },
1267
+ "provider_message_id": {
1268
+ "name": "provider_message_id",
1269
+ "type": "text",
1270
+ "primaryKey": false,
1271
+ "notNull": false,
1272
+ "autoincrement": false
1273
+ },
1274
+ "recipient_address": {
1275
+ "name": "recipient_address",
1276
+ "type": "text",
1277
+ "primaryKey": false,
1278
+ "notNull": false,
1279
+ "autoincrement": false
1280
+ },
1281
+ "created_at": {
1282
+ "name": "created_at",
1283
+ "type": "integer",
1284
+ "primaryKey": false,
1285
+ "notNull": false,
1286
+ "autoincrement": false
1287
+ },
1288
+ "updated_at": {
1289
+ "name": "updated_at",
1290
+ "type": "integer",
1291
+ "primaryKey": false,
1292
+ "notNull": false,
1293
+ "autoincrement": false
1294
+ }
1295
+ },
1296
+ "indexes": {
1297
+ "idx_messages_drain": {
1298
+ "name": "idx_messages_drain",
1299
+ "columns": [
1300
+ "tenant_id",
1301
+ "status",
1302
+ "scheduled_send_at"
1303
+ ],
1304
+ "isUnique": false,
1305
+ "where": "status IN ('approved', 'sending')"
1306
+ },
1307
+ "idx_messages_contact": {
1308
+ "name": "idx_messages_contact",
1309
+ "columns": [
1310
+ "contact_id",
1311
+ "status",
1312
+ "created_at"
1313
+ ],
1314
+ "isUnique": false
1315
+ },
1316
+ "idx_messages_contact_sent": {
1317
+ "name": "idx_messages_contact_sent",
1318
+ "columns": [
1319
+ "contact_id",
1320
+ "sent_at"
1321
+ ],
1322
+ "isUnique": false,
1323
+ "where": "status IN ('sending', 'sent')"
1324
+ },
1325
+ "uq_messages_membership_step": {
1326
+ "name": "uq_messages_membership_step",
1327
+ "columns": [
1328
+ "membership_id",
1329
+ "flow_step_order"
1330
+ ],
1331
+ "isUnique": true
1332
+ },
1333
+ "idx_messages_generation": {
1334
+ "name": "idx_messages_generation",
1335
+ "columns": [
1336
+ "tenant_id",
1337
+ "status",
1338
+ "created_at"
1339
+ ],
1340
+ "isUnique": false,
1341
+ "where": "status IN ('pending_generation', 'generating')"
1342
+ },
1343
+ "idx_messages_provider_id": {
1344
+ "name": "idx_messages_provider_id",
1345
+ "columns": [
1346
+ "provider_message_id"
1347
+ ],
1348
+ "isUnique": false,
1349
+ "where": "provider_message_id IS NOT NULL"
1350
+ },
1351
+ "idx_messages_tenant_sent": {
1352
+ "name": "idx_messages_tenant_sent",
1353
+ "columns": [
1354
+ "tenant_id",
1355
+ "sent_at"
1356
+ ],
1357
+ "isUnique": false,
1358
+ "where": "sent_at IS NOT NULL"
1359
+ }
1360
+ },
1361
+ "foreignKeys": {
1362
+ "lifecycle_messages_tenant_id_tenants_id_fk": {
1363
+ "name": "lifecycle_messages_tenant_id_tenants_id_fk",
1364
+ "tableFrom": "lifecycle_messages",
1365
+ "tableTo": "tenants",
1366
+ "columnsFrom": [
1367
+ "tenant_id"
1368
+ ],
1369
+ "columnsTo": [
1370
+ "id"
1371
+ ],
1372
+ "onDelete": "no action",
1373
+ "onUpdate": "no action"
1374
+ },
1375
+ "lifecycle_messages_contact_id_contacts_id_fk": {
1376
+ "name": "lifecycle_messages_contact_id_contacts_id_fk",
1377
+ "tableFrom": "lifecycle_messages",
1378
+ "tableTo": "contacts",
1379
+ "columnsFrom": [
1380
+ "contact_id"
1381
+ ],
1382
+ "columnsTo": [
1383
+ "id"
1384
+ ],
1385
+ "onDelete": "no action",
1386
+ "onUpdate": "no action"
1387
+ },
1388
+ "lifecycle_messages_flow_id_flows_id_fk": {
1389
+ "name": "lifecycle_messages_flow_id_flows_id_fk",
1390
+ "tableFrom": "lifecycle_messages",
1391
+ "tableTo": "flows",
1392
+ "columnsFrom": [
1393
+ "flow_id"
1394
+ ],
1395
+ "columnsTo": [
1396
+ "id"
1397
+ ],
1398
+ "onDelete": "no action",
1399
+ "onUpdate": "no action"
1400
+ },
1401
+ "lifecycle_messages_membership_id_flow_memberships_id_fk": {
1402
+ "name": "lifecycle_messages_membership_id_flow_memberships_id_fk",
1403
+ "tableFrom": "lifecycle_messages",
1404
+ "tableTo": "flow_memberships",
1405
+ "columnsFrom": [
1406
+ "membership_id"
1407
+ ],
1408
+ "columnsTo": [
1409
+ "id"
1410
+ ],
1411
+ "onDelete": "no action",
1412
+ "onUpdate": "no action"
1413
+ }
1414
+ },
1415
+ "compositePrimaryKeys": {},
1416
+ "uniqueConstraints": {},
1417
+ "checkConstraints": {}
1418
+ },
1419
+ "lifecycle_transitions": {
1420
+ "name": "lifecycle_transitions",
1421
+ "columns": {
1422
+ "id": {
1423
+ "name": "id",
1424
+ "type": "text",
1425
+ "primaryKey": true,
1426
+ "notNull": true,
1427
+ "autoincrement": false
1428
+ },
1429
+ "tenant_id": {
1430
+ "name": "tenant_id",
1431
+ "type": "text",
1432
+ "primaryKey": false,
1433
+ "notNull": true,
1434
+ "autoincrement": false
1435
+ },
1436
+ "contact_id": {
1437
+ "name": "contact_id",
1438
+ "type": "text",
1439
+ "primaryKey": false,
1440
+ "notNull": true,
1441
+ "autoincrement": false
1442
+ },
1443
+ "from_state": {
1444
+ "name": "from_state",
1445
+ "type": "text",
1446
+ "primaryKey": false,
1447
+ "notNull": true,
1448
+ "autoincrement": false
1449
+ },
1450
+ "to_state": {
1451
+ "name": "to_state",
1452
+ "type": "text",
1453
+ "primaryKey": false,
1454
+ "notNull": true,
1455
+ "autoincrement": false
1456
+ },
1457
+ "trigger_event_id": {
1458
+ "name": "trigger_event_id",
1459
+ "type": "text",
1460
+ "primaryKey": false,
1461
+ "notNull": false,
1462
+ "autoincrement": false
1463
+ },
1464
+ "metadata": {
1465
+ "name": "metadata",
1466
+ "type": "text",
1467
+ "primaryKey": false,
1468
+ "notNull": false,
1469
+ "autoincrement": false
1470
+ },
1471
+ "transitioned_at": {
1472
+ "name": "transitioned_at",
1473
+ "type": "integer",
1474
+ "primaryKey": false,
1475
+ "notNull": true,
1476
+ "autoincrement": false
1477
+ }
1478
+ },
1479
+ "indexes": {
1480
+ "idx_transitions_contact": {
1481
+ "name": "idx_transitions_contact",
1482
+ "columns": [
1483
+ "contact_id",
1484
+ "transitioned_at"
1485
+ ],
1486
+ "isUnique": false
1487
+ },
1488
+ "idx_transitions_tenant_time": {
1489
+ "name": "idx_transitions_tenant_time",
1490
+ "columns": [
1491
+ "tenant_id",
1492
+ "transitioned_at"
1493
+ ],
1494
+ "isUnique": false
1495
+ }
1496
+ },
1497
+ "foreignKeys": {
1498
+ "lifecycle_transitions_tenant_id_tenants_id_fk": {
1499
+ "name": "lifecycle_transitions_tenant_id_tenants_id_fk",
1500
+ "tableFrom": "lifecycle_transitions",
1501
+ "tableTo": "tenants",
1502
+ "columnsFrom": [
1503
+ "tenant_id"
1504
+ ],
1505
+ "columnsTo": [
1506
+ "id"
1507
+ ],
1508
+ "onDelete": "no action",
1509
+ "onUpdate": "no action"
1510
+ },
1511
+ "lifecycle_transitions_contact_id_contacts_id_fk": {
1512
+ "name": "lifecycle_transitions_contact_id_contacts_id_fk",
1513
+ "tableFrom": "lifecycle_transitions",
1514
+ "tableTo": "contacts",
1515
+ "columnsFrom": [
1516
+ "contact_id"
1517
+ ],
1518
+ "columnsTo": [
1519
+ "id"
1520
+ ],
1521
+ "onDelete": "no action",
1522
+ "onUpdate": "no action"
1523
+ }
1524
+ },
1525
+ "compositePrimaryKeys": {},
1526
+ "uniqueConstraints": {},
1527
+ "checkConstraints": {}
1528
+ },
1529
+ "llm_configs": {
1530
+ "name": "llm_configs",
1531
+ "columns": {
1532
+ "id": {
1533
+ "name": "id",
1534
+ "type": "text",
1535
+ "primaryKey": true,
1536
+ "notNull": true,
1537
+ "autoincrement": false
1538
+ },
1539
+ "tenant_id": {
1540
+ "name": "tenant_id",
1541
+ "type": "text",
1542
+ "primaryKey": false,
1543
+ "notNull": true,
1544
+ "autoincrement": false
1545
+ },
1546
+ "provider": {
1547
+ "name": "provider",
1548
+ "type": "text",
1549
+ "primaryKey": false,
1550
+ "notNull": true,
1551
+ "autoincrement": false
1552
+ },
1553
+ "config": {
1554
+ "name": "config",
1555
+ "type": "text",
1556
+ "primaryKey": false,
1557
+ "notNull": true,
1558
+ "autoincrement": false
1559
+ },
1560
+ "is_active": {
1561
+ "name": "is_active",
1562
+ "type": "integer",
1563
+ "primaryKey": false,
1564
+ "notNull": false,
1565
+ "autoincrement": false,
1566
+ "default": true
1567
+ },
1568
+ "created_at": {
1569
+ "name": "created_at",
1570
+ "type": "integer",
1571
+ "primaryKey": false,
1572
+ "notNull": false,
1573
+ "autoincrement": false
1574
+ }
1575
+ },
1576
+ "indexes": {},
1577
+ "foreignKeys": {
1578
+ "llm_configs_tenant_id_tenants_id_fk": {
1579
+ "name": "llm_configs_tenant_id_tenants_id_fk",
1580
+ "tableFrom": "llm_configs",
1581
+ "tableTo": "tenants",
1582
+ "columnsFrom": [
1583
+ "tenant_id"
1584
+ ],
1585
+ "columnsTo": [
1586
+ "id"
1587
+ ],
1588
+ "onDelete": "no action",
1589
+ "onUpdate": "no action"
1590
+ }
1591
+ },
1592
+ "compositePrimaryKeys": {},
1593
+ "uniqueConstraints": {},
1594
+ "checkConstraints": {}
1595
+ },
1596
+ "magic_link_tokens": {
1597
+ "name": "magic_link_tokens",
1598
+ "columns": {
1599
+ "id": {
1600
+ "name": "id",
1601
+ "type": "text",
1602
+ "primaryKey": true,
1603
+ "notNull": true,
1604
+ "autoincrement": false
1605
+ },
1606
+ "tenant_id": {
1607
+ "name": "tenant_id",
1608
+ "type": "text",
1609
+ "primaryKey": false,
1610
+ "notNull": true,
1611
+ "autoincrement": false
1612
+ },
1613
+ "user_id": {
1614
+ "name": "user_id",
1615
+ "type": "text",
1616
+ "primaryKey": false,
1617
+ "notNull": true,
1618
+ "autoincrement": false
1619
+ },
1620
+ "token_hash": {
1621
+ "name": "token_hash",
1622
+ "type": "text",
1623
+ "primaryKey": false,
1624
+ "notNull": true,
1625
+ "autoincrement": false
1626
+ },
1627
+ "expires_at": {
1628
+ "name": "expires_at",
1629
+ "type": "integer",
1630
+ "primaryKey": false,
1631
+ "notNull": true,
1632
+ "autoincrement": false
1633
+ },
1634
+ "consumed_at": {
1635
+ "name": "consumed_at",
1636
+ "type": "integer",
1637
+ "primaryKey": false,
1638
+ "notNull": false,
1639
+ "autoincrement": false
1640
+ },
1641
+ "created_at": {
1642
+ "name": "created_at",
1643
+ "type": "integer",
1644
+ "primaryKey": false,
1645
+ "notNull": false,
1646
+ "autoincrement": false
1647
+ }
1648
+ },
1649
+ "indexes": {
1650
+ "idx_magic_link_tokens_hash": {
1651
+ "name": "idx_magic_link_tokens_hash",
1652
+ "columns": [
1653
+ "token_hash"
1654
+ ],
1655
+ "isUnique": false
1656
+ }
1657
+ },
1658
+ "foreignKeys": {
1659
+ "magic_link_tokens_tenant_id_tenants_id_fk": {
1660
+ "name": "magic_link_tokens_tenant_id_tenants_id_fk",
1661
+ "tableFrom": "magic_link_tokens",
1662
+ "tableTo": "tenants",
1663
+ "columnsFrom": [
1664
+ "tenant_id"
1665
+ ],
1666
+ "columnsTo": [
1667
+ "id"
1668
+ ],
1669
+ "onDelete": "no action",
1670
+ "onUpdate": "no action"
1671
+ },
1672
+ "magic_link_tokens_user_id_users_id_fk": {
1673
+ "name": "magic_link_tokens_user_id_users_id_fk",
1674
+ "tableFrom": "magic_link_tokens",
1675
+ "tableTo": "users",
1676
+ "columnsFrom": [
1677
+ "user_id"
1678
+ ],
1679
+ "columnsTo": [
1680
+ "id"
1681
+ ],
1682
+ "onDelete": "cascade",
1683
+ "onUpdate": "no action"
1684
+ }
1685
+ },
1686
+ "compositePrimaryKeys": {},
1687
+ "uniqueConstraints": {},
1688
+ "checkConstraints": {}
1689
+ },
1690
+ "message_events": {
1691
+ "name": "message_events",
1692
+ "columns": {
1693
+ "id": {
1694
+ "name": "id",
1695
+ "type": "text",
1696
+ "primaryKey": true,
1697
+ "notNull": true,
1698
+ "autoincrement": false
1699
+ },
1700
+ "tenant_id": {
1701
+ "name": "tenant_id",
1702
+ "type": "text",
1703
+ "primaryKey": false,
1704
+ "notNull": true,
1705
+ "autoincrement": false
1706
+ },
1707
+ "message_id": {
1708
+ "name": "message_id",
1709
+ "type": "text",
1710
+ "primaryKey": false,
1711
+ "notNull": true,
1712
+ "autoincrement": false
1713
+ },
1714
+ "event_type": {
1715
+ "name": "event_type",
1716
+ "type": "text",
1717
+ "primaryKey": false,
1718
+ "notNull": true,
1719
+ "autoincrement": false
1720
+ },
1721
+ "occurred_at": {
1722
+ "name": "occurred_at",
1723
+ "type": "integer",
1724
+ "primaryKey": false,
1725
+ "notNull": true,
1726
+ "autoincrement": false
1727
+ },
1728
+ "provider_event_id": {
1729
+ "name": "provider_event_id",
1730
+ "type": "text",
1731
+ "primaryKey": false,
1732
+ "notNull": false,
1733
+ "autoincrement": false
1734
+ },
1735
+ "metadata": {
1736
+ "name": "metadata",
1737
+ "type": "text",
1738
+ "primaryKey": false,
1739
+ "notNull": false,
1740
+ "autoincrement": false
1741
+ },
1742
+ "created_at": {
1743
+ "name": "created_at",
1744
+ "type": "integer",
1745
+ "primaryKey": false,
1746
+ "notNull": false,
1747
+ "autoincrement": false
1748
+ }
1749
+ },
1750
+ "indexes": {
1751
+ "idx_message_events_message": {
1752
+ "name": "idx_message_events_message",
1753
+ "columns": [
1754
+ "message_id",
1755
+ "occurred_at"
1756
+ ],
1757
+ "isUnique": false
1758
+ },
1759
+ "idx_message_events_tenant_type_day": {
1760
+ "name": "idx_message_events_tenant_type_day",
1761
+ "columns": [
1762
+ "tenant_id",
1763
+ "event_type",
1764
+ "occurred_at"
1765
+ ],
1766
+ "isUnique": false
1767
+ },
1768
+ "uq_message_events_provider_dedup": {
1769
+ "name": "uq_message_events_provider_dedup",
1770
+ "columns": [
1771
+ "tenant_id",
1772
+ "provider_event_id"
1773
+ ],
1774
+ "isUnique": true,
1775
+ "where": "provider_event_id IS NOT NULL"
1776
+ }
1777
+ },
1778
+ "foreignKeys": {
1779
+ "message_events_tenant_id_tenants_id_fk": {
1780
+ "name": "message_events_tenant_id_tenants_id_fk",
1781
+ "tableFrom": "message_events",
1782
+ "tableTo": "tenants",
1783
+ "columnsFrom": [
1784
+ "tenant_id"
1785
+ ],
1786
+ "columnsTo": [
1787
+ "id"
1788
+ ],
1789
+ "onDelete": "no action",
1790
+ "onUpdate": "no action"
1791
+ },
1792
+ "message_events_message_id_lifecycle_messages_id_fk": {
1793
+ "name": "message_events_message_id_lifecycle_messages_id_fk",
1794
+ "tableFrom": "message_events",
1795
+ "tableTo": "lifecycle_messages",
1796
+ "columnsFrom": [
1797
+ "message_id"
1798
+ ],
1799
+ "columnsTo": [
1800
+ "id"
1801
+ ],
1802
+ "onDelete": "no action",
1803
+ "onUpdate": "no action"
1804
+ }
1805
+ },
1806
+ "compositePrimaryKeys": {},
1807
+ "uniqueConstraints": {},
1808
+ "checkConstraints": {}
1809
+ },
1810
+ "retention_grid_snapshots": {
1811
+ "name": "retention_grid_snapshots",
1812
+ "columns": {
1813
+ "tenant_id": {
1814
+ "name": "tenant_id",
1815
+ "type": "text",
1816
+ "primaryKey": false,
1817
+ "notNull": true,
1818
+ "autoincrement": false
1819
+ },
1820
+ "snapshot_date": {
1821
+ "name": "snapshot_date",
1822
+ "type": "text",
1823
+ "primaryKey": false,
1824
+ "notNull": true,
1825
+ "autoincrement": false
1826
+ },
1827
+ "tenure_bucket": {
1828
+ "name": "tenure_bucket",
1829
+ "type": "text",
1830
+ "primaryKey": false,
1831
+ "notNull": true,
1832
+ "autoincrement": false
1833
+ },
1834
+ "recency_bucket": {
1835
+ "name": "recency_bucket",
1836
+ "type": "text",
1837
+ "primaryKey": false,
1838
+ "notNull": true,
1839
+ "autoincrement": false
1840
+ },
1841
+ "contact_count": {
1842
+ "name": "contact_count",
1843
+ "type": "integer",
1844
+ "primaryKey": false,
1845
+ "notNull": true,
1846
+ "autoincrement": false
1847
+ },
1848
+ "paying_count": {
1849
+ "name": "paying_count",
1850
+ "type": "integer",
1851
+ "primaryKey": false,
1852
+ "notNull": true,
1853
+ "autoincrement": false
1854
+ }
1855
+ },
1856
+ "indexes": {},
1857
+ "foreignKeys": {
1858
+ "retention_grid_snapshots_tenant_id_tenants_id_fk": {
1859
+ "name": "retention_grid_snapshots_tenant_id_tenants_id_fk",
1860
+ "tableFrom": "retention_grid_snapshots",
1861
+ "tableTo": "tenants",
1862
+ "columnsFrom": [
1863
+ "tenant_id"
1864
+ ],
1865
+ "columnsTo": [
1866
+ "id"
1867
+ ],
1868
+ "onDelete": "no action",
1869
+ "onUpdate": "no action"
1870
+ }
1871
+ },
1872
+ "compositePrimaryKeys": {
1873
+ "retention_grid_snapshots_tenant_id_snapshot_date_tenure_bucket_recency_bucket_pk": {
1874
+ "columns": [
1875
+ "tenant_id",
1876
+ "snapshot_date",
1877
+ "tenure_bucket",
1878
+ "recency_bucket"
1879
+ ],
1880
+ "name": "retention_grid_snapshots_tenant_id_snapshot_date_tenure_bucket_recency_bucket_pk"
1881
+ }
1882
+ },
1883
+ "uniqueConstraints": {},
1884
+ "checkConstraints": {}
1885
+ },
1886
+ "scan_checkpoints": {
1887
+ "name": "scan_checkpoints",
1888
+ "columns": {
1889
+ "scan_phase": {
1890
+ "name": "scan_phase",
1891
+ "type": "text",
1892
+ "primaryKey": false,
1893
+ "notNull": true,
1894
+ "autoincrement": false
1895
+ },
1896
+ "tenant_id": {
1897
+ "name": "tenant_id",
1898
+ "type": "text",
1899
+ "primaryKey": false,
1900
+ "notNull": true,
1901
+ "autoincrement": false
1902
+ },
1903
+ "last_id": {
1904
+ "name": "last_id",
1905
+ "type": "text",
1906
+ "primaryKey": false,
1907
+ "notNull": true,
1908
+ "autoincrement": false
1909
+ },
1910
+ "started_at": {
1911
+ "name": "started_at",
1912
+ "type": "integer",
1913
+ "primaryKey": false,
1914
+ "notNull": true,
1915
+ "autoincrement": false
1916
+ },
1917
+ "discard_count": {
1918
+ "name": "discard_count",
1919
+ "type": "integer",
1920
+ "primaryKey": false,
1921
+ "notNull": true,
1922
+ "autoincrement": false,
1923
+ "default": 0
1924
+ }
1925
+ },
1926
+ "indexes": {},
1927
+ "foreignKeys": {
1928
+ "scan_checkpoints_tenant_id_tenants_id_fk": {
1929
+ "name": "scan_checkpoints_tenant_id_tenants_id_fk",
1930
+ "tableFrom": "scan_checkpoints",
1931
+ "tableTo": "tenants",
1932
+ "columnsFrom": [
1933
+ "tenant_id"
1934
+ ],
1935
+ "columnsTo": [
1936
+ "id"
1937
+ ],
1938
+ "onDelete": "no action",
1939
+ "onUpdate": "no action"
1940
+ }
1941
+ },
1942
+ "compositePrimaryKeys": {
1943
+ "scan_checkpoints_scan_phase_tenant_id_pk": {
1944
+ "columns": [
1945
+ "scan_phase",
1946
+ "tenant_id"
1947
+ ],
1948
+ "name": "scan_checkpoints_scan_phase_tenant_id_pk"
1949
+ }
1950
+ },
1951
+ "uniqueConstraints": {},
1952
+ "checkConstraints": {}
1953
+ },
1954
+ "sessions": {
1955
+ "name": "sessions",
1956
+ "columns": {
1957
+ "id": {
1958
+ "name": "id",
1959
+ "type": "text",
1960
+ "primaryKey": true,
1961
+ "notNull": true,
1962
+ "autoincrement": false
1963
+ },
1964
+ "tenant_id": {
1965
+ "name": "tenant_id",
1966
+ "type": "text",
1967
+ "primaryKey": false,
1968
+ "notNull": true,
1969
+ "autoincrement": false
1970
+ },
1971
+ "user_id": {
1972
+ "name": "user_id",
1973
+ "type": "text",
1974
+ "primaryKey": false,
1975
+ "notNull": true,
1976
+ "autoincrement": false
1977
+ },
1978
+ "expires_at": {
1979
+ "name": "expires_at",
1980
+ "type": "integer",
1981
+ "primaryKey": false,
1982
+ "notNull": true,
1983
+ "autoincrement": false
1984
+ },
1985
+ "created_at": {
1986
+ "name": "created_at",
1987
+ "type": "integer",
1988
+ "primaryKey": false,
1989
+ "notNull": false,
1990
+ "autoincrement": false
1991
+ }
1992
+ },
1993
+ "indexes": {},
1994
+ "foreignKeys": {
1995
+ "sessions_tenant_id_tenants_id_fk": {
1996
+ "name": "sessions_tenant_id_tenants_id_fk",
1997
+ "tableFrom": "sessions",
1998
+ "tableTo": "tenants",
1999
+ "columnsFrom": [
2000
+ "tenant_id"
2001
+ ],
2002
+ "columnsTo": [
2003
+ "id"
2004
+ ],
2005
+ "onDelete": "no action",
2006
+ "onUpdate": "no action"
2007
+ },
2008
+ "sessions_user_id_users_id_fk": {
2009
+ "name": "sessions_user_id_users_id_fk",
2010
+ "tableFrom": "sessions",
2011
+ "tableTo": "users",
2012
+ "columnsFrom": [
2013
+ "user_id"
2014
+ ],
2015
+ "columnsTo": [
2016
+ "id"
2017
+ ],
2018
+ "onDelete": "cascade",
2019
+ "onUpdate": "no action"
2020
+ }
2021
+ },
2022
+ "compositePrimaryKeys": {},
2023
+ "uniqueConstraints": {},
2024
+ "checkConstraints": {}
2025
+ },
2026
+ "suppressions": {
2027
+ "name": "suppressions",
2028
+ "columns": {
2029
+ "id": {
2030
+ "name": "id",
2031
+ "type": "text",
2032
+ "primaryKey": true,
2033
+ "notNull": true,
2034
+ "autoincrement": false
2035
+ },
2036
+ "tenant_id": {
2037
+ "name": "tenant_id",
2038
+ "type": "text",
2039
+ "primaryKey": false,
2040
+ "notNull": true,
2041
+ "autoincrement": false
2042
+ },
2043
+ "email": {
2044
+ "name": "email",
2045
+ "type": "text",
2046
+ "primaryKey": false,
2047
+ "notNull": true,
2048
+ "autoincrement": false
2049
+ },
2050
+ "reason": {
2051
+ "name": "reason",
2052
+ "type": "text",
2053
+ "primaryKey": false,
2054
+ "notNull": true,
2055
+ "autoincrement": false
2056
+ },
2057
+ "source": {
2058
+ "name": "source",
2059
+ "type": "text",
2060
+ "primaryKey": false,
2061
+ "notNull": false,
2062
+ "autoincrement": false
2063
+ },
2064
+ "created_at": {
2065
+ "name": "created_at",
2066
+ "type": "integer",
2067
+ "primaryKey": false,
2068
+ "notNull": false,
2069
+ "autoincrement": false
2070
+ }
2071
+ },
2072
+ "indexes": {},
2073
+ "foreignKeys": {
2074
+ "suppressions_tenant_id_tenants_id_fk": {
2075
+ "name": "suppressions_tenant_id_tenants_id_fk",
2076
+ "tableFrom": "suppressions",
2077
+ "tableTo": "tenants",
2078
+ "columnsFrom": [
2079
+ "tenant_id"
2080
+ ],
2081
+ "columnsTo": [
2082
+ "id"
2083
+ ],
2084
+ "onDelete": "no action",
2085
+ "onUpdate": "no action"
2086
+ }
2087
+ },
2088
+ "compositePrimaryKeys": {},
2089
+ "uniqueConstraints": {},
2090
+ "checkConstraints": {}
2091
+ },
2092
+ "templates": {
2093
+ "name": "templates",
2094
+ "columns": {
2095
+ "id": {
2096
+ "name": "id",
2097
+ "type": "text",
2098
+ "primaryKey": true,
2099
+ "notNull": true,
2100
+ "autoincrement": false
2101
+ },
2102
+ "tenant_id": {
2103
+ "name": "tenant_id",
2104
+ "type": "text",
2105
+ "primaryKey": false,
2106
+ "notNull": true,
2107
+ "autoincrement": false
2108
+ },
2109
+ "name": {
2110
+ "name": "name",
2111
+ "type": "text",
2112
+ "primaryKey": false,
2113
+ "notNull": true,
2114
+ "autoincrement": false
2115
+ },
2116
+ "slug": {
2117
+ "name": "slug",
2118
+ "type": "text",
2119
+ "primaryKey": false,
2120
+ "notNull": true,
2121
+ "autoincrement": false
2122
+ },
2123
+ "subject": {
2124
+ "name": "subject",
2125
+ "type": "text",
2126
+ "primaryKey": false,
2127
+ "notNull": true,
2128
+ "autoincrement": false
2129
+ },
2130
+ "body_html": {
2131
+ "name": "body_html",
2132
+ "type": "text",
2133
+ "primaryKey": false,
2134
+ "notNull": true,
2135
+ "autoincrement": false
2136
+ },
2137
+ "body_text": {
2138
+ "name": "body_text",
2139
+ "type": "text",
2140
+ "primaryKey": false,
2141
+ "notNull": false,
2142
+ "autoincrement": false
2143
+ },
2144
+ "variables": {
2145
+ "name": "variables",
2146
+ "type": "text",
2147
+ "primaryKey": false,
2148
+ "notNull": false,
2149
+ "autoincrement": false
2150
+ },
2151
+ "category": {
2152
+ "name": "category",
2153
+ "type": "text",
2154
+ "primaryKey": false,
2155
+ "notNull": false,
2156
+ "autoincrement": false
2157
+ },
2158
+ "is_active": {
2159
+ "name": "is_active",
2160
+ "type": "integer",
2161
+ "primaryKey": false,
2162
+ "notNull": false,
2163
+ "autoincrement": false,
2164
+ "default": true
2165
+ },
2166
+ "created_at": {
2167
+ "name": "created_at",
2168
+ "type": "integer",
2169
+ "primaryKey": false,
2170
+ "notNull": false,
2171
+ "autoincrement": false
2172
+ }
2173
+ },
2174
+ "indexes": {
2175
+ "uq_templates_tenant_slug": {
2176
+ "name": "uq_templates_tenant_slug",
2177
+ "columns": [
2178
+ "tenant_id",
2179
+ "slug"
2180
+ ],
2181
+ "isUnique": true
2182
+ }
2183
+ },
2184
+ "foreignKeys": {
2185
+ "templates_tenant_id_tenants_id_fk": {
2186
+ "name": "templates_tenant_id_tenants_id_fk",
2187
+ "tableFrom": "templates",
2188
+ "tableTo": "tenants",
2189
+ "columnsFrom": [
2190
+ "tenant_id"
2191
+ ],
2192
+ "columnsTo": [
2193
+ "id"
2194
+ ],
2195
+ "onDelete": "no action",
2196
+ "onUpdate": "no action"
2197
+ }
2198
+ },
2199
+ "compositePrimaryKeys": {},
2200
+ "uniqueConstraints": {},
2201
+ "checkConstraints": {}
2202
+ },
2203
+ "tenants": {
2204
+ "name": "tenants",
2205
+ "columns": {
2206
+ "id": {
2207
+ "name": "id",
2208
+ "type": "text",
2209
+ "primaryKey": true,
2210
+ "notNull": true,
2211
+ "autoincrement": false
2212
+ },
2213
+ "name": {
2214
+ "name": "name",
2215
+ "type": "text",
2216
+ "primaryKey": false,
2217
+ "notNull": true,
2218
+ "autoincrement": false
2219
+ },
2220
+ "slug": {
2221
+ "name": "slug",
2222
+ "type": "text",
2223
+ "primaryKey": false,
2224
+ "notNull": true,
2225
+ "autoincrement": false
2226
+ },
2227
+ "plan": {
2228
+ "name": "plan",
2229
+ "type": "text",
2230
+ "primaryKey": false,
2231
+ "notNull": false,
2232
+ "autoincrement": false,
2233
+ "default": "'free'"
2234
+ },
2235
+ "settings": {
2236
+ "name": "settings",
2237
+ "type": "text",
2238
+ "primaryKey": false,
2239
+ "notNull": false,
2240
+ "autoincrement": false
2241
+ },
2242
+ "business_model": {
2243
+ "name": "business_model",
2244
+ "type": "text",
2245
+ "primaryKey": false,
2246
+ "notNull": false,
2247
+ "autoincrement": false
2248
+ },
2249
+ "created_at": {
2250
+ "name": "created_at",
2251
+ "type": "integer",
2252
+ "primaryKey": false,
2253
+ "notNull": false,
2254
+ "autoincrement": false
2255
+ }
2256
+ },
2257
+ "indexes": {
2258
+ "tenants_slug_unique": {
2259
+ "name": "tenants_slug_unique",
2260
+ "columns": [
2261
+ "slug"
2262
+ ],
2263
+ "isUnique": true
2264
+ }
2265
+ },
2266
+ "foreignKeys": {},
2267
+ "compositePrimaryKeys": {},
2268
+ "uniqueConstraints": {},
2269
+ "checkConstraints": {}
2270
+ },
2271
+ "transport_configs": {
2272
+ "name": "transport_configs",
2273
+ "columns": {
2274
+ "id": {
2275
+ "name": "id",
2276
+ "type": "text",
2277
+ "primaryKey": true,
2278
+ "notNull": true,
2279
+ "autoincrement": false
2280
+ },
2281
+ "tenant_id": {
2282
+ "name": "tenant_id",
2283
+ "type": "text",
2284
+ "primaryKey": false,
2285
+ "notNull": true,
2286
+ "autoincrement": false
2287
+ },
2288
+ "provider": {
2289
+ "name": "provider",
2290
+ "type": "text",
2291
+ "primaryKey": false,
2292
+ "notNull": true,
2293
+ "autoincrement": false
2294
+ },
2295
+ "config": {
2296
+ "name": "config",
2297
+ "type": "text",
2298
+ "primaryKey": false,
2299
+ "notNull": true,
2300
+ "autoincrement": false
2301
+ },
2302
+ "is_active": {
2303
+ "name": "is_active",
2304
+ "type": "integer",
2305
+ "primaryKey": false,
2306
+ "notNull": false,
2307
+ "autoincrement": false,
2308
+ "default": true
2309
+ },
2310
+ "dkim_verified": {
2311
+ "name": "dkim_verified",
2312
+ "type": "integer",
2313
+ "primaryKey": false,
2314
+ "notNull": false,
2315
+ "autoincrement": false,
2316
+ "default": false
2317
+ },
2318
+ "from_email": {
2319
+ "name": "from_email",
2320
+ "type": "text",
2321
+ "primaryKey": false,
2322
+ "notNull": true,
2323
+ "autoincrement": false
2324
+ },
2325
+ "from_name": {
2326
+ "name": "from_name",
2327
+ "type": "text",
2328
+ "primaryKey": false,
2329
+ "notNull": false,
2330
+ "autoincrement": false
2331
+ },
2332
+ "daily_limit": {
2333
+ "name": "daily_limit",
2334
+ "type": "integer",
2335
+ "primaryKey": false,
2336
+ "notNull": false,
2337
+ "autoincrement": false
2338
+ },
2339
+ "created_at": {
2340
+ "name": "created_at",
2341
+ "type": "integer",
2342
+ "primaryKey": false,
2343
+ "notNull": false,
2344
+ "autoincrement": false
2345
+ }
2346
+ },
2347
+ "indexes": {},
2348
+ "foreignKeys": {
2349
+ "transport_configs_tenant_id_tenants_id_fk": {
2350
+ "name": "transport_configs_tenant_id_tenants_id_fk",
2351
+ "tableFrom": "transport_configs",
2352
+ "tableTo": "tenants",
2353
+ "columnsFrom": [
2354
+ "tenant_id"
2355
+ ],
2356
+ "columnsTo": [
2357
+ "id"
2358
+ ],
2359
+ "onDelete": "no action",
2360
+ "onUpdate": "no action"
2361
+ }
2362
+ },
2363
+ "compositePrimaryKeys": {},
2364
+ "uniqueConstraints": {},
2365
+ "checkConstraints": {}
2366
+ },
2367
+ "users": {
2368
+ "name": "users",
2369
+ "columns": {
2370
+ "id": {
2371
+ "name": "id",
2372
+ "type": "text",
2373
+ "primaryKey": true,
2374
+ "notNull": true,
2375
+ "autoincrement": false
2376
+ },
2377
+ "tenant_id": {
2378
+ "name": "tenant_id",
2379
+ "type": "text",
2380
+ "primaryKey": false,
2381
+ "notNull": true,
2382
+ "autoincrement": false
2383
+ },
2384
+ "email": {
2385
+ "name": "email",
2386
+ "type": "text",
2387
+ "primaryKey": false,
2388
+ "notNull": true,
2389
+ "autoincrement": false
2390
+ },
2391
+ "name": {
2392
+ "name": "name",
2393
+ "type": "text",
2394
+ "primaryKey": false,
2395
+ "notNull": false,
2396
+ "autoincrement": false
2397
+ },
2398
+ "role": {
2399
+ "name": "role",
2400
+ "type": "text",
2401
+ "primaryKey": false,
2402
+ "notNull": true,
2403
+ "autoincrement": false,
2404
+ "default": "'member'"
2405
+ },
2406
+ "last_login_at": {
2407
+ "name": "last_login_at",
2408
+ "type": "integer",
2409
+ "primaryKey": false,
2410
+ "notNull": false,
2411
+ "autoincrement": false
2412
+ },
2413
+ "deactivated_at": {
2414
+ "name": "deactivated_at",
2415
+ "type": "integer",
2416
+ "primaryKey": false,
2417
+ "notNull": false,
2418
+ "autoincrement": false
2419
+ },
2420
+ "pending_email": {
2421
+ "name": "pending_email",
2422
+ "type": "text",
2423
+ "primaryKey": false,
2424
+ "notNull": false,
2425
+ "autoincrement": false
2426
+ },
2427
+ "pending_email_token_hash": {
2428
+ "name": "pending_email_token_hash",
2429
+ "type": "text",
2430
+ "primaryKey": false,
2431
+ "notNull": false,
2432
+ "autoincrement": false
2433
+ },
2434
+ "pending_email_expires_at": {
2435
+ "name": "pending_email_expires_at",
2436
+ "type": "integer",
2437
+ "primaryKey": false,
2438
+ "notNull": false,
2439
+ "autoincrement": false
2440
+ },
2441
+ "created_at": {
2442
+ "name": "created_at",
2443
+ "type": "integer",
2444
+ "primaryKey": false,
2445
+ "notNull": false,
2446
+ "autoincrement": false
2447
+ }
2448
+ },
2449
+ "indexes": {
2450
+ "uq_users_tenant_email": {
2451
+ "name": "uq_users_tenant_email",
2452
+ "columns": [
2453
+ "tenant_id",
2454
+ "email"
2455
+ ],
2456
+ "isUnique": true
2457
+ }
2458
+ },
2459
+ "foreignKeys": {
2460
+ "users_tenant_id_tenants_id_fk": {
2461
+ "name": "users_tenant_id_tenants_id_fk",
2462
+ "tableFrom": "users",
2463
+ "tableTo": "tenants",
2464
+ "columnsFrom": [
2465
+ "tenant_id"
2466
+ ],
2467
+ "columnsTo": [
2468
+ "id"
2469
+ ],
2470
+ "onDelete": "no action",
2471
+ "onUpdate": "no action"
2472
+ }
2473
+ },
2474
+ "compositePrimaryKeys": {},
2475
+ "uniqueConstraints": {},
2476
+ "checkConstraints": {}
2477
+ }
2478
+ },
2479
+ "views": {},
2480
+ "enums": {},
2481
+ "_meta": {
2482
+ "schemas": {},
2483
+ "tables": {},
2484
+ "columns": {}
2485
+ },
2486
+ "internal": {
2487
+ "indexes": {}
2488
+ }
2489
+ }