@claroshq/claros 0.8.3 → 0.8.12

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