@claroshq/claros 0.8.4 → 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,4141 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "54312e09-c712-481a-b499-3b59854a37c5",
5
+ "prevId": "03ac0262-2377-49e4-a77b-8d6d3f528616",
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
+ "email_template": {
1500
+ "name": "email_template",
1501
+ "type": "text",
1502
+ "primaryKey": false,
1503
+ "notNull": false,
1504
+ "autoincrement": false
1505
+ },
1506
+ "slug": {
1507
+ "name": "slug",
1508
+ "type": "text",
1509
+ "primaryKey": false,
1510
+ "notNull": false,
1511
+ "autoincrement": false
1512
+ },
1513
+ "created_at": {
1514
+ "name": "created_at",
1515
+ "type": "integer",
1516
+ "primaryKey": false,
1517
+ "notNull": false,
1518
+ "autoincrement": false
1519
+ },
1520
+ "updated_at": {
1521
+ "name": "updated_at",
1522
+ "type": "integer",
1523
+ "primaryKey": false,
1524
+ "notNull": false,
1525
+ "autoincrement": false
1526
+ }
1527
+ },
1528
+ "indexes": {
1529
+ "uq_flows_tenant_slug": {
1530
+ "name": "uq_flows_tenant_slug",
1531
+ "columns": [
1532
+ "tenant_id",
1533
+ "slug"
1534
+ ],
1535
+ "isUnique": true,
1536
+ "where": "slug IS NOT NULL"
1537
+ }
1538
+ },
1539
+ "foreignKeys": {
1540
+ "flows_tenant_id_tenants_id_fk": {
1541
+ "name": "flows_tenant_id_tenants_id_fk",
1542
+ "tableFrom": "flows",
1543
+ "tableTo": "tenants",
1544
+ "columnsFrom": [
1545
+ "tenant_id"
1546
+ ],
1547
+ "columnsTo": [
1548
+ "id"
1549
+ ],
1550
+ "onDelete": "no action",
1551
+ "onUpdate": "no action"
1552
+ },
1553
+ "flows_topic_id_topics_id_fk": {
1554
+ "name": "flows_topic_id_topics_id_fk",
1555
+ "tableFrom": "flows",
1556
+ "tableTo": "topics",
1557
+ "columnsFrom": [
1558
+ "topic_id"
1559
+ ],
1560
+ "columnsTo": [
1561
+ "id"
1562
+ ],
1563
+ "onDelete": "no action",
1564
+ "onUpdate": "no action"
1565
+ }
1566
+ },
1567
+ "compositePrimaryKeys": {},
1568
+ "uniqueConstraints": {},
1569
+ "checkConstraints": {}
1570
+ },
1571
+ "instance_settings": {
1572
+ "name": "instance_settings",
1573
+ "columns": {
1574
+ "key": {
1575
+ "name": "key",
1576
+ "type": "text",
1577
+ "primaryKey": true,
1578
+ "notNull": true,
1579
+ "autoincrement": false
1580
+ },
1581
+ "value": {
1582
+ "name": "value",
1583
+ "type": "text",
1584
+ "primaryKey": false,
1585
+ "notNull": true,
1586
+ "autoincrement": false
1587
+ },
1588
+ "updated_at": {
1589
+ "name": "updated_at",
1590
+ "type": "integer",
1591
+ "primaryKey": false,
1592
+ "notNull": false,
1593
+ "autoincrement": false
1594
+ }
1595
+ },
1596
+ "indexes": {},
1597
+ "foreignKeys": {},
1598
+ "compositePrimaryKeys": {},
1599
+ "uniqueConstraints": {},
1600
+ "checkConstraints": {}
1601
+ },
1602
+ "invites": {
1603
+ "name": "invites",
1604
+ "columns": {
1605
+ "id": {
1606
+ "name": "id",
1607
+ "type": "text",
1608
+ "primaryKey": true,
1609
+ "notNull": true,
1610
+ "autoincrement": false
1611
+ },
1612
+ "tenant_id": {
1613
+ "name": "tenant_id",
1614
+ "type": "text",
1615
+ "primaryKey": false,
1616
+ "notNull": true,
1617
+ "autoincrement": false
1618
+ },
1619
+ "email": {
1620
+ "name": "email",
1621
+ "type": "text",
1622
+ "primaryKey": false,
1623
+ "notNull": true,
1624
+ "autoincrement": false
1625
+ },
1626
+ "role": {
1627
+ "name": "role",
1628
+ "type": "text",
1629
+ "primaryKey": false,
1630
+ "notNull": true,
1631
+ "autoincrement": false,
1632
+ "default": "'member'"
1633
+ },
1634
+ "token_hash": {
1635
+ "name": "token_hash",
1636
+ "type": "text",
1637
+ "primaryKey": false,
1638
+ "notNull": true,
1639
+ "autoincrement": false
1640
+ },
1641
+ "invited_by": {
1642
+ "name": "invited_by",
1643
+ "type": "text",
1644
+ "primaryKey": false,
1645
+ "notNull": true,
1646
+ "autoincrement": false
1647
+ },
1648
+ "expires_at": {
1649
+ "name": "expires_at",
1650
+ "type": "integer",
1651
+ "primaryKey": false,
1652
+ "notNull": true,
1653
+ "autoincrement": false
1654
+ },
1655
+ "accepted_at": {
1656
+ "name": "accepted_at",
1657
+ "type": "integer",
1658
+ "primaryKey": false,
1659
+ "notNull": false,
1660
+ "autoincrement": false
1661
+ },
1662
+ "created_at": {
1663
+ "name": "created_at",
1664
+ "type": "integer",
1665
+ "primaryKey": false,
1666
+ "notNull": false,
1667
+ "autoincrement": false
1668
+ }
1669
+ },
1670
+ "indexes": {
1671
+ "idx_invites_token_hash": {
1672
+ "name": "idx_invites_token_hash",
1673
+ "columns": [
1674
+ "token_hash"
1675
+ ],
1676
+ "isUnique": false
1677
+ },
1678
+ "idx_invites_tenant": {
1679
+ "name": "idx_invites_tenant",
1680
+ "columns": [
1681
+ "tenant_id"
1682
+ ],
1683
+ "isUnique": false
1684
+ }
1685
+ },
1686
+ "foreignKeys": {
1687
+ "invites_tenant_id_tenants_id_fk": {
1688
+ "name": "invites_tenant_id_tenants_id_fk",
1689
+ "tableFrom": "invites",
1690
+ "tableTo": "tenants",
1691
+ "columnsFrom": [
1692
+ "tenant_id"
1693
+ ],
1694
+ "columnsTo": [
1695
+ "id"
1696
+ ],
1697
+ "onDelete": "no action",
1698
+ "onUpdate": "no action"
1699
+ },
1700
+ "invites_invited_by_users_id_fk": {
1701
+ "name": "invites_invited_by_users_id_fk",
1702
+ "tableFrom": "invites",
1703
+ "tableTo": "users",
1704
+ "columnsFrom": [
1705
+ "invited_by"
1706
+ ],
1707
+ "columnsTo": [
1708
+ "id"
1709
+ ],
1710
+ "onDelete": "no action",
1711
+ "onUpdate": "no action"
1712
+ }
1713
+ },
1714
+ "compositePrimaryKeys": {},
1715
+ "uniqueConstraints": {},
1716
+ "checkConstraints": {}
1717
+ },
1718
+ "kb_entries": {
1719
+ "name": "kb_entries",
1720
+ "columns": {
1721
+ "id": {
1722
+ "name": "id",
1723
+ "type": "text",
1724
+ "primaryKey": true,
1725
+ "notNull": true,
1726
+ "autoincrement": false
1727
+ },
1728
+ "tenant_id": {
1729
+ "name": "tenant_id",
1730
+ "type": "text",
1731
+ "primaryKey": false,
1732
+ "notNull": true,
1733
+ "autoincrement": false
1734
+ },
1735
+ "title": {
1736
+ "name": "title",
1737
+ "type": "text",
1738
+ "primaryKey": false,
1739
+ "notNull": true,
1740
+ "autoincrement": false
1741
+ },
1742
+ "content": {
1743
+ "name": "content",
1744
+ "type": "text",
1745
+ "primaryKey": false,
1746
+ "notNull": true,
1747
+ "autoincrement": false
1748
+ },
1749
+ "content_type": {
1750
+ "name": "content_type",
1751
+ "type": "text",
1752
+ "primaryKey": false,
1753
+ "notNull": false,
1754
+ "autoincrement": false,
1755
+ "default": "'markdown'"
1756
+ },
1757
+ "source": {
1758
+ "name": "source",
1759
+ "type": "text",
1760
+ "primaryKey": false,
1761
+ "notNull": false,
1762
+ "autoincrement": false,
1763
+ "default": "'manual'"
1764
+ },
1765
+ "source_url": {
1766
+ "name": "source_url",
1767
+ "type": "text",
1768
+ "primaryKey": false,
1769
+ "notNull": false,
1770
+ "autoincrement": false
1771
+ },
1772
+ "tags": {
1773
+ "name": "tags",
1774
+ "type": "text",
1775
+ "primaryKey": false,
1776
+ "notNull": false,
1777
+ "autoincrement": false
1778
+ },
1779
+ "embedding": {
1780
+ "name": "embedding",
1781
+ "type": "text",
1782
+ "primaryKey": false,
1783
+ "notNull": false,
1784
+ "autoincrement": false
1785
+ },
1786
+ "embedding_status": {
1787
+ "name": "embedding_status",
1788
+ "type": "text",
1789
+ "primaryKey": false,
1790
+ "notNull": false,
1791
+ "autoincrement": false
1792
+ },
1793
+ "embedding_error": {
1794
+ "name": "embedding_error",
1795
+ "type": "text",
1796
+ "primaryKey": false,
1797
+ "notNull": false,
1798
+ "autoincrement": false
1799
+ },
1800
+ "is_active": {
1801
+ "name": "is_active",
1802
+ "type": "integer",
1803
+ "primaryKey": false,
1804
+ "notNull": false,
1805
+ "autoincrement": false,
1806
+ "default": true
1807
+ },
1808
+ "category": {
1809
+ "name": "category",
1810
+ "type": "text",
1811
+ "primaryKey": false,
1812
+ "notNull": false,
1813
+ "autoincrement": false
1814
+ },
1815
+ "external_key": {
1816
+ "name": "external_key",
1817
+ "type": "text",
1818
+ "primaryKey": false,
1819
+ "notNull": false,
1820
+ "autoincrement": false
1821
+ },
1822
+ "data": {
1823
+ "name": "data",
1824
+ "type": "text",
1825
+ "primaryKey": false,
1826
+ "notNull": false,
1827
+ "autoincrement": false
1828
+ },
1829
+ "pinned": {
1830
+ "name": "pinned",
1831
+ "type": "integer",
1832
+ "primaryKey": false,
1833
+ "notNull": true,
1834
+ "autoincrement": false,
1835
+ "default": false
1836
+ },
1837
+ "imported_at": {
1838
+ "name": "imported_at",
1839
+ "type": "integer",
1840
+ "primaryKey": false,
1841
+ "notNull": false,
1842
+ "autoincrement": false
1843
+ },
1844
+ "created_at": {
1845
+ "name": "created_at",
1846
+ "type": "integer",
1847
+ "primaryKey": false,
1848
+ "notNull": false,
1849
+ "autoincrement": false
1850
+ },
1851
+ "updated_at": {
1852
+ "name": "updated_at",
1853
+ "type": "integer",
1854
+ "primaryKey": false,
1855
+ "notNull": false,
1856
+ "autoincrement": false
1857
+ }
1858
+ },
1859
+ "indexes": {
1860
+ "idx_kb_entries_tenant_created": {
1861
+ "name": "idx_kb_entries_tenant_created",
1862
+ "columns": [
1863
+ "tenant_id",
1864
+ "created_at",
1865
+ "id"
1866
+ ],
1867
+ "isUnique": false
1868
+ },
1869
+ "uq_kb_entries_external_key": {
1870
+ "name": "uq_kb_entries_external_key",
1871
+ "columns": [
1872
+ "tenant_id",
1873
+ "external_key"
1874
+ ],
1875
+ "isUnique": true,
1876
+ "where": "external_key IS NOT NULL"
1877
+ },
1878
+ "idx_kb_entries_category": {
1879
+ "name": "idx_kb_entries_category",
1880
+ "columns": [
1881
+ "tenant_id",
1882
+ "category"
1883
+ ],
1884
+ "isUnique": false
1885
+ }
1886
+ },
1887
+ "foreignKeys": {
1888
+ "kb_entries_tenant_id_tenants_id_fk": {
1889
+ "name": "kb_entries_tenant_id_tenants_id_fk",
1890
+ "tableFrom": "kb_entries",
1891
+ "tableTo": "tenants",
1892
+ "columnsFrom": [
1893
+ "tenant_id"
1894
+ ],
1895
+ "columnsTo": [
1896
+ "id"
1897
+ ],
1898
+ "onDelete": "no action",
1899
+ "onUpdate": "no action"
1900
+ }
1901
+ },
1902
+ "compositePrimaryKeys": {},
1903
+ "uniqueConstraints": {},
1904
+ "checkConstraints": {}
1905
+ },
1906
+ "lifecycle_messages": {
1907
+ "name": "lifecycle_messages",
1908
+ "columns": {
1909
+ "id": {
1910
+ "name": "id",
1911
+ "type": "text",
1912
+ "primaryKey": true,
1913
+ "notNull": true,
1914
+ "autoincrement": false
1915
+ },
1916
+ "tenant_id": {
1917
+ "name": "tenant_id",
1918
+ "type": "text",
1919
+ "primaryKey": false,
1920
+ "notNull": true,
1921
+ "autoincrement": false
1922
+ },
1923
+ "contact_id": {
1924
+ "name": "contact_id",
1925
+ "type": "text",
1926
+ "primaryKey": false,
1927
+ "notNull": true,
1928
+ "autoincrement": false
1929
+ },
1930
+ "flow_id": {
1931
+ "name": "flow_id",
1932
+ "type": "text",
1933
+ "primaryKey": false,
1934
+ "notNull": true,
1935
+ "autoincrement": false
1936
+ },
1937
+ "membership_id": {
1938
+ "name": "membership_id",
1939
+ "type": "text",
1940
+ "primaryKey": false,
1941
+ "notNull": true,
1942
+ "autoincrement": false
1943
+ },
1944
+ "flow_step_order": {
1945
+ "name": "flow_step_order",
1946
+ "type": "integer",
1947
+ "primaryKey": false,
1948
+ "notNull": false,
1949
+ "autoincrement": false
1950
+ },
1951
+ "status": {
1952
+ "name": "status",
1953
+ "type": "text",
1954
+ "primaryKey": false,
1955
+ "notNull": true,
1956
+ "autoincrement": false
1957
+ },
1958
+ "feedback": {
1959
+ "name": "feedback",
1960
+ "type": "text",
1961
+ "primaryKey": false,
1962
+ "notNull": false,
1963
+ "autoincrement": false
1964
+ },
1965
+ "subject": {
1966
+ "name": "subject",
1967
+ "type": "text",
1968
+ "primaryKey": false,
1969
+ "notNull": false,
1970
+ "autoincrement": false
1971
+ },
1972
+ "body_html": {
1973
+ "name": "body_html",
1974
+ "type": "text",
1975
+ "primaryKey": false,
1976
+ "notNull": false,
1977
+ "autoincrement": false
1978
+ },
1979
+ "body_text": {
1980
+ "name": "body_text",
1981
+ "type": "text",
1982
+ "primaryKey": false,
1983
+ "notNull": false,
1984
+ "autoincrement": false
1985
+ },
1986
+ "brain_reasoning": {
1987
+ "name": "brain_reasoning",
1988
+ "type": "text",
1989
+ "primaryKey": false,
1990
+ "notNull": false,
1991
+ "autoincrement": false
1992
+ },
1993
+ "brain_action_type": {
1994
+ "name": "brain_action_type",
1995
+ "type": "text",
1996
+ "primaryKey": false,
1997
+ "notNull": false,
1998
+ "autoincrement": false
1999
+ },
2000
+ "scheduled_send_at": {
2001
+ "name": "scheduled_send_at",
2002
+ "type": "integer",
2003
+ "primaryKey": false,
2004
+ "notNull": false,
2005
+ "autoincrement": false
2006
+ },
2007
+ "approved_at": {
2008
+ "name": "approved_at",
2009
+ "type": "integer",
2010
+ "primaryKey": false,
2011
+ "notNull": false,
2012
+ "autoincrement": false
2013
+ },
2014
+ "sent_at": {
2015
+ "name": "sent_at",
2016
+ "type": "integer",
2017
+ "primaryKey": false,
2018
+ "notNull": false,
2019
+ "autoincrement": false
2020
+ },
2021
+ "retry_count": {
2022
+ "name": "retry_count",
2023
+ "type": "integer",
2024
+ "primaryKey": false,
2025
+ "notNull": false,
2026
+ "autoincrement": false,
2027
+ "default": 0
2028
+ },
2029
+ "provider_message_id": {
2030
+ "name": "provider_message_id",
2031
+ "type": "text",
2032
+ "primaryKey": false,
2033
+ "notNull": false,
2034
+ "autoincrement": false
2035
+ },
2036
+ "recipient_address": {
2037
+ "name": "recipient_address",
2038
+ "type": "text",
2039
+ "primaryKey": false,
2040
+ "notNull": false,
2041
+ "autoincrement": false
2042
+ },
2043
+ "topic_id": {
2044
+ "name": "topic_id",
2045
+ "type": "text",
2046
+ "primaryKey": false,
2047
+ "notNull": false,
2048
+ "autoincrement": false
2049
+ },
2050
+ "transport_id": {
2051
+ "name": "transport_id",
2052
+ "type": "text",
2053
+ "primaryKey": false,
2054
+ "notNull": false,
2055
+ "autoincrement": false
2056
+ },
2057
+ "status_reason": {
2058
+ "name": "status_reason",
2059
+ "type": "text",
2060
+ "primaryKey": false,
2061
+ "notNull": false,
2062
+ "autoincrement": false
2063
+ },
2064
+ "approved_by": {
2065
+ "name": "approved_by",
2066
+ "type": "text",
2067
+ "primaryKey": false,
2068
+ "notNull": false,
2069
+ "autoincrement": false
2070
+ },
2071
+ "rejected_by": {
2072
+ "name": "rejected_by",
2073
+ "type": "text",
2074
+ "primaryKey": false,
2075
+ "notNull": false,
2076
+ "autoincrement": false
2077
+ },
2078
+ "edited_by": {
2079
+ "name": "edited_by",
2080
+ "type": "text",
2081
+ "primaryKey": false,
2082
+ "notNull": false,
2083
+ "autoincrement": false
2084
+ },
2085
+ "edited_at": {
2086
+ "name": "edited_at",
2087
+ "type": "integer",
2088
+ "primaryKey": false,
2089
+ "notNull": false,
2090
+ "autoincrement": false
2091
+ },
2092
+ "original_subject": {
2093
+ "name": "original_subject",
2094
+ "type": "text",
2095
+ "primaryKey": false,
2096
+ "notNull": false,
2097
+ "autoincrement": false
2098
+ },
2099
+ "original_body_html": {
2100
+ "name": "original_body_html",
2101
+ "type": "text",
2102
+ "primaryKey": false,
2103
+ "notNull": false,
2104
+ "autoincrement": false
2105
+ },
2106
+ "original_body_text": {
2107
+ "name": "original_body_text",
2108
+ "type": "text",
2109
+ "primaryKey": false,
2110
+ "notNull": false,
2111
+ "autoincrement": false
2112
+ },
2113
+ "forced_action_type": {
2114
+ "name": "forced_action_type",
2115
+ "type": "text",
2116
+ "primaryKey": false,
2117
+ "notNull": false,
2118
+ "autoincrement": false
2119
+ },
2120
+ "kb_entry_id": {
2121
+ "name": "kb_entry_id",
2122
+ "type": "text",
2123
+ "primaryKey": false,
2124
+ "notNull": false,
2125
+ "autoincrement": false
2126
+ },
2127
+ "imported": {
2128
+ "name": "imported",
2129
+ "type": "integer",
2130
+ "primaryKey": false,
2131
+ "notNull": true,
2132
+ "autoincrement": false,
2133
+ "default": false
2134
+ },
2135
+ "import_key": {
2136
+ "name": "import_key",
2137
+ "type": "text",
2138
+ "primaryKey": false,
2139
+ "notNull": false,
2140
+ "autoincrement": false
2141
+ },
2142
+ "expires_at": {
2143
+ "name": "expires_at",
2144
+ "type": "integer",
2145
+ "primaryKey": false,
2146
+ "notNull": false,
2147
+ "autoincrement": false
2148
+ },
2149
+ "context_snapshot": {
2150
+ "name": "context_snapshot",
2151
+ "type": "text",
2152
+ "primaryKey": false,
2153
+ "notNull": false,
2154
+ "autoincrement": false
2155
+ },
2156
+ "choose_decision": {
2157
+ "name": "choose_decision",
2158
+ "type": "text",
2159
+ "primaryKey": false,
2160
+ "notNull": false,
2161
+ "autoincrement": false
2162
+ },
2163
+ "opening_line": {
2164
+ "name": "opening_line",
2165
+ "type": "text",
2166
+ "primaryKey": false,
2167
+ "notNull": false,
2168
+ "autoincrement": false
2169
+ },
2170
+ "created_at": {
2171
+ "name": "created_at",
2172
+ "type": "integer",
2173
+ "primaryKey": false,
2174
+ "notNull": false,
2175
+ "autoincrement": false
2176
+ },
2177
+ "updated_at": {
2178
+ "name": "updated_at",
2179
+ "type": "integer",
2180
+ "primaryKey": false,
2181
+ "notNull": false,
2182
+ "autoincrement": false
2183
+ }
2184
+ },
2185
+ "indexes": {
2186
+ "idx_messages_drain": {
2187
+ "name": "idx_messages_drain",
2188
+ "columns": [
2189
+ "tenant_id",
2190
+ "status",
2191
+ "scheduled_send_at"
2192
+ ],
2193
+ "isUnique": false,
2194
+ "where": "status IN ('approved', 'sending')"
2195
+ },
2196
+ "idx_messages_contact": {
2197
+ "name": "idx_messages_contact",
2198
+ "columns": [
2199
+ "contact_id",
2200
+ "status",
2201
+ "created_at"
2202
+ ],
2203
+ "isUnique": false
2204
+ },
2205
+ "idx_messages_contact_sent": {
2206
+ "name": "idx_messages_contact_sent",
2207
+ "columns": [
2208
+ "contact_id",
2209
+ "sent_at"
2210
+ ],
2211
+ "isUnique": false,
2212
+ "where": "status IN ('sending', 'sent')"
2213
+ },
2214
+ "uq_messages_membership_step": {
2215
+ "name": "uq_messages_membership_step",
2216
+ "columns": [
2217
+ "membership_id",
2218
+ "flow_step_order"
2219
+ ],
2220
+ "isUnique": true
2221
+ },
2222
+ "idx_messages_generation": {
2223
+ "name": "idx_messages_generation",
2224
+ "columns": [
2225
+ "tenant_id",
2226
+ "status",
2227
+ "created_at"
2228
+ ],
2229
+ "isUnique": false,
2230
+ "where": "status IN ('pending_generation', 'generating')"
2231
+ },
2232
+ "idx_messages_provider_id": {
2233
+ "name": "idx_messages_provider_id",
2234
+ "columns": [
2235
+ "provider_message_id"
2236
+ ],
2237
+ "isUnique": false,
2238
+ "where": "provider_message_id IS NOT NULL"
2239
+ },
2240
+ "idx_messages_tenant_sent": {
2241
+ "name": "idx_messages_tenant_sent",
2242
+ "columns": [
2243
+ "tenant_id",
2244
+ "sent_at"
2245
+ ],
2246
+ "isUnique": false,
2247
+ "where": "sent_at IS NOT NULL"
2248
+ },
2249
+ "uq_messages_import_key": {
2250
+ "name": "uq_messages_import_key",
2251
+ "columns": [
2252
+ "tenant_id",
2253
+ "import_key"
2254
+ ],
2255
+ "isUnique": true,
2256
+ "where": "import_key IS NOT NULL"
2257
+ },
2258
+ "idx_messages_kb_entry": {
2259
+ "name": "idx_messages_kb_entry",
2260
+ "columns": [
2261
+ "tenant_id",
2262
+ "contact_id",
2263
+ "kb_entry_id"
2264
+ ],
2265
+ "isUnique": false,
2266
+ "where": "kb_entry_id IS NOT NULL"
2267
+ },
2268
+ "idx_messages_expires": {
2269
+ "name": "idx_messages_expires",
2270
+ "columns": [
2271
+ "tenant_id",
2272
+ "expires_at"
2273
+ ],
2274
+ "isUnique": false,
2275
+ "where": "expires_at IS NOT NULL"
2276
+ }
2277
+ },
2278
+ "foreignKeys": {
2279
+ "lifecycle_messages_tenant_id_tenants_id_fk": {
2280
+ "name": "lifecycle_messages_tenant_id_tenants_id_fk",
2281
+ "tableFrom": "lifecycle_messages",
2282
+ "tableTo": "tenants",
2283
+ "columnsFrom": [
2284
+ "tenant_id"
2285
+ ],
2286
+ "columnsTo": [
2287
+ "id"
2288
+ ],
2289
+ "onDelete": "no action",
2290
+ "onUpdate": "no action"
2291
+ },
2292
+ "lifecycle_messages_contact_id_contacts_id_fk": {
2293
+ "name": "lifecycle_messages_contact_id_contacts_id_fk",
2294
+ "tableFrom": "lifecycle_messages",
2295
+ "tableTo": "contacts",
2296
+ "columnsFrom": [
2297
+ "contact_id"
2298
+ ],
2299
+ "columnsTo": [
2300
+ "id"
2301
+ ],
2302
+ "onDelete": "no action",
2303
+ "onUpdate": "no action"
2304
+ },
2305
+ "lifecycle_messages_flow_id_flows_id_fk": {
2306
+ "name": "lifecycle_messages_flow_id_flows_id_fk",
2307
+ "tableFrom": "lifecycle_messages",
2308
+ "tableTo": "flows",
2309
+ "columnsFrom": [
2310
+ "flow_id"
2311
+ ],
2312
+ "columnsTo": [
2313
+ "id"
2314
+ ],
2315
+ "onDelete": "no action",
2316
+ "onUpdate": "no action"
2317
+ },
2318
+ "lifecycle_messages_membership_id_flow_memberships_id_fk": {
2319
+ "name": "lifecycle_messages_membership_id_flow_memberships_id_fk",
2320
+ "tableFrom": "lifecycle_messages",
2321
+ "tableTo": "flow_memberships",
2322
+ "columnsFrom": [
2323
+ "membership_id"
2324
+ ],
2325
+ "columnsTo": [
2326
+ "id"
2327
+ ],
2328
+ "onDelete": "no action",
2329
+ "onUpdate": "no action"
2330
+ }
2331
+ },
2332
+ "compositePrimaryKeys": {},
2333
+ "uniqueConstraints": {},
2334
+ "checkConstraints": {}
2335
+ },
2336
+ "lifecycle_transitions": {
2337
+ "name": "lifecycle_transitions",
2338
+ "columns": {
2339
+ "id": {
2340
+ "name": "id",
2341
+ "type": "text",
2342
+ "primaryKey": true,
2343
+ "notNull": true,
2344
+ "autoincrement": false
2345
+ },
2346
+ "tenant_id": {
2347
+ "name": "tenant_id",
2348
+ "type": "text",
2349
+ "primaryKey": false,
2350
+ "notNull": true,
2351
+ "autoincrement": false
2352
+ },
2353
+ "contact_id": {
2354
+ "name": "contact_id",
2355
+ "type": "text",
2356
+ "primaryKey": false,
2357
+ "notNull": true,
2358
+ "autoincrement": false
2359
+ },
2360
+ "from_state": {
2361
+ "name": "from_state",
2362
+ "type": "text",
2363
+ "primaryKey": false,
2364
+ "notNull": true,
2365
+ "autoincrement": false
2366
+ },
2367
+ "to_state": {
2368
+ "name": "to_state",
2369
+ "type": "text",
2370
+ "primaryKey": false,
2371
+ "notNull": true,
2372
+ "autoincrement": false
2373
+ },
2374
+ "trigger_event_id": {
2375
+ "name": "trigger_event_id",
2376
+ "type": "text",
2377
+ "primaryKey": false,
2378
+ "notNull": false,
2379
+ "autoincrement": false
2380
+ },
2381
+ "metadata": {
2382
+ "name": "metadata",
2383
+ "type": "text",
2384
+ "primaryKey": false,
2385
+ "notNull": false,
2386
+ "autoincrement": false
2387
+ },
2388
+ "transitioned_at": {
2389
+ "name": "transitioned_at",
2390
+ "type": "integer",
2391
+ "primaryKey": false,
2392
+ "notNull": true,
2393
+ "autoincrement": false
2394
+ }
2395
+ },
2396
+ "indexes": {
2397
+ "idx_transitions_contact": {
2398
+ "name": "idx_transitions_contact",
2399
+ "columns": [
2400
+ "contact_id",
2401
+ "transitioned_at"
2402
+ ],
2403
+ "isUnique": false
2404
+ },
2405
+ "idx_transitions_tenant_time": {
2406
+ "name": "idx_transitions_tenant_time",
2407
+ "columns": [
2408
+ "tenant_id",
2409
+ "transitioned_at"
2410
+ ],
2411
+ "isUnique": false
2412
+ }
2413
+ },
2414
+ "foreignKeys": {
2415
+ "lifecycle_transitions_tenant_id_tenants_id_fk": {
2416
+ "name": "lifecycle_transitions_tenant_id_tenants_id_fk",
2417
+ "tableFrom": "lifecycle_transitions",
2418
+ "tableTo": "tenants",
2419
+ "columnsFrom": [
2420
+ "tenant_id"
2421
+ ],
2422
+ "columnsTo": [
2423
+ "id"
2424
+ ],
2425
+ "onDelete": "no action",
2426
+ "onUpdate": "no action"
2427
+ },
2428
+ "lifecycle_transitions_contact_id_contacts_id_fk": {
2429
+ "name": "lifecycle_transitions_contact_id_contacts_id_fk",
2430
+ "tableFrom": "lifecycle_transitions",
2431
+ "tableTo": "contacts",
2432
+ "columnsFrom": [
2433
+ "contact_id"
2434
+ ],
2435
+ "columnsTo": [
2436
+ "id"
2437
+ ],
2438
+ "onDelete": "no action",
2439
+ "onUpdate": "no action"
2440
+ }
2441
+ },
2442
+ "compositePrimaryKeys": {},
2443
+ "uniqueConstraints": {},
2444
+ "checkConstraints": {}
2445
+ },
2446
+ "llm_configs": {
2447
+ "name": "llm_configs",
2448
+ "columns": {
2449
+ "id": {
2450
+ "name": "id",
2451
+ "type": "text",
2452
+ "primaryKey": true,
2453
+ "notNull": true,
2454
+ "autoincrement": false
2455
+ },
2456
+ "tenant_id": {
2457
+ "name": "tenant_id",
2458
+ "type": "text",
2459
+ "primaryKey": false,
2460
+ "notNull": true,
2461
+ "autoincrement": false
2462
+ },
2463
+ "provider": {
2464
+ "name": "provider",
2465
+ "type": "text",
2466
+ "primaryKey": false,
2467
+ "notNull": true,
2468
+ "autoincrement": false
2469
+ },
2470
+ "config": {
2471
+ "name": "config",
2472
+ "type": "text",
2473
+ "primaryKey": false,
2474
+ "notNull": true,
2475
+ "autoincrement": false
2476
+ },
2477
+ "is_active": {
2478
+ "name": "is_active",
2479
+ "type": "integer",
2480
+ "primaryKey": false,
2481
+ "notNull": false,
2482
+ "autoincrement": false,
2483
+ "default": true
2484
+ },
2485
+ "created_at": {
2486
+ "name": "created_at",
2487
+ "type": "integer",
2488
+ "primaryKey": false,
2489
+ "notNull": false,
2490
+ "autoincrement": false
2491
+ }
2492
+ },
2493
+ "indexes": {},
2494
+ "foreignKeys": {
2495
+ "llm_configs_tenant_id_tenants_id_fk": {
2496
+ "name": "llm_configs_tenant_id_tenants_id_fk",
2497
+ "tableFrom": "llm_configs",
2498
+ "tableTo": "tenants",
2499
+ "columnsFrom": [
2500
+ "tenant_id"
2501
+ ],
2502
+ "columnsTo": [
2503
+ "id"
2504
+ ],
2505
+ "onDelete": "no action",
2506
+ "onUpdate": "no action"
2507
+ }
2508
+ },
2509
+ "compositePrimaryKeys": {},
2510
+ "uniqueConstraints": {},
2511
+ "checkConstraints": {}
2512
+ },
2513
+ "magic_link_tokens": {
2514
+ "name": "magic_link_tokens",
2515
+ "columns": {
2516
+ "id": {
2517
+ "name": "id",
2518
+ "type": "text",
2519
+ "primaryKey": true,
2520
+ "notNull": true,
2521
+ "autoincrement": false
2522
+ },
2523
+ "tenant_id": {
2524
+ "name": "tenant_id",
2525
+ "type": "text",
2526
+ "primaryKey": false,
2527
+ "notNull": true,
2528
+ "autoincrement": false
2529
+ },
2530
+ "user_id": {
2531
+ "name": "user_id",
2532
+ "type": "text",
2533
+ "primaryKey": false,
2534
+ "notNull": true,
2535
+ "autoincrement": false
2536
+ },
2537
+ "token_hash": {
2538
+ "name": "token_hash",
2539
+ "type": "text",
2540
+ "primaryKey": false,
2541
+ "notNull": true,
2542
+ "autoincrement": false
2543
+ },
2544
+ "expires_at": {
2545
+ "name": "expires_at",
2546
+ "type": "integer",
2547
+ "primaryKey": false,
2548
+ "notNull": true,
2549
+ "autoincrement": false
2550
+ },
2551
+ "consumed_at": {
2552
+ "name": "consumed_at",
2553
+ "type": "integer",
2554
+ "primaryKey": false,
2555
+ "notNull": false,
2556
+ "autoincrement": false
2557
+ },
2558
+ "created_at": {
2559
+ "name": "created_at",
2560
+ "type": "integer",
2561
+ "primaryKey": false,
2562
+ "notNull": false,
2563
+ "autoincrement": false
2564
+ }
2565
+ },
2566
+ "indexes": {
2567
+ "idx_magic_link_tokens_hash": {
2568
+ "name": "idx_magic_link_tokens_hash",
2569
+ "columns": [
2570
+ "token_hash"
2571
+ ],
2572
+ "isUnique": false
2573
+ }
2574
+ },
2575
+ "foreignKeys": {
2576
+ "magic_link_tokens_tenant_id_tenants_id_fk": {
2577
+ "name": "magic_link_tokens_tenant_id_tenants_id_fk",
2578
+ "tableFrom": "magic_link_tokens",
2579
+ "tableTo": "tenants",
2580
+ "columnsFrom": [
2581
+ "tenant_id"
2582
+ ],
2583
+ "columnsTo": [
2584
+ "id"
2585
+ ],
2586
+ "onDelete": "no action",
2587
+ "onUpdate": "no action"
2588
+ },
2589
+ "magic_link_tokens_user_id_users_id_fk": {
2590
+ "name": "magic_link_tokens_user_id_users_id_fk",
2591
+ "tableFrom": "magic_link_tokens",
2592
+ "tableTo": "users",
2593
+ "columnsFrom": [
2594
+ "user_id"
2595
+ ],
2596
+ "columnsTo": [
2597
+ "id"
2598
+ ],
2599
+ "onDelete": "cascade",
2600
+ "onUpdate": "no action"
2601
+ }
2602
+ },
2603
+ "compositePrimaryKeys": {},
2604
+ "uniqueConstraints": {},
2605
+ "checkConstraints": {}
2606
+ },
2607
+ "memberships": {
2608
+ "name": "memberships",
2609
+ "columns": {
2610
+ "user_id": {
2611
+ "name": "user_id",
2612
+ "type": "text",
2613
+ "primaryKey": false,
2614
+ "notNull": true,
2615
+ "autoincrement": false
2616
+ },
2617
+ "tenant_id": {
2618
+ "name": "tenant_id",
2619
+ "type": "text",
2620
+ "primaryKey": false,
2621
+ "notNull": true,
2622
+ "autoincrement": false
2623
+ },
2624
+ "role": {
2625
+ "name": "role",
2626
+ "type": "text",
2627
+ "primaryKey": false,
2628
+ "notNull": true,
2629
+ "autoincrement": false
2630
+ },
2631
+ "created_at": {
2632
+ "name": "created_at",
2633
+ "type": "integer",
2634
+ "primaryKey": false,
2635
+ "notNull": false,
2636
+ "autoincrement": false
2637
+ }
2638
+ },
2639
+ "indexes": {
2640
+ "idx_memberships_tenant": {
2641
+ "name": "idx_memberships_tenant",
2642
+ "columns": [
2643
+ "tenant_id"
2644
+ ],
2645
+ "isUnique": false
2646
+ }
2647
+ },
2648
+ "foreignKeys": {
2649
+ "memberships_user_id_users_id_fk": {
2650
+ "name": "memberships_user_id_users_id_fk",
2651
+ "tableFrom": "memberships",
2652
+ "tableTo": "users",
2653
+ "columnsFrom": [
2654
+ "user_id"
2655
+ ],
2656
+ "columnsTo": [
2657
+ "id"
2658
+ ],
2659
+ "onDelete": "cascade",
2660
+ "onUpdate": "no action"
2661
+ },
2662
+ "memberships_tenant_id_tenants_id_fk": {
2663
+ "name": "memberships_tenant_id_tenants_id_fk",
2664
+ "tableFrom": "memberships",
2665
+ "tableTo": "tenants",
2666
+ "columnsFrom": [
2667
+ "tenant_id"
2668
+ ],
2669
+ "columnsTo": [
2670
+ "id"
2671
+ ],
2672
+ "onDelete": "no action",
2673
+ "onUpdate": "no action"
2674
+ }
2675
+ },
2676
+ "compositePrimaryKeys": {
2677
+ "memberships_pkey": {
2678
+ "columns": [
2679
+ "user_id",
2680
+ "tenant_id"
2681
+ ],
2682
+ "name": "memberships_pkey"
2683
+ }
2684
+ },
2685
+ "uniqueConstraints": {},
2686
+ "checkConstraints": {}
2687
+ },
2688
+ "message_events": {
2689
+ "name": "message_events",
2690
+ "columns": {
2691
+ "id": {
2692
+ "name": "id",
2693
+ "type": "text",
2694
+ "primaryKey": true,
2695
+ "notNull": true,
2696
+ "autoincrement": false
2697
+ },
2698
+ "tenant_id": {
2699
+ "name": "tenant_id",
2700
+ "type": "text",
2701
+ "primaryKey": false,
2702
+ "notNull": true,
2703
+ "autoincrement": false
2704
+ },
2705
+ "message_id": {
2706
+ "name": "message_id",
2707
+ "type": "text",
2708
+ "primaryKey": false,
2709
+ "notNull": true,
2710
+ "autoincrement": false
2711
+ },
2712
+ "event_type": {
2713
+ "name": "event_type",
2714
+ "type": "text",
2715
+ "primaryKey": false,
2716
+ "notNull": true,
2717
+ "autoincrement": false
2718
+ },
2719
+ "occurred_at": {
2720
+ "name": "occurred_at",
2721
+ "type": "integer",
2722
+ "primaryKey": false,
2723
+ "notNull": true,
2724
+ "autoincrement": false
2725
+ },
2726
+ "provider_event_id": {
2727
+ "name": "provider_event_id",
2728
+ "type": "text",
2729
+ "primaryKey": false,
2730
+ "notNull": false,
2731
+ "autoincrement": false
2732
+ },
2733
+ "metadata": {
2734
+ "name": "metadata",
2735
+ "type": "text",
2736
+ "primaryKey": false,
2737
+ "notNull": false,
2738
+ "autoincrement": false
2739
+ },
2740
+ "created_at": {
2741
+ "name": "created_at",
2742
+ "type": "integer",
2743
+ "primaryKey": false,
2744
+ "notNull": false,
2745
+ "autoincrement": false
2746
+ }
2747
+ },
2748
+ "indexes": {
2749
+ "idx_message_events_message": {
2750
+ "name": "idx_message_events_message",
2751
+ "columns": [
2752
+ "message_id",
2753
+ "occurred_at"
2754
+ ],
2755
+ "isUnique": false
2756
+ },
2757
+ "idx_message_events_tenant_type_day": {
2758
+ "name": "idx_message_events_tenant_type_day",
2759
+ "columns": [
2760
+ "tenant_id",
2761
+ "event_type",
2762
+ "occurred_at"
2763
+ ],
2764
+ "isUnique": false
2765
+ },
2766
+ "uq_message_events_provider_dedup": {
2767
+ "name": "uq_message_events_provider_dedup",
2768
+ "columns": [
2769
+ "tenant_id",
2770
+ "provider_event_id"
2771
+ ],
2772
+ "isUnique": true,
2773
+ "where": "provider_event_id IS NOT NULL"
2774
+ }
2775
+ },
2776
+ "foreignKeys": {
2777
+ "message_events_tenant_id_tenants_id_fk": {
2778
+ "name": "message_events_tenant_id_tenants_id_fk",
2779
+ "tableFrom": "message_events",
2780
+ "tableTo": "tenants",
2781
+ "columnsFrom": [
2782
+ "tenant_id"
2783
+ ],
2784
+ "columnsTo": [
2785
+ "id"
2786
+ ],
2787
+ "onDelete": "no action",
2788
+ "onUpdate": "no action"
2789
+ },
2790
+ "message_events_message_id_lifecycle_messages_id_fk": {
2791
+ "name": "message_events_message_id_lifecycle_messages_id_fk",
2792
+ "tableFrom": "message_events",
2793
+ "tableTo": "lifecycle_messages",
2794
+ "columnsFrom": [
2795
+ "message_id"
2796
+ ],
2797
+ "columnsTo": [
2798
+ "id"
2799
+ ],
2800
+ "onDelete": "no action",
2801
+ "onUpdate": "no action"
2802
+ }
2803
+ },
2804
+ "compositePrimaryKeys": {},
2805
+ "uniqueConstraints": {},
2806
+ "checkConstraints": {}
2807
+ },
2808
+ "ops_alerts": {
2809
+ "name": "ops_alerts",
2810
+ "columns": {
2811
+ "fingerprint": {
2812
+ "name": "fingerprint",
2813
+ "type": "text",
2814
+ "primaryKey": true,
2815
+ "notNull": true,
2816
+ "autoincrement": false
2817
+ },
2818
+ "kind": {
2819
+ "name": "kind",
2820
+ "type": "text",
2821
+ "primaryKey": false,
2822
+ "notNull": true,
2823
+ "autoincrement": false
2824
+ },
2825
+ "tenant_id": {
2826
+ "name": "tenant_id",
2827
+ "type": "text",
2828
+ "primaryKey": false,
2829
+ "notNull": false,
2830
+ "autoincrement": false
2831
+ },
2832
+ "severity": {
2833
+ "name": "severity",
2834
+ "type": "text",
2835
+ "primaryKey": false,
2836
+ "notNull": true,
2837
+ "autoincrement": false
2838
+ },
2839
+ "message": {
2840
+ "name": "message",
2841
+ "type": "text",
2842
+ "primaryKey": false,
2843
+ "notNull": true,
2844
+ "autoincrement": false
2845
+ },
2846
+ "first_at": {
2847
+ "name": "first_at",
2848
+ "type": "integer",
2849
+ "primaryKey": false,
2850
+ "notNull": true,
2851
+ "autoincrement": false
2852
+ },
2853
+ "last_at": {
2854
+ "name": "last_at",
2855
+ "type": "integer",
2856
+ "primaryKey": false,
2857
+ "notNull": true,
2858
+ "autoincrement": false
2859
+ },
2860
+ "count": {
2861
+ "name": "count",
2862
+ "type": "integer",
2863
+ "primaryKey": false,
2864
+ "notNull": true,
2865
+ "autoincrement": false,
2866
+ "default": 1
2867
+ },
2868
+ "last_notified_at": {
2869
+ "name": "last_notified_at",
2870
+ "type": "integer",
2871
+ "primaryKey": false,
2872
+ "notNull": false,
2873
+ "autoincrement": false
2874
+ },
2875
+ "notified_count": {
2876
+ "name": "notified_count",
2877
+ "type": "integer",
2878
+ "primaryKey": false,
2879
+ "notNull": true,
2880
+ "autoincrement": false,
2881
+ "default": 0
2882
+ },
2883
+ "status": {
2884
+ "name": "status",
2885
+ "type": "text",
2886
+ "primaryKey": false,
2887
+ "notNull": true,
2888
+ "autoincrement": false,
2889
+ "default": "'open'"
2890
+ },
2891
+ "muted_until": {
2892
+ "name": "muted_until",
2893
+ "type": "integer",
2894
+ "primaryKey": false,
2895
+ "notNull": false,
2896
+ "autoincrement": false
2897
+ }
2898
+ },
2899
+ "indexes": {},
2900
+ "foreignKeys": {},
2901
+ "compositePrimaryKeys": {},
2902
+ "uniqueConstraints": {},
2903
+ "checkConstraints": {}
2904
+ },
2905
+ "ops_events": {
2906
+ "name": "ops_events",
2907
+ "columns": {
2908
+ "id": {
2909
+ "name": "id",
2910
+ "type": "text",
2911
+ "primaryKey": true,
2912
+ "notNull": true,
2913
+ "autoincrement": false
2914
+ },
2915
+ "at": {
2916
+ "name": "at",
2917
+ "type": "integer",
2918
+ "primaryKey": false,
2919
+ "notNull": true,
2920
+ "autoincrement": false
2921
+ },
2922
+ "tenant_id": {
2923
+ "name": "tenant_id",
2924
+ "type": "text",
2925
+ "primaryKey": false,
2926
+ "notNull": false,
2927
+ "autoincrement": false
2928
+ },
2929
+ "kind": {
2930
+ "name": "kind",
2931
+ "type": "text",
2932
+ "primaryKey": false,
2933
+ "notNull": true,
2934
+ "autoincrement": false
2935
+ },
2936
+ "severity": {
2937
+ "name": "severity",
2938
+ "type": "text",
2939
+ "primaryKey": false,
2940
+ "notNull": true,
2941
+ "autoincrement": false
2942
+ },
2943
+ "fingerprint": {
2944
+ "name": "fingerprint",
2945
+ "type": "text",
2946
+ "primaryKey": false,
2947
+ "notNull": true,
2948
+ "autoincrement": false
2949
+ },
2950
+ "message": {
2951
+ "name": "message",
2952
+ "type": "text",
2953
+ "primaryKey": false,
2954
+ "notNull": true,
2955
+ "autoincrement": false
2956
+ },
2957
+ "context": {
2958
+ "name": "context",
2959
+ "type": "text",
2960
+ "primaryKey": false,
2961
+ "notNull": false,
2962
+ "autoincrement": false
2963
+ }
2964
+ },
2965
+ "indexes": {
2966
+ "idx_ops_events_fingerprint_at": {
2967
+ "name": "idx_ops_events_fingerprint_at",
2968
+ "columns": [
2969
+ "fingerprint",
2970
+ "at"
2971
+ ],
2972
+ "isUnique": false
2973
+ },
2974
+ "idx_ops_events_at": {
2975
+ "name": "idx_ops_events_at",
2976
+ "columns": [
2977
+ "at"
2978
+ ],
2979
+ "isUnique": false
2980
+ }
2981
+ },
2982
+ "foreignKeys": {},
2983
+ "compositePrimaryKeys": {},
2984
+ "uniqueConstraints": {},
2985
+ "checkConstraints": {}
2986
+ },
2987
+ "retention_grid_snapshots": {
2988
+ "name": "retention_grid_snapshots",
2989
+ "columns": {
2990
+ "tenant_id": {
2991
+ "name": "tenant_id",
2992
+ "type": "text",
2993
+ "primaryKey": false,
2994
+ "notNull": true,
2995
+ "autoincrement": false
2996
+ },
2997
+ "snapshot_date": {
2998
+ "name": "snapshot_date",
2999
+ "type": "text",
3000
+ "primaryKey": false,
3001
+ "notNull": true,
3002
+ "autoincrement": false
3003
+ },
3004
+ "tenure_bucket": {
3005
+ "name": "tenure_bucket",
3006
+ "type": "text",
3007
+ "primaryKey": false,
3008
+ "notNull": true,
3009
+ "autoincrement": false
3010
+ },
3011
+ "recency_bucket": {
3012
+ "name": "recency_bucket",
3013
+ "type": "text",
3014
+ "primaryKey": false,
3015
+ "notNull": true,
3016
+ "autoincrement": false
3017
+ },
3018
+ "contact_count": {
3019
+ "name": "contact_count",
3020
+ "type": "integer",
3021
+ "primaryKey": false,
3022
+ "notNull": true,
3023
+ "autoincrement": false
3024
+ },
3025
+ "paying_count": {
3026
+ "name": "paying_count",
3027
+ "type": "integer",
3028
+ "primaryKey": false,
3029
+ "notNull": true,
3030
+ "autoincrement": false
3031
+ }
3032
+ },
3033
+ "indexes": {},
3034
+ "foreignKeys": {
3035
+ "retention_grid_snapshots_tenant_id_tenants_id_fk": {
3036
+ "name": "retention_grid_snapshots_tenant_id_tenants_id_fk",
3037
+ "tableFrom": "retention_grid_snapshots",
3038
+ "tableTo": "tenants",
3039
+ "columnsFrom": [
3040
+ "tenant_id"
3041
+ ],
3042
+ "columnsTo": [
3043
+ "id"
3044
+ ],
3045
+ "onDelete": "no action",
3046
+ "onUpdate": "no action"
3047
+ }
3048
+ },
3049
+ "compositePrimaryKeys": {
3050
+ "retention_grid_snapshots_tenant_id_snapshot_date_tenure_bucket_recency_bucket_pk": {
3051
+ "columns": [
3052
+ "tenant_id",
3053
+ "snapshot_date",
3054
+ "tenure_bucket",
3055
+ "recency_bucket"
3056
+ ],
3057
+ "name": "retention_grid_snapshots_tenant_id_snapshot_date_tenure_bucket_recency_bucket_pk"
3058
+ }
3059
+ },
3060
+ "uniqueConstraints": {},
3061
+ "checkConstraints": {}
3062
+ },
3063
+ "scan_checkpoints": {
3064
+ "name": "scan_checkpoints",
3065
+ "columns": {
3066
+ "scan_phase": {
3067
+ "name": "scan_phase",
3068
+ "type": "text",
3069
+ "primaryKey": false,
3070
+ "notNull": true,
3071
+ "autoincrement": false
3072
+ },
3073
+ "tenant_id": {
3074
+ "name": "tenant_id",
3075
+ "type": "text",
3076
+ "primaryKey": false,
3077
+ "notNull": true,
3078
+ "autoincrement": false
3079
+ },
3080
+ "last_id": {
3081
+ "name": "last_id",
3082
+ "type": "text",
3083
+ "primaryKey": false,
3084
+ "notNull": true,
3085
+ "autoincrement": false
3086
+ },
3087
+ "started_at": {
3088
+ "name": "started_at",
3089
+ "type": "integer",
3090
+ "primaryKey": false,
3091
+ "notNull": true,
3092
+ "autoincrement": false
3093
+ },
3094
+ "discard_count": {
3095
+ "name": "discard_count",
3096
+ "type": "integer",
3097
+ "primaryKey": false,
3098
+ "notNull": true,
3099
+ "autoincrement": false,
3100
+ "default": 0
3101
+ }
3102
+ },
3103
+ "indexes": {},
3104
+ "foreignKeys": {
3105
+ "scan_checkpoints_tenant_id_tenants_id_fk": {
3106
+ "name": "scan_checkpoints_tenant_id_tenants_id_fk",
3107
+ "tableFrom": "scan_checkpoints",
3108
+ "tableTo": "tenants",
3109
+ "columnsFrom": [
3110
+ "tenant_id"
3111
+ ],
3112
+ "columnsTo": [
3113
+ "id"
3114
+ ],
3115
+ "onDelete": "no action",
3116
+ "onUpdate": "no action"
3117
+ }
3118
+ },
3119
+ "compositePrimaryKeys": {
3120
+ "scan_checkpoints_scan_phase_tenant_id_pk": {
3121
+ "columns": [
3122
+ "scan_phase",
3123
+ "tenant_id"
3124
+ ],
3125
+ "name": "scan_checkpoints_scan_phase_tenant_id_pk"
3126
+ }
3127
+ },
3128
+ "uniqueConstraints": {},
3129
+ "checkConstraints": {}
3130
+ },
3131
+ "sessions": {
3132
+ "name": "sessions",
3133
+ "columns": {
3134
+ "id": {
3135
+ "name": "id",
3136
+ "type": "text",
3137
+ "primaryKey": true,
3138
+ "notNull": true,
3139
+ "autoincrement": false
3140
+ },
3141
+ "tenant_id": {
3142
+ "name": "tenant_id",
3143
+ "type": "text",
3144
+ "primaryKey": false,
3145
+ "notNull": true,
3146
+ "autoincrement": false
3147
+ },
3148
+ "user_id": {
3149
+ "name": "user_id",
3150
+ "type": "text",
3151
+ "primaryKey": false,
3152
+ "notNull": true,
3153
+ "autoincrement": false
3154
+ },
3155
+ "expires_at": {
3156
+ "name": "expires_at",
3157
+ "type": "integer",
3158
+ "primaryKey": false,
3159
+ "notNull": true,
3160
+ "autoincrement": false
3161
+ },
3162
+ "created_at": {
3163
+ "name": "created_at",
3164
+ "type": "integer",
3165
+ "primaryKey": false,
3166
+ "notNull": false,
3167
+ "autoincrement": false
3168
+ }
3169
+ },
3170
+ "indexes": {},
3171
+ "foreignKeys": {
3172
+ "sessions_tenant_id_tenants_id_fk": {
3173
+ "name": "sessions_tenant_id_tenants_id_fk",
3174
+ "tableFrom": "sessions",
3175
+ "tableTo": "tenants",
3176
+ "columnsFrom": [
3177
+ "tenant_id"
3178
+ ],
3179
+ "columnsTo": [
3180
+ "id"
3181
+ ],
3182
+ "onDelete": "no action",
3183
+ "onUpdate": "no action"
3184
+ },
3185
+ "sessions_user_id_users_id_fk": {
3186
+ "name": "sessions_user_id_users_id_fk",
3187
+ "tableFrom": "sessions",
3188
+ "tableTo": "users",
3189
+ "columnsFrom": [
3190
+ "user_id"
3191
+ ],
3192
+ "columnsTo": [
3193
+ "id"
3194
+ ],
3195
+ "onDelete": "cascade",
3196
+ "onUpdate": "no action"
3197
+ }
3198
+ },
3199
+ "compositePrimaryKeys": {},
3200
+ "uniqueConstraints": {},
3201
+ "checkConstraints": {}
3202
+ },
3203
+ "suppressions": {
3204
+ "name": "suppressions",
3205
+ "columns": {
3206
+ "id": {
3207
+ "name": "id",
3208
+ "type": "text",
3209
+ "primaryKey": true,
3210
+ "notNull": true,
3211
+ "autoincrement": false
3212
+ },
3213
+ "tenant_id": {
3214
+ "name": "tenant_id",
3215
+ "type": "text",
3216
+ "primaryKey": false,
3217
+ "notNull": true,
3218
+ "autoincrement": false
3219
+ },
3220
+ "email": {
3221
+ "name": "email",
3222
+ "type": "text",
3223
+ "primaryKey": false,
3224
+ "notNull": true,
3225
+ "autoincrement": false
3226
+ },
3227
+ "reason": {
3228
+ "name": "reason",
3229
+ "type": "text",
3230
+ "primaryKey": false,
3231
+ "notNull": true,
3232
+ "autoincrement": false
3233
+ },
3234
+ "source": {
3235
+ "name": "source",
3236
+ "type": "text",
3237
+ "primaryKey": false,
3238
+ "notNull": false,
3239
+ "autoincrement": false
3240
+ },
3241
+ "created_at": {
3242
+ "name": "created_at",
3243
+ "type": "integer",
3244
+ "primaryKey": false,
3245
+ "notNull": false,
3246
+ "autoincrement": false
3247
+ }
3248
+ },
3249
+ "indexes": {},
3250
+ "foreignKeys": {
3251
+ "suppressions_tenant_id_tenants_id_fk": {
3252
+ "name": "suppressions_tenant_id_tenants_id_fk",
3253
+ "tableFrom": "suppressions",
3254
+ "tableTo": "tenants",
3255
+ "columnsFrom": [
3256
+ "tenant_id"
3257
+ ],
3258
+ "columnsTo": [
3259
+ "id"
3260
+ ],
3261
+ "onDelete": "no action",
3262
+ "onUpdate": "no action"
3263
+ }
3264
+ },
3265
+ "compositePrimaryKeys": {},
3266
+ "uniqueConstraints": {},
3267
+ "checkConstraints": {}
3268
+ },
3269
+ "templates": {
3270
+ "name": "templates",
3271
+ "columns": {
3272
+ "id": {
3273
+ "name": "id",
3274
+ "type": "text",
3275
+ "primaryKey": true,
3276
+ "notNull": true,
3277
+ "autoincrement": false
3278
+ },
3279
+ "tenant_id": {
3280
+ "name": "tenant_id",
3281
+ "type": "text",
3282
+ "primaryKey": false,
3283
+ "notNull": true,
3284
+ "autoincrement": false
3285
+ },
3286
+ "name": {
3287
+ "name": "name",
3288
+ "type": "text",
3289
+ "primaryKey": false,
3290
+ "notNull": true,
3291
+ "autoincrement": false
3292
+ },
3293
+ "slug": {
3294
+ "name": "slug",
3295
+ "type": "text",
3296
+ "primaryKey": false,
3297
+ "notNull": true,
3298
+ "autoincrement": false
3299
+ },
3300
+ "subject": {
3301
+ "name": "subject",
3302
+ "type": "text",
3303
+ "primaryKey": false,
3304
+ "notNull": true,
3305
+ "autoincrement": false
3306
+ },
3307
+ "body_html": {
3308
+ "name": "body_html",
3309
+ "type": "text",
3310
+ "primaryKey": false,
3311
+ "notNull": true,
3312
+ "autoincrement": false
3313
+ },
3314
+ "body_text": {
3315
+ "name": "body_text",
3316
+ "type": "text",
3317
+ "primaryKey": false,
3318
+ "notNull": false,
3319
+ "autoincrement": false
3320
+ },
3321
+ "variables": {
3322
+ "name": "variables",
3323
+ "type": "text",
3324
+ "primaryKey": false,
3325
+ "notNull": false,
3326
+ "autoincrement": false
3327
+ },
3328
+ "category": {
3329
+ "name": "category",
3330
+ "type": "text",
3331
+ "primaryKey": false,
3332
+ "notNull": false,
3333
+ "autoincrement": false
3334
+ },
3335
+ "is_active": {
3336
+ "name": "is_active",
3337
+ "type": "integer",
3338
+ "primaryKey": false,
3339
+ "notNull": false,
3340
+ "autoincrement": false,
3341
+ "default": true
3342
+ },
3343
+ "created_at": {
3344
+ "name": "created_at",
3345
+ "type": "integer",
3346
+ "primaryKey": false,
3347
+ "notNull": false,
3348
+ "autoincrement": false
3349
+ }
3350
+ },
3351
+ "indexes": {
3352
+ "uq_templates_tenant_slug": {
3353
+ "name": "uq_templates_tenant_slug",
3354
+ "columns": [
3355
+ "tenant_id",
3356
+ "slug"
3357
+ ],
3358
+ "isUnique": true
3359
+ }
3360
+ },
3361
+ "foreignKeys": {
3362
+ "templates_tenant_id_tenants_id_fk": {
3363
+ "name": "templates_tenant_id_tenants_id_fk",
3364
+ "tableFrom": "templates",
3365
+ "tableTo": "tenants",
3366
+ "columnsFrom": [
3367
+ "tenant_id"
3368
+ ],
3369
+ "columnsTo": [
3370
+ "id"
3371
+ ],
3372
+ "onDelete": "no action",
3373
+ "onUpdate": "no action"
3374
+ }
3375
+ },
3376
+ "compositePrimaryKeys": {},
3377
+ "uniqueConstraints": {},
3378
+ "checkConstraints": {}
3379
+ },
3380
+ "tenant_daily_usage": {
3381
+ "name": "tenant_daily_usage",
3382
+ "columns": {
3383
+ "tenant_id": {
3384
+ "name": "tenant_id",
3385
+ "type": "text",
3386
+ "primaryKey": false,
3387
+ "notNull": true,
3388
+ "autoincrement": false
3389
+ },
3390
+ "day": {
3391
+ "name": "day",
3392
+ "type": "text",
3393
+ "primaryKey": false,
3394
+ "notNull": true,
3395
+ "autoincrement": false
3396
+ },
3397
+ "llm_tokens": {
3398
+ "name": "llm_tokens",
3399
+ "type": "integer",
3400
+ "primaryKey": false,
3401
+ "notNull": true,
3402
+ "autoincrement": false,
3403
+ "default": 0
3404
+ },
3405
+ "digest_sent_at": {
3406
+ "name": "digest_sent_at",
3407
+ "type": "integer",
3408
+ "primaryKey": false,
3409
+ "notNull": false,
3410
+ "autoincrement": false
3411
+ }
3412
+ },
3413
+ "indexes": {},
3414
+ "foreignKeys": {
3415
+ "tenant_daily_usage_tenant_id_tenants_id_fk": {
3416
+ "name": "tenant_daily_usage_tenant_id_tenants_id_fk",
3417
+ "tableFrom": "tenant_daily_usage",
3418
+ "tableTo": "tenants",
3419
+ "columnsFrom": [
3420
+ "tenant_id"
3421
+ ],
3422
+ "columnsTo": [
3423
+ "id"
3424
+ ],
3425
+ "onDelete": "no action",
3426
+ "onUpdate": "no action"
3427
+ }
3428
+ },
3429
+ "compositePrimaryKeys": {
3430
+ "tenant_daily_usage_pkey": {
3431
+ "columns": [
3432
+ "tenant_id",
3433
+ "day"
3434
+ ],
3435
+ "name": "tenant_daily_usage_pkey"
3436
+ }
3437
+ },
3438
+ "uniqueConstraints": {},
3439
+ "checkConstraints": {}
3440
+ },
3441
+ "tenants": {
3442
+ "name": "tenants",
3443
+ "columns": {
3444
+ "id": {
3445
+ "name": "id",
3446
+ "type": "text",
3447
+ "primaryKey": true,
3448
+ "notNull": true,
3449
+ "autoincrement": false
3450
+ },
3451
+ "name": {
3452
+ "name": "name",
3453
+ "type": "text",
3454
+ "primaryKey": false,
3455
+ "notNull": true,
3456
+ "autoincrement": false
3457
+ },
3458
+ "slug": {
3459
+ "name": "slug",
3460
+ "type": "text",
3461
+ "primaryKey": false,
3462
+ "notNull": true,
3463
+ "autoincrement": false
3464
+ },
3465
+ "plan": {
3466
+ "name": "plan",
3467
+ "type": "text",
3468
+ "primaryKey": false,
3469
+ "notNull": false,
3470
+ "autoincrement": false,
3471
+ "default": "'free'"
3472
+ },
3473
+ "settings": {
3474
+ "name": "settings",
3475
+ "type": "text",
3476
+ "primaryKey": false,
3477
+ "notNull": false,
3478
+ "autoincrement": false
3479
+ },
3480
+ "business_model": {
3481
+ "name": "business_model",
3482
+ "type": "text",
3483
+ "primaryKey": false,
3484
+ "notNull": false,
3485
+ "autoincrement": false
3486
+ },
3487
+ "created_at": {
3488
+ "name": "created_at",
3489
+ "type": "integer",
3490
+ "primaryKey": false,
3491
+ "notNull": false,
3492
+ "autoincrement": false
3493
+ },
3494
+ "archived_at": {
3495
+ "name": "archived_at",
3496
+ "type": "integer",
3497
+ "primaryKey": false,
3498
+ "notNull": false,
3499
+ "autoincrement": false
3500
+ },
3501
+ "public_host": {
3502
+ "name": "public_host",
3503
+ "type": "text",
3504
+ "primaryKey": false,
3505
+ "notNull": false,
3506
+ "autoincrement": false
3507
+ },
3508
+ "locale": {
3509
+ "name": "locale",
3510
+ "type": "text",
3511
+ "primaryKey": false,
3512
+ "notNull": false,
3513
+ "autoincrement": false
3514
+ },
3515
+ "config_version": {
3516
+ "name": "config_version",
3517
+ "type": "integer",
3518
+ "primaryKey": false,
3519
+ "notNull": true,
3520
+ "autoincrement": false,
3521
+ "default": 0
3522
+ }
3523
+ },
3524
+ "indexes": {
3525
+ "tenants_slug_unique": {
3526
+ "name": "tenants_slug_unique",
3527
+ "columns": [
3528
+ "slug"
3529
+ ],
3530
+ "isUnique": true
3531
+ },
3532
+ "uq_tenants_public_host": {
3533
+ "name": "uq_tenants_public_host",
3534
+ "columns": [
3535
+ "public_host"
3536
+ ],
3537
+ "isUnique": true,
3538
+ "where": "public_host IS NOT NULL"
3539
+ }
3540
+ },
3541
+ "foreignKeys": {},
3542
+ "compositePrimaryKeys": {},
3543
+ "uniqueConstraints": {},
3544
+ "checkConstraints": {}
3545
+ },
3546
+ "topics": {
3547
+ "name": "topics",
3548
+ "columns": {
3549
+ "id": {
3550
+ "name": "id",
3551
+ "type": "text",
3552
+ "primaryKey": true,
3553
+ "notNull": true,
3554
+ "autoincrement": false
3555
+ },
3556
+ "tenant_id": {
3557
+ "name": "tenant_id",
3558
+ "type": "text",
3559
+ "primaryKey": false,
3560
+ "notNull": true,
3561
+ "autoincrement": false
3562
+ },
3563
+ "slug": {
3564
+ "name": "slug",
3565
+ "type": "text",
3566
+ "primaryKey": false,
3567
+ "notNull": true,
3568
+ "autoincrement": false
3569
+ },
3570
+ "name": {
3571
+ "name": "name",
3572
+ "type": "text",
3573
+ "primaryKey": false,
3574
+ "notNull": true,
3575
+ "autoincrement": false
3576
+ },
3577
+ "kind": {
3578
+ "name": "kind",
3579
+ "type": "text",
3580
+ "primaryKey": false,
3581
+ "notNull": true,
3582
+ "autoincrement": false
3583
+ },
3584
+ "description": {
3585
+ "name": "description",
3586
+ "type": "text",
3587
+ "primaryKey": false,
3588
+ "notNull": false,
3589
+ "autoincrement": false
3590
+ },
3591
+ "default_subscribed": {
3592
+ "name": "default_subscribed",
3593
+ "type": "integer",
3594
+ "primaryKey": false,
3595
+ "notNull": true,
3596
+ "autoincrement": false,
3597
+ "default": true
3598
+ },
3599
+ "mirror_only": {
3600
+ "name": "mirror_only",
3601
+ "type": "integer",
3602
+ "primaryKey": false,
3603
+ "notNull": true,
3604
+ "autoincrement": false,
3605
+ "default": false
3606
+ },
3607
+ "created_at": {
3608
+ "name": "created_at",
3609
+ "type": "integer",
3610
+ "primaryKey": false,
3611
+ "notNull": false,
3612
+ "autoincrement": false
3613
+ }
3614
+ },
3615
+ "indexes": {
3616
+ "uq_topics_tenant_slug": {
3617
+ "name": "uq_topics_tenant_slug",
3618
+ "columns": [
3619
+ "tenant_id",
3620
+ "slug"
3621
+ ],
3622
+ "isUnique": true
3623
+ }
3624
+ },
3625
+ "foreignKeys": {
3626
+ "topics_tenant_id_tenants_id_fk": {
3627
+ "name": "topics_tenant_id_tenants_id_fk",
3628
+ "tableFrom": "topics",
3629
+ "tableTo": "tenants",
3630
+ "columnsFrom": [
3631
+ "tenant_id"
3632
+ ],
3633
+ "columnsTo": [
3634
+ "id"
3635
+ ],
3636
+ "onDelete": "no action",
3637
+ "onUpdate": "no action"
3638
+ }
3639
+ },
3640
+ "compositePrimaryKeys": {},
3641
+ "uniqueConstraints": {},
3642
+ "checkConstraints": {}
3643
+ },
3644
+ "transport_configs": {
3645
+ "name": "transport_configs",
3646
+ "columns": {
3647
+ "id": {
3648
+ "name": "id",
3649
+ "type": "text",
3650
+ "primaryKey": true,
3651
+ "notNull": true,
3652
+ "autoincrement": false
3653
+ },
3654
+ "tenant_id": {
3655
+ "name": "tenant_id",
3656
+ "type": "text",
3657
+ "primaryKey": false,
3658
+ "notNull": true,
3659
+ "autoincrement": false
3660
+ },
3661
+ "provider": {
3662
+ "name": "provider",
3663
+ "type": "text",
3664
+ "primaryKey": false,
3665
+ "notNull": true,
3666
+ "autoincrement": false
3667
+ },
3668
+ "config": {
3669
+ "name": "config",
3670
+ "type": "text",
3671
+ "primaryKey": false,
3672
+ "notNull": true,
3673
+ "autoincrement": false
3674
+ },
3675
+ "is_active": {
3676
+ "name": "is_active",
3677
+ "type": "integer",
3678
+ "primaryKey": false,
3679
+ "notNull": false,
3680
+ "autoincrement": false,
3681
+ "default": true
3682
+ },
3683
+ "dkim_verified": {
3684
+ "name": "dkim_verified",
3685
+ "type": "integer",
3686
+ "primaryKey": false,
3687
+ "notNull": false,
3688
+ "autoincrement": false,
3689
+ "default": false
3690
+ },
3691
+ "from_email": {
3692
+ "name": "from_email",
3693
+ "type": "text",
3694
+ "primaryKey": false,
3695
+ "notNull": true,
3696
+ "autoincrement": false
3697
+ },
3698
+ "from_name": {
3699
+ "name": "from_name",
3700
+ "type": "text",
3701
+ "primaryKey": false,
3702
+ "notNull": false,
3703
+ "autoincrement": false
3704
+ },
3705
+ "daily_limit": {
3706
+ "name": "daily_limit",
3707
+ "type": "integer",
3708
+ "primaryKey": false,
3709
+ "notNull": false,
3710
+ "autoincrement": false
3711
+ },
3712
+ "kind": {
3713
+ "name": "kind",
3714
+ "type": "text",
3715
+ "primaryKey": false,
3716
+ "notNull": false,
3717
+ "autoincrement": false
3718
+ },
3719
+ "name": {
3720
+ "name": "name",
3721
+ "type": "text",
3722
+ "primaryKey": false,
3723
+ "notNull": false,
3724
+ "autoincrement": false
3725
+ },
3726
+ "reply_to": {
3727
+ "name": "reply_to",
3728
+ "type": "text",
3729
+ "primaryKey": false,
3730
+ "notNull": false,
3731
+ "autoincrement": false
3732
+ },
3733
+ "created_at": {
3734
+ "name": "created_at",
3735
+ "type": "integer",
3736
+ "primaryKey": false,
3737
+ "notNull": false,
3738
+ "autoincrement": false
3739
+ }
3740
+ },
3741
+ "indexes": {},
3742
+ "foreignKeys": {
3743
+ "transport_configs_tenant_id_tenants_id_fk": {
3744
+ "name": "transport_configs_tenant_id_tenants_id_fk",
3745
+ "tableFrom": "transport_configs",
3746
+ "tableTo": "tenants",
3747
+ "columnsFrom": [
3748
+ "tenant_id"
3749
+ ],
3750
+ "columnsTo": [
3751
+ "id"
3752
+ ],
3753
+ "onDelete": "no action",
3754
+ "onUpdate": "no action"
3755
+ }
3756
+ },
3757
+ "compositePrimaryKeys": {},
3758
+ "uniqueConstraints": {},
3759
+ "checkConstraints": {}
3760
+ },
3761
+ "users": {
3762
+ "name": "users",
3763
+ "columns": {
3764
+ "id": {
3765
+ "name": "id",
3766
+ "type": "text",
3767
+ "primaryKey": true,
3768
+ "notNull": true,
3769
+ "autoincrement": false
3770
+ },
3771
+ "tenant_id": {
3772
+ "name": "tenant_id",
3773
+ "type": "text",
3774
+ "primaryKey": false,
3775
+ "notNull": true,
3776
+ "autoincrement": false
3777
+ },
3778
+ "email": {
3779
+ "name": "email",
3780
+ "type": "text",
3781
+ "primaryKey": false,
3782
+ "notNull": true,
3783
+ "autoincrement": false
3784
+ },
3785
+ "name": {
3786
+ "name": "name",
3787
+ "type": "text",
3788
+ "primaryKey": false,
3789
+ "notNull": false,
3790
+ "autoincrement": false
3791
+ },
3792
+ "role": {
3793
+ "name": "role",
3794
+ "type": "text",
3795
+ "primaryKey": false,
3796
+ "notNull": true,
3797
+ "autoincrement": false,
3798
+ "default": "'member'"
3799
+ },
3800
+ "instance_role": {
3801
+ "name": "instance_role",
3802
+ "type": "text",
3803
+ "primaryKey": false,
3804
+ "notNull": false,
3805
+ "autoincrement": false
3806
+ },
3807
+ "last_login_at": {
3808
+ "name": "last_login_at",
3809
+ "type": "integer",
3810
+ "primaryKey": false,
3811
+ "notNull": false,
3812
+ "autoincrement": false
3813
+ },
3814
+ "deactivated_at": {
3815
+ "name": "deactivated_at",
3816
+ "type": "integer",
3817
+ "primaryKey": false,
3818
+ "notNull": false,
3819
+ "autoincrement": false
3820
+ },
3821
+ "pending_email": {
3822
+ "name": "pending_email",
3823
+ "type": "text",
3824
+ "primaryKey": false,
3825
+ "notNull": false,
3826
+ "autoincrement": false
3827
+ },
3828
+ "pending_email_token_hash": {
3829
+ "name": "pending_email_token_hash",
3830
+ "type": "text",
3831
+ "primaryKey": false,
3832
+ "notNull": false,
3833
+ "autoincrement": false
3834
+ },
3835
+ "pending_email_expires_at": {
3836
+ "name": "pending_email_expires_at",
3837
+ "type": "integer",
3838
+ "primaryKey": false,
3839
+ "notNull": false,
3840
+ "autoincrement": false
3841
+ },
3842
+ "created_at": {
3843
+ "name": "created_at",
3844
+ "type": "integer",
3845
+ "primaryKey": false,
3846
+ "notNull": false,
3847
+ "autoincrement": false
3848
+ }
3849
+ },
3850
+ "indexes": {
3851
+ "uq_users_tenant_email": {
3852
+ "name": "uq_users_tenant_email",
3853
+ "columns": [
3854
+ "tenant_id",
3855
+ "email"
3856
+ ],
3857
+ "isUnique": true
3858
+ }
3859
+ },
3860
+ "foreignKeys": {
3861
+ "users_tenant_id_tenants_id_fk": {
3862
+ "name": "users_tenant_id_tenants_id_fk",
3863
+ "tableFrom": "users",
3864
+ "tableTo": "tenants",
3865
+ "columnsFrom": [
3866
+ "tenant_id"
3867
+ ],
3868
+ "columnsTo": [
3869
+ "id"
3870
+ ],
3871
+ "onDelete": "no action",
3872
+ "onUpdate": "no action"
3873
+ }
3874
+ },
3875
+ "compositePrimaryKeys": {},
3876
+ "uniqueConstraints": {},
3877
+ "checkConstraints": {}
3878
+ },
3879
+ "webhook_endpoints": {
3880
+ "name": "webhook_endpoints",
3881
+ "columns": {
3882
+ "id": {
3883
+ "name": "id",
3884
+ "type": "text",
3885
+ "primaryKey": true,
3886
+ "notNull": true,
3887
+ "autoincrement": false
3888
+ },
3889
+ "tenant_id": {
3890
+ "name": "tenant_id",
3891
+ "type": "text",
3892
+ "primaryKey": false,
3893
+ "notNull": true,
3894
+ "autoincrement": false
3895
+ },
3896
+ "slug": {
3897
+ "name": "slug",
3898
+ "type": "text",
3899
+ "primaryKey": false,
3900
+ "notNull": true,
3901
+ "autoincrement": false
3902
+ },
3903
+ "kind": {
3904
+ "name": "kind",
3905
+ "type": "text",
3906
+ "primaryKey": false,
3907
+ "notNull": true,
3908
+ "autoincrement": false,
3909
+ "default": "'webhook'"
3910
+ },
3911
+ "url": {
3912
+ "name": "url",
3913
+ "type": "text",
3914
+ "primaryKey": false,
3915
+ "notNull": true,
3916
+ "autoincrement": false
3917
+ },
3918
+ "secret": {
3919
+ "name": "secret",
3920
+ "type": "text",
3921
+ "primaryKey": false,
3922
+ "notNull": false,
3923
+ "autoincrement": false
3924
+ },
3925
+ "events": {
3926
+ "name": "events",
3927
+ "type": "text",
3928
+ "primaryKey": false,
3929
+ "notNull": true,
3930
+ "autoincrement": false
3931
+ },
3932
+ "config": {
3933
+ "name": "config",
3934
+ "type": "text",
3935
+ "primaryKey": false,
3936
+ "notNull": false,
3937
+ "autoincrement": false
3938
+ },
3939
+ "enabled": {
3940
+ "name": "enabled",
3941
+ "type": "integer",
3942
+ "primaryKey": false,
3943
+ "notNull": true,
3944
+ "autoincrement": false,
3945
+ "default": true
3946
+ },
3947
+ "created_at": {
3948
+ "name": "created_at",
3949
+ "type": "integer",
3950
+ "primaryKey": false,
3951
+ "notNull": false,
3952
+ "autoincrement": false
3953
+ },
3954
+ "updated_at": {
3955
+ "name": "updated_at",
3956
+ "type": "integer",
3957
+ "primaryKey": false,
3958
+ "notNull": false,
3959
+ "autoincrement": false
3960
+ }
3961
+ },
3962
+ "indexes": {
3963
+ "uq_webhook_endpoints_tenant_slug": {
3964
+ "name": "uq_webhook_endpoints_tenant_slug",
3965
+ "columns": [
3966
+ "tenant_id",
3967
+ "slug"
3968
+ ],
3969
+ "isUnique": true
3970
+ }
3971
+ },
3972
+ "foreignKeys": {
3973
+ "webhook_endpoints_tenant_id_tenants_id_fk": {
3974
+ "name": "webhook_endpoints_tenant_id_tenants_id_fk",
3975
+ "tableFrom": "webhook_endpoints",
3976
+ "tableTo": "tenants",
3977
+ "columnsFrom": [
3978
+ "tenant_id"
3979
+ ],
3980
+ "columnsTo": [
3981
+ "id"
3982
+ ],
3983
+ "onDelete": "no action",
3984
+ "onUpdate": "no action"
3985
+ }
3986
+ },
3987
+ "compositePrimaryKeys": {},
3988
+ "uniqueConstraints": {},
3989
+ "checkConstraints": {}
3990
+ },
3991
+ "webhook_outbox": {
3992
+ "name": "webhook_outbox",
3993
+ "columns": {
3994
+ "id": {
3995
+ "name": "id",
3996
+ "type": "text",
3997
+ "primaryKey": true,
3998
+ "notNull": true,
3999
+ "autoincrement": false
4000
+ },
4001
+ "tenant_id": {
4002
+ "name": "tenant_id",
4003
+ "type": "text",
4004
+ "primaryKey": false,
4005
+ "notNull": true,
4006
+ "autoincrement": false
4007
+ },
4008
+ "endpoint_id": {
4009
+ "name": "endpoint_id",
4010
+ "type": "text",
4011
+ "primaryKey": false,
4012
+ "notNull": true,
4013
+ "autoincrement": false
4014
+ },
4015
+ "event": {
4016
+ "name": "event",
4017
+ "type": "text",
4018
+ "primaryKey": false,
4019
+ "notNull": true,
4020
+ "autoincrement": false
4021
+ },
4022
+ "payload": {
4023
+ "name": "payload",
4024
+ "type": "text",
4025
+ "primaryKey": false,
4026
+ "notNull": true,
4027
+ "autoincrement": false
4028
+ },
4029
+ "status": {
4030
+ "name": "status",
4031
+ "type": "text",
4032
+ "primaryKey": false,
4033
+ "notNull": true,
4034
+ "autoincrement": false,
4035
+ "default": "'pending'"
4036
+ },
4037
+ "attempts": {
4038
+ "name": "attempts",
4039
+ "type": "integer",
4040
+ "primaryKey": false,
4041
+ "notNull": true,
4042
+ "autoincrement": false,
4043
+ "default": 0
4044
+ },
4045
+ "next_attempt_at": {
4046
+ "name": "next_attempt_at",
4047
+ "type": "integer",
4048
+ "primaryKey": false,
4049
+ "notNull": true,
4050
+ "autoincrement": false
4051
+ },
4052
+ "last_error": {
4053
+ "name": "last_error",
4054
+ "type": "text",
4055
+ "primaryKey": false,
4056
+ "notNull": false,
4057
+ "autoincrement": false
4058
+ },
4059
+ "dedup_key": {
4060
+ "name": "dedup_key",
4061
+ "type": "text",
4062
+ "primaryKey": false,
4063
+ "notNull": false,
4064
+ "autoincrement": false
4065
+ },
4066
+ "created_at": {
4067
+ "name": "created_at",
4068
+ "type": "integer",
4069
+ "primaryKey": false,
4070
+ "notNull": true,
4071
+ "autoincrement": false
4072
+ },
4073
+ "delivered_at": {
4074
+ "name": "delivered_at",
4075
+ "type": "integer",
4076
+ "primaryKey": false,
4077
+ "notNull": false,
4078
+ "autoincrement": false
4079
+ }
4080
+ },
4081
+ "indexes": {
4082
+ "idx_webhook_outbox_due": {
4083
+ "name": "idx_webhook_outbox_due",
4084
+ "columns": [
4085
+ "tenant_id",
4086
+ "next_attempt_at"
4087
+ ],
4088
+ "isUnique": false,
4089
+ "where": "status = 'pending'"
4090
+ },
4091
+ "idx_webhook_outbox_tenant_event": {
4092
+ "name": "idx_webhook_outbox_tenant_event",
4093
+ "columns": [
4094
+ "tenant_id",
4095
+ "event",
4096
+ "created_at"
4097
+ ],
4098
+ "isUnique": false
4099
+ },
4100
+ "uq_webhook_outbox_dedup": {
4101
+ "name": "uq_webhook_outbox_dedup",
4102
+ "columns": [
4103
+ "tenant_id",
4104
+ "endpoint_id",
4105
+ "dedup_key"
4106
+ ],
4107
+ "isUnique": true,
4108
+ "where": "dedup_key IS NOT NULL"
4109
+ }
4110
+ },
4111
+ "foreignKeys": {
4112
+ "webhook_outbox_tenant_id_tenants_id_fk": {
4113
+ "name": "webhook_outbox_tenant_id_tenants_id_fk",
4114
+ "tableFrom": "webhook_outbox",
4115
+ "tableTo": "tenants",
4116
+ "columnsFrom": [
4117
+ "tenant_id"
4118
+ ],
4119
+ "columnsTo": [
4120
+ "id"
4121
+ ],
4122
+ "onDelete": "no action",
4123
+ "onUpdate": "no action"
4124
+ }
4125
+ },
4126
+ "compositePrimaryKeys": {},
4127
+ "uniqueConstraints": {},
4128
+ "checkConstraints": {}
4129
+ }
4130
+ },
4131
+ "views": {},
4132
+ "enums": {},
4133
+ "_meta": {
4134
+ "schemas": {},
4135
+ "tables": {},
4136
+ "columns": {}
4137
+ },
4138
+ "internal": {
4139
+ "indexes": {}
4140
+ }
4141
+ }