@hogsend/db 0.22.0 → 0.23.0

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