@hogsend/db 0.12.2 → 0.13.1

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,3652 @@
1
+ {
2
+ "id": "e0707908-42ce-47ff-9b57-a79a1e7ce46f",
3
+ "prevId": "9be95e13-cfe3-46d2-9943-ad7bd6241595",
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.contact_aliases": {
1613
+ "name": "contact_aliases",
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
+ "contact_id": {
1624
+ "name": "contact_id",
1625
+ "type": "uuid",
1626
+ "primaryKey": false,
1627
+ "notNull": true
1628
+ },
1629
+ "alias_kind": {
1630
+ "name": "alias_kind",
1631
+ "type": "text",
1632
+ "primaryKey": false,
1633
+ "notNull": true
1634
+ },
1635
+ "alias_value": {
1636
+ "name": "alias_value",
1637
+ "type": "text",
1638
+ "primaryKey": false,
1639
+ "notNull": true
1640
+ },
1641
+ "from_contact_id": {
1642
+ "name": "from_contact_id",
1643
+ "type": "uuid",
1644
+ "primaryKey": false,
1645
+ "notNull": false
1646
+ },
1647
+ "reason": {
1648
+ "name": "reason",
1649
+ "type": "text",
1650
+ "primaryKey": false,
1651
+ "notNull": true
1652
+ },
1653
+ "created_at": {
1654
+ "name": "created_at",
1655
+ "type": "timestamp with time zone",
1656
+ "primaryKey": false,
1657
+ "notNull": true,
1658
+ "default": "now()"
1659
+ },
1660
+ "updated_at": {
1661
+ "name": "updated_at",
1662
+ "type": "timestamp with time zone",
1663
+ "primaryKey": false,
1664
+ "notNull": true,
1665
+ "default": "now()"
1666
+ }
1667
+ },
1668
+ "indexes": {
1669
+ "contact_aliases_kind_value_idx": {
1670
+ "name": "contact_aliases_kind_value_idx",
1671
+ "columns": [
1672
+ {
1673
+ "expression": "alias_kind",
1674
+ "isExpression": false,
1675
+ "asc": true,
1676
+ "nulls": "last"
1677
+ },
1678
+ {
1679
+ "expression": "alias_value",
1680
+ "isExpression": false,
1681
+ "asc": true,
1682
+ "nulls": "last"
1683
+ }
1684
+ ],
1685
+ "isUnique": true,
1686
+ "concurrently": false,
1687
+ "method": "btree",
1688
+ "with": {}
1689
+ },
1690
+ "contact_aliases_contact_id_idx": {
1691
+ "name": "contact_aliases_contact_id_idx",
1692
+ "columns": [
1693
+ {
1694
+ "expression": "contact_id",
1695
+ "isExpression": false,
1696
+ "asc": true,
1697
+ "nulls": "last"
1698
+ }
1699
+ ],
1700
+ "isUnique": false,
1701
+ "concurrently": false,
1702
+ "method": "btree",
1703
+ "with": {}
1704
+ }
1705
+ },
1706
+ "foreignKeys": {
1707
+ "contact_aliases_contact_id_contacts_id_fk": {
1708
+ "name": "contact_aliases_contact_id_contacts_id_fk",
1709
+ "tableFrom": "contact_aliases",
1710
+ "tableTo": "contacts",
1711
+ "columnsFrom": [
1712
+ "contact_id"
1713
+ ],
1714
+ "columnsTo": [
1715
+ "id"
1716
+ ],
1717
+ "onDelete": "cascade",
1718
+ "onUpdate": "no action"
1719
+ }
1720
+ },
1721
+ "compositePrimaryKeys": {},
1722
+ "uniqueConstraints": {},
1723
+ "policies": {},
1724
+ "checkConstraints": {},
1725
+ "isRLSEnabled": false
1726
+ },
1727
+ "public.contacts": {
1728
+ "name": "contacts",
1729
+ "schema": "",
1730
+ "columns": {
1731
+ "id": {
1732
+ "name": "id",
1733
+ "type": "uuid",
1734
+ "primaryKey": true,
1735
+ "notNull": true,
1736
+ "default": "gen_random_uuid()"
1737
+ },
1738
+ "organization_id": {
1739
+ "name": "organization_id",
1740
+ "type": "text",
1741
+ "primaryKey": false,
1742
+ "notNull": false
1743
+ },
1744
+ "external_id": {
1745
+ "name": "external_id",
1746
+ "type": "text",
1747
+ "primaryKey": false,
1748
+ "notNull": false
1749
+ },
1750
+ "email": {
1751
+ "name": "email",
1752
+ "type": "text",
1753
+ "primaryKey": false,
1754
+ "notNull": false
1755
+ },
1756
+ "anonymous_id": {
1757
+ "name": "anonymous_id",
1758
+ "type": "text",
1759
+ "primaryKey": false,
1760
+ "notNull": false
1761
+ },
1762
+ "timezone": {
1763
+ "name": "timezone",
1764
+ "type": "text",
1765
+ "primaryKey": false,
1766
+ "notNull": false
1767
+ },
1768
+ "properties": {
1769
+ "name": "properties",
1770
+ "type": "jsonb",
1771
+ "primaryKey": false,
1772
+ "notNull": false,
1773
+ "default": "'{}'::jsonb"
1774
+ },
1775
+ "first_seen_at": {
1776
+ "name": "first_seen_at",
1777
+ "type": "timestamp with time zone",
1778
+ "primaryKey": false,
1779
+ "notNull": true,
1780
+ "default": "now()"
1781
+ },
1782
+ "last_seen_at": {
1783
+ "name": "last_seen_at",
1784
+ "type": "timestamp with time zone",
1785
+ "primaryKey": false,
1786
+ "notNull": true,
1787
+ "default": "now()"
1788
+ },
1789
+ "deleted_at": {
1790
+ "name": "deleted_at",
1791
+ "type": "timestamp with time zone",
1792
+ "primaryKey": false,
1793
+ "notNull": false
1794
+ },
1795
+ "created_at": {
1796
+ "name": "created_at",
1797
+ "type": "timestamp with time zone",
1798
+ "primaryKey": false,
1799
+ "notNull": true,
1800
+ "default": "now()"
1801
+ },
1802
+ "updated_at": {
1803
+ "name": "updated_at",
1804
+ "type": "timestamp with time zone",
1805
+ "primaryKey": false,
1806
+ "notNull": true,
1807
+ "default": "now()"
1808
+ }
1809
+ },
1810
+ "indexes": {
1811
+ "contacts_email_idx": {
1812
+ "name": "contacts_email_idx",
1813
+ "columns": [
1814
+ {
1815
+ "expression": "email",
1816
+ "isExpression": false,
1817
+ "asc": true,
1818
+ "nulls": "last"
1819
+ }
1820
+ ],
1821
+ "isUnique": false,
1822
+ "concurrently": false,
1823
+ "method": "btree",
1824
+ "with": {}
1825
+ },
1826
+ "contacts_external_id_unique_idx": {
1827
+ "name": "contacts_external_id_unique_idx",
1828
+ "columns": [
1829
+ {
1830
+ "expression": "external_id",
1831
+ "isExpression": false,
1832
+ "asc": true,
1833
+ "nulls": "last"
1834
+ }
1835
+ ],
1836
+ "isUnique": true,
1837
+ "where": "external_id IS NOT NULL AND deleted_at IS NULL",
1838
+ "concurrently": false,
1839
+ "method": "btree",
1840
+ "with": {}
1841
+ },
1842
+ "contacts_email_unique_idx": {
1843
+ "name": "contacts_email_unique_idx",
1844
+ "columns": [
1845
+ {
1846
+ "expression": "lower(email)",
1847
+ "asc": true,
1848
+ "isExpression": true,
1849
+ "nulls": "last"
1850
+ }
1851
+ ],
1852
+ "isUnique": true,
1853
+ "where": "email IS NOT NULL AND deleted_at IS NULL",
1854
+ "concurrently": false,
1855
+ "method": "btree",
1856
+ "with": {}
1857
+ },
1858
+ "contacts_anonymous_id_unique_idx": {
1859
+ "name": "contacts_anonymous_id_unique_idx",
1860
+ "columns": [
1861
+ {
1862
+ "expression": "anonymous_id",
1863
+ "isExpression": false,
1864
+ "asc": true,
1865
+ "nulls": "last"
1866
+ }
1867
+ ],
1868
+ "isUnique": true,
1869
+ "where": "anonymous_id IS NOT NULL AND deleted_at IS NULL",
1870
+ "concurrently": false,
1871
+ "method": "btree",
1872
+ "with": {}
1873
+ }
1874
+ },
1875
+ "foreignKeys": {},
1876
+ "compositePrimaryKeys": {},
1877
+ "uniqueConstraints": {},
1878
+ "policies": {},
1879
+ "checkConstraints": {},
1880
+ "isRLSEnabled": false
1881
+ },
1882
+ "public.dead_letter_queue": {
1883
+ "name": "dead_letter_queue",
1884
+ "schema": "",
1885
+ "columns": {
1886
+ "id": {
1887
+ "name": "id",
1888
+ "type": "uuid",
1889
+ "primaryKey": true,
1890
+ "notNull": true,
1891
+ "default": "gen_random_uuid()"
1892
+ },
1893
+ "source": {
1894
+ "name": "source",
1895
+ "type": "text",
1896
+ "primaryKey": false,
1897
+ "notNull": true
1898
+ },
1899
+ "source_id": {
1900
+ "name": "source_id",
1901
+ "type": "text",
1902
+ "primaryKey": false,
1903
+ "notNull": false
1904
+ },
1905
+ "payload": {
1906
+ "name": "payload",
1907
+ "type": "jsonb",
1908
+ "primaryKey": false,
1909
+ "notNull": true
1910
+ },
1911
+ "error": {
1912
+ "name": "error",
1913
+ "type": "text",
1914
+ "primaryKey": false,
1915
+ "notNull": true
1916
+ },
1917
+ "retry_count": {
1918
+ "name": "retry_count",
1919
+ "type": "integer",
1920
+ "primaryKey": false,
1921
+ "notNull": true,
1922
+ "default": 0
1923
+ },
1924
+ "status": {
1925
+ "name": "status",
1926
+ "type": "dlq_status",
1927
+ "typeSchema": "public",
1928
+ "primaryKey": false,
1929
+ "notNull": true,
1930
+ "default": "'pending'"
1931
+ },
1932
+ "retried_at": {
1933
+ "name": "retried_at",
1934
+ "type": "timestamp with time zone",
1935
+ "primaryKey": false,
1936
+ "notNull": false
1937
+ },
1938
+ "created_at": {
1939
+ "name": "created_at",
1940
+ "type": "timestamp with time zone",
1941
+ "primaryKey": false,
1942
+ "notNull": true,
1943
+ "default": "now()"
1944
+ },
1945
+ "updated_at": {
1946
+ "name": "updated_at",
1947
+ "type": "timestamp with time zone",
1948
+ "primaryKey": false,
1949
+ "notNull": true,
1950
+ "default": "now()"
1951
+ }
1952
+ },
1953
+ "indexes": {
1954
+ "dlq_source_idx": {
1955
+ "name": "dlq_source_idx",
1956
+ "columns": [
1957
+ {
1958
+ "expression": "source",
1959
+ "isExpression": false,
1960
+ "asc": true,
1961
+ "nulls": "last"
1962
+ }
1963
+ ],
1964
+ "isUnique": false,
1965
+ "concurrently": false,
1966
+ "method": "btree",
1967
+ "with": {}
1968
+ },
1969
+ "dlq_status_idx": {
1970
+ "name": "dlq_status_idx",
1971
+ "columns": [
1972
+ {
1973
+ "expression": "status",
1974
+ "isExpression": false,
1975
+ "asc": true,
1976
+ "nulls": "last"
1977
+ }
1978
+ ],
1979
+ "isUnique": false,
1980
+ "concurrently": false,
1981
+ "method": "btree",
1982
+ "with": {}
1983
+ },
1984
+ "dlq_created_at_idx": {
1985
+ "name": "dlq_created_at_idx",
1986
+ "columns": [
1987
+ {
1988
+ "expression": "created_at",
1989
+ "isExpression": false,
1990
+ "asc": true,
1991
+ "nulls": "last"
1992
+ }
1993
+ ],
1994
+ "isUnique": false,
1995
+ "concurrently": false,
1996
+ "method": "btree",
1997
+ "with": {}
1998
+ }
1999
+ },
2000
+ "foreignKeys": {},
2001
+ "compositePrimaryKeys": {},
2002
+ "uniqueConstraints": {},
2003
+ "policies": {},
2004
+ "checkConstraints": {},
2005
+ "isRLSEnabled": false
2006
+ },
2007
+ "public.email_preferences": {
2008
+ "name": "email_preferences",
2009
+ "schema": "",
2010
+ "columns": {
2011
+ "id": {
2012
+ "name": "id",
2013
+ "type": "uuid",
2014
+ "primaryKey": true,
2015
+ "notNull": true,
2016
+ "default": "gen_random_uuid()"
2017
+ },
2018
+ "user_id": {
2019
+ "name": "user_id",
2020
+ "type": "text",
2021
+ "primaryKey": false,
2022
+ "notNull": true
2023
+ },
2024
+ "email": {
2025
+ "name": "email",
2026
+ "type": "text",
2027
+ "primaryKey": false,
2028
+ "notNull": true
2029
+ },
2030
+ "unsubscribed_all": {
2031
+ "name": "unsubscribed_all",
2032
+ "type": "boolean",
2033
+ "primaryKey": false,
2034
+ "notNull": true,
2035
+ "default": false
2036
+ },
2037
+ "suppressed": {
2038
+ "name": "suppressed",
2039
+ "type": "boolean",
2040
+ "primaryKey": false,
2041
+ "notNull": true,
2042
+ "default": false
2043
+ },
2044
+ "bounce_count": {
2045
+ "name": "bounce_count",
2046
+ "type": "integer",
2047
+ "primaryKey": false,
2048
+ "notNull": true,
2049
+ "default": 0
2050
+ },
2051
+ "categories": {
2052
+ "name": "categories",
2053
+ "type": "jsonb",
2054
+ "primaryKey": false,
2055
+ "notNull": false,
2056
+ "default": "'{}'::jsonb"
2057
+ },
2058
+ "suppressed_at": {
2059
+ "name": "suppressed_at",
2060
+ "type": "timestamp with time zone",
2061
+ "primaryKey": false,
2062
+ "notNull": false
2063
+ },
2064
+ "last_bounce_at": {
2065
+ "name": "last_bounce_at",
2066
+ "type": "timestamp with time zone",
2067
+ "primaryKey": false,
2068
+ "notNull": false
2069
+ },
2070
+ "created_at": {
2071
+ "name": "created_at",
2072
+ "type": "timestamp with time zone",
2073
+ "primaryKey": false,
2074
+ "notNull": true,
2075
+ "default": "now()"
2076
+ },
2077
+ "updated_at": {
2078
+ "name": "updated_at",
2079
+ "type": "timestamp with time zone",
2080
+ "primaryKey": false,
2081
+ "notNull": true,
2082
+ "default": "now()"
2083
+ }
2084
+ },
2085
+ "indexes": {
2086
+ "email_preferences_user_email_idx": {
2087
+ "name": "email_preferences_user_email_idx",
2088
+ "columns": [
2089
+ {
2090
+ "expression": "user_id",
2091
+ "isExpression": false,
2092
+ "asc": true,
2093
+ "nulls": "last"
2094
+ },
2095
+ {
2096
+ "expression": "email",
2097
+ "isExpression": false,
2098
+ "asc": true,
2099
+ "nulls": "last"
2100
+ }
2101
+ ],
2102
+ "isUnique": true,
2103
+ "concurrently": false,
2104
+ "method": "btree",
2105
+ "with": {}
2106
+ }
2107
+ },
2108
+ "foreignKeys": {},
2109
+ "compositePrimaryKeys": {},
2110
+ "uniqueConstraints": {},
2111
+ "policies": {},
2112
+ "checkConstraints": {},
2113
+ "isRLSEnabled": false
2114
+ },
2115
+ "public.email_sends": {
2116
+ "name": "email_sends",
2117
+ "schema": "",
2118
+ "columns": {
2119
+ "id": {
2120
+ "name": "id",
2121
+ "type": "uuid",
2122
+ "primaryKey": true,
2123
+ "notNull": true,
2124
+ "default": "gen_random_uuid()"
2125
+ },
2126
+ "organization_id": {
2127
+ "name": "organization_id",
2128
+ "type": "text",
2129
+ "primaryKey": false,
2130
+ "notNull": false
2131
+ },
2132
+ "journey_state_id": {
2133
+ "name": "journey_state_id",
2134
+ "type": "uuid",
2135
+ "primaryKey": false,
2136
+ "notNull": false
2137
+ },
2138
+ "user_id": {
2139
+ "name": "user_id",
2140
+ "type": "text",
2141
+ "primaryKey": false,
2142
+ "notNull": false
2143
+ },
2144
+ "user_email": {
2145
+ "name": "user_email",
2146
+ "type": "text",
2147
+ "primaryKey": false,
2148
+ "notNull": false
2149
+ },
2150
+ "template_key": {
2151
+ "name": "template_key",
2152
+ "type": "text",
2153
+ "primaryKey": false,
2154
+ "notNull": false
2155
+ },
2156
+ "message_id": {
2157
+ "name": "message_id",
2158
+ "type": "text",
2159
+ "primaryKey": false,
2160
+ "notNull": false
2161
+ },
2162
+ "from_email": {
2163
+ "name": "from_email",
2164
+ "type": "text",
2165
+ "primaryKey": false,
2166
+ "notNull": true
2167
+ },
2168
+ "to_email": {
2169
+ "name": "to_email",
2170
+ "type": "text",
2171
+ "primaryKey": false,
2172
+ "notNull": true
2173
+ },
2174
+ "subject": {
2175
+ "name": "subject",
2176
+ "type": "text",
2177
+ "primaryKey": false,
2178
+ "notNull": true
2179
+ },
2180
+ "category": {
2181
+ "name": "category",
2182
+ "type": "text",
2183
+ "primaryKey": false,
2184
+ "notNull": false
2185
+ },
2186
+ "status": {
2187
+ "name": "status",
2188
+ "type": "email_send_status",
2189
+ "typeSchema": "public",
2190
+ "primaryKey": false,
2191
+ "notNull": true,
2192
+ "default": "'queued'"
2193
+ },
2194
+ "sent_at": {
2195
+ "name": "sent_at",
2196
+ "type": "timestamp with time zone",
2197
+ "primaryKey": false,
2198
+ "notNull": false
2199
+ },
2200
+ "delivered_at": {
2201
+ "name": "delivered_at",
2202
+ "type": "timestamp with time zone",
2203
+ "primaryKey": false,
2204
+ "notNull": false
2205
+ },
2206
+ "opened_at": {
2207
+ "name": "opened_at",
2208
+ "type": "timestamp with time zone",
2209
+ "primaryKey": false,
2210
+ "notNull": false
2211
+ },
2212
+ "clicked_at": {
2213
+ "name": "clicked_at",
2214
+ "type": "timestamp with time zone",
2215
+ "primaryKey": false,
2216
+ "notNull": false
2217
+ },
2218
+ "bounced_at": {
2219
+ "name": "bounced_at",
2220
+ "type": "timestamp with time zone",
2221
+ "primaryKey": false,
2222
+ "notNull": false
2223
+ },
2224
+ "complained_at": {
2225
+ "name": "complained_at",
2226
+ "type": "timestamp with time zone",
2227
+ "primaryKey": false,
2228
+ "notNull": false
2229
+ },
2230
+ "bounce_type": {
2231
+ "name": "bounce_type",
2232
+ "type": "text",
2233
+ "primaryKey": false,
2234
+ "notNull": false
2235
+ },
2236
+ "bounce_reason": {
2237
+ "name": "bounce_reason",
2238
+ "type": "text",
2239
+ "primaryKey": false,
2240
+ "notNull": false
2241
+ },
2242
+ "idempotency_key": {
2243
+ "name": "idempotency_key",
2244
+ "type": "text",
2245
+ "primaryKey": false,
2246
+ "notNull": false
2247
+ },
2248
+ "metadata": {
2249
+ "name": "metadata",
2250
+ "type": "jsonb",
2251
+ "primaryKey": false,
2252
+ "notNull": false
2253
+ },
2254
+ "created_at": {
2255
+ "name": "created_at",
2256
+ "type": "timestamp with time zone",
2257
+ "primaryKey": false,
2258
+ "notNull": true,
2259
+ "default": "now()"
2260
+ },
2261
+ "updated_at": {
2262
+ "name": "updated_at",
2263
+ "type": "timestamp with time zone",
2264
+ "primaryKey": false,
2265
+ "notNull": true,
2266
+ "default": "now()"
2267
+ }
2268
+ },
2269
+ "indexes": {
2270
+ "email_sends_to_email_idx": {
2271
+ "name": "email_sends_to_email_idx",
2272
+ "columns": [
2273
+ {
2274
+ "expression": "to_email",
2275
+ "isExpression": false,
2276
+ "asc": true,
2277
+ "nulls": "last"
2278
+ }
2279
+ ],
2280
+ "isUnique": false,
2281
+ "concurrently": false,
2282
+ "method": "btree",
2283
+ "with": {}
2284
+ },
2285
+ "email_sends_template_key_idx": {
2286
+ "name": "email_sends_template_key_idx",
2287
+ "columns": [
2288
+ {
2289
+ "expression": "template_key",
2290
+ "isExpression": false,
2291
+ "asc": true,
2292
+ "nulls": "last"
2293
+ }
2294
+ ],
2295
+ "isUnique": false,
2296
+ "concurrently": false,
2297
+ "method": "btree",
2298
+ "with": {}
2299
+ },
2300
+ "email_sends_status_idx": {
2301
+ "name": "email_sends_status_idx",
2302
+ "columns": [
2303
+ {
2304
+ "expression": "status",
2305
+ "isExpression": false,
2306
+ "asc": true,
2307
+ "nulls": "last"
2308
+ }
2309
+ ],
2310
+ "isUnique": false,
2311
+ "concurrently": false,
2312
+ "method": "btree",
2313
+ "with": {}
2314
+ },
2315
+ "email_sends_created_at_idx": {
2316
+ "name": "email_sends_created_at_idx",
2317
+ "columns": [
2318
+ {
2319
+ "expression": "created_at",
2320
+ "isExpression": false,
2321
+ "asc": true,
2322
+ "nulls": "last"
2323
+ }
2324
+ ],
2325
+ "isUnique": false,
2326
+ "concurrently": false,
2327
+ "method": "btree",
2328
+ "with": {}
2329
+ },
2330
+ "email_sends_journey_state_id_idx": {
2331
+ "name": "email_sends_journey_state_id_idx",
2332
+ "columns": [
2333
+ {
2334
+ "expression": "journey_state_id",
2335
+ "isExpression": false,
2336
+ "asc": true,
2337
+ "nulls": "last"
2338
+ }
2339
+ ],
2340
+ "isUnique": false,
2341
+ "concurrently": false,
2342
+ "method": "btree",
2343
+ "with": {}
2344
+ },
2345
+ "email_sends_user_id_idx": {
2346
+ "name": "email_sends_user_id_idx",
2347
+ "columns": [
2348
+ {
2349
+ "expression": "user_id",
2350
+ "isExpression": false,
2351
+ "asc": true,
2352
+ "nulls": "last"
2353
+ }
2354
+ ],
2355
+ "isUnique": false,
2356
+ "concurrently": false,
2357
+ "method": "btree",
2358
+ "with": {}
2359
+ },
2360
+ "email_sends_message_id_idx": {
2361
+ "name": "email_sends_message_id_idx",
2362
+ "columns": [
2363
+ {
2364
+ "expression": "message_id",
2365
+ "isExpression": false,
2366
+ "asc": true,
2367
+ "nulls": "last"
2368
+ }
2369
+ ],
2370
+ "isUnique": false,
2371
+ "concurrently": false,
2372
+ "method": "btree",
2373
+ "with": {}
2374
+ },
2375
+ "email_sends_freq_cap_idx": {
2376
+ "name": "email_sends_freq_cap_idx",
2377
+ "columns": [
2378
+ {
2379
+ "expression": "to_email",
2380
+ "isExpression": false,
2381
+ "asc": true,
2382
+ "nulls": "last"
2383
+ },
2384
+ {
2385
+ "expression": "created_at",
2386
+ "isExpression": false,
2387
+ "asc": true,
2388
+ "nulls": "last"
2389
+ },
2390
+ {
2391
+ "expression": "category",
2392
+ "isExpression": false,
2393
+ "asc": true,
2394
+ "nulls": "last"
2395
+ }
2396
+ ],
2397
+ "isUnique": false,
2398
+ "concurrently": false,
2399
+ "method": "btree",
2400
+ "with": {}
2401
+ },
2402
+ "email_sends_idempotency_key_idx": {
2403
+ "name": "email_sends_idempotency_key_idx",
2404
+ "columns": [
2405
+ {
2406
+ "expression": "idempotency_key",
2407
+ "isExpression": false,
2408
+ "asc": true,
2409
+ "nulls": "last"
2410
+ }
2411
+ ],
2412
+ "isUnique": true,
2413
+ "concurrently": false,
2414
+ "method": "btree",
2415
+ "with": {}
2416
+ }
2417
+ },
2418
+ "foreignKeys": {
2419
+ "email_sends_journey_state_id_journey_states_id_fk": {
2420
+ "name": "email_sends_journey_state_id_journey_states_id_fk",
2421
+ "tableFrom": "email_sends",
2422
+ "tableTo": "journey_states",
2423
+ "columnsFrom": [
2424
+ "journey_state_id"
2425
+ ],
2426
+ "columnsTo": [
2427
+ "id"
2428
+ ],
2429
+ "onDelete": "no action",
2430
+ "onUpdate": "no action"
2431
+ }
2432
+ },
2433
+ "compositePrimaryKeys": {},
2434
+ "uniqueConstraints": {},
2435
+ "policies": {},
2436
+ "checkConstraints": {},
2437
+ "isRLSEnabled": false
2438
+ },
2439
+ "public.import_jobs": {
2440
+ "name": "import_jobs",
2441
+ "schema": "",
2442
+ "columns": {
2443
+ "id": {
2444
+ "name": "id",
2445
+ "type": "uuid",
2446
+ "primaryKey": true,
2447
+ "notNull": true,
2448
+ "default": "gen_random_uuid()"
2449
+ },
2450
+ "file_name": {
2451
+ "name": "file_name",
2452
+ "type": "text",
2453
+ "primaryKey": false,
2454
+ "notNull": false
2455
+ },
2456
+ "format": {
2457
+ "name": "format",
2458
+ "type": "text",
2459
+ "primaryKey": false,
2460
+ "notNull": true
2461
+ },
2462
+ "status": {
2463
+ "name": "status",
2464
+ "type": "import_job_status",
2465
+ "typeSchema": "public",
2466
+ "primaryKey": false,
2467
+ "notNull": true,
2468
+ "default": "'pending'"
2469
+ },
2470
+ "total_rows": {
2471
+ "name": "total_rows",
2472
+ "type": "integer",
2473
+ "primaryKey": false,
2474
+ "notNull": false
2475
+ },
2476
+ "processed_rows": {
2477
+ "name": "processed_rows",
2478
+ "type": "integer",
2479
+ "primaryKey": false,
2480
+ "notNull": true,
2481
+ "default": 0
2482
+ },
2483
+ "failed_rows": {
2484
+ "name": "failed_rows",
2485
+ "type": "integer",
2486
+ "primaryKey": false,
2487
+ "notNull": true,
2488
+ "default": 0
2489
+ },
2490
+ "errors": {
2491
+ "name": "errors",
2492
+ "type": "jsonb",
2493
+ "primaryKey": false,
2494
+ "notNull": false
2495
+ },
2496
+ "created_at": {
2497
+ "name": "created_at",
2498
+ "type": "timestamp with time zone",
2499
+ "primaryKey": false,
2500
+ "notNull": true,
2501
+ "default": "now()"
2502
+ },
2503
+ "updated_at": {
2504
+ "name": "updated_at",
2505
+ "type": "timestamp with time zone",
2506
+ "primaryKey": false,
2507
+ "notNull": true,
2508
+ "default": "now()"
2509
+ }
2510
+ },
2511
+ "indexes": {
2512
+ "import_jobs_status_idx": {
2513
+ "name": "import_jobs_status_idx",
2514
+ "columns": [
2515
+ {
2516
+ "expression": "status",
2517
+ "isExpression": false,
2518
+ "asc": true,
2519
+ "nulls": "last"
2520
+ }
2521
+ ],
2522
+ "isUnique": false,
2523
+ "concurrently": false,
2524
+ "method": "btree",
2525
+ "with": {}
2526
+ }
2527
+ },
2528
+ "foreignKeys": {},
2529
+ "compositePrimaryKeys": {},
2530
+ "uniqueConstraints": {},
2531
+ "policies": {},
2532
+ "checkConstraints": {},
2533
+ "isRLSEnabled": false
2534
+ },
2535
+ "public.journey_configs": {
2536
+ "name": "journey_configs",
2537
+ "schema": "",
2538
+ "columns": {
2539
+ "id": {
2540
+ "name": "id",
2541
+ "type": "uuid",
2542
+ "primaryKey": true,
2543
+ "notNull": true,
2544
+ "default": "gen_random_uuid()"
2545
+ },
2546
+ "journey_id": {
2547
+ "name": "journey_id",
2548
+ "type": "text",
2549
+ "primaryKey": false,
2550
+ "notNull": true
2551
+ },
2552
+ "enabled": {
2553
+ "name": "enabled",
2554
+ "type": "boolean",
2555
+ "primaryKey": false,
2556
+ "notNull": true,
2557
+ "default": true
2558
+ },
2559
+ "created_at": {
2560
+ "name": "created_at",
2561
+ "type": "timestamp with time zone",
2562
+ "primaryKey": false,
2563
+ "notNull": true,
2564
+ "default": "now()"
2565
+ },
2566
+ "updated_at": {
2567
+ "name": "updated_at",
2568
+ "type": "timestamp with time zone",
2569
+ "primaryKey": false,
2570
+ "notNull": true,
2571
+ "default": "now()"
2572
+ }
2573
+ },
2574
+ "indexes": {
2575
+ "journey_configs_journey_id_idx": {
2576
+ "name": "journey_configs_journey_id_idx",
2577
+ "columns": [
2578
+ {
2579
+ "expression": "journey_id",
2580
+ "isExpression": false,
2581
+ "asc": true,
2582
+ "nulls": "last"
2583
+ }
2584
+ ],
2585
+ "isUnique": true,
2586
+ "concurrently": false,
2587
+ "method": "btree",
2588
+ "with": {}
2589
+ }
2590
+ },
2591
+ "foreignKeys": {},
2592
+ "compositePrimaryKeys": {},
2593
+ "uniqueConstraints": {},
2594
+ "policies": {},
2595
+ "checkConstraints": {},
2596
+ "isRLSEnabled": false
2597
+ },
2598
+ "public.journey_logs": {
2599
+ "name": "journey_logs",
2600
+ "schema": "",
2601
+ "columns": {
2602
+ "id": {
2603
+ "name": "id",
2604
+ "type": "uuid",
2605
+ "primaryKey": true,
2606
+ "notNull": true,
2607
+ "default": "gen_random_uuid()"
2608
+ },
2609
+ "journey_state_id": {
2610
+ "name": "journey_state_id",
2611
+ "type": "uuid",
2612
+ "primaryKey": false,
2613
+ "notNull": true
2614
+ },
2615
+ "from_node_id": {
2616
+ "name": "from_node_id",
2617
+ "type": "text",
2618
+ "primaryKey": false,
2619
+ "notNull": false
2620
+ },
2621
+ "to_node_id": {
2622
+ "name": "to_node_id",
2623
+ "type": "text",
2624
+ "primaryKey": false,
2625
+ "notNull": false
2626
+ },
2627
+ "action": {
2628
+ "name": "action",
2629
+ "type": "text",
2630
+ "primaryKey": false,
2631
+ "notNull": true
2632
+ },
2633
+ "detail": {
2634
+ "name": "detail",
2635
+ "type": "jsonb",
2636
+ "primaryKey": false,
2637
+ "notNull": false
2638
+ },
2639
+ "created_at": {
2640
+ "name": "created_at",
2641
+ "type": "timestamp with time zone",
2642
+ "primaryKey": false,
2643
+ "notNull": true,
2644
+ "default": "now()"
2645
+ },
2646
+ "updated_at": {
2647
+ "name": "updated_at",
2648
+ "type": "timestamp with time zone",
2649
+ "primaryKey": false,
2650
+ "notNull": true,
2651
+ "default": "now()"
2652
+ }
2653
+ },
2654
+ "indexes": {
2655
+ "journey_logs_journey_state_id_idx": {
2656
+ "name": "journey_logs_journey_state_id_idx",
2657
+ "columns": [
2658
+ {
2659
+ "expression": "journey_state_id",
2660
+ "isExpression": false,
2661
+ "asc": true,
2662
+ "nulls": "last"
2663
+ }
2664
+ ],
2665
+ "isUnique": false,
2666
+ "concurrently": false,
2667
+ "method": "btree",
2668
+ "with": {}
2669
+ }
2670
+ },
2671
+ "foreignKeys": {
2672
+ "journey_logs_journey_state_id_journey_states_id_fk": {
2673
+ "name": "journey_logs_journey_state_id_journey_states_id_fk",
2674
+ "tableFrom": "journey_logs",
2675
+ "tableTo": "journey_states",
2676
+ "columnsFrom": [
2677
+ "journey_state_id"
2678
+ ],
2679
+ "columnsTo": [
2680
+ "id"
2681
+ ],
2682
+ "onDelete": "cascade",
2683
+ "onUpdate": "no action"
2684
+ }
2685
+ },
2686
+ "compositePrimaryKeys": {},
2687
+ "uniqueConstraints": {},
2688
+ "policies": {},
2689
+ "checkConstraints": {},
2690
+ "isRLSEnabled": false
2691
+ },
2692
+ "public.journey_states": {
2693
+ "name": "journey_states",
2694
+ "schema": "",
2695
+ "columns": {
2696
+ "id": {
2697
+ "name": "id",
2698
+ "type": "uuid",
2699
+ "primaryKey": true,
2700
+ "notNull": true,
2701
+ "default": "gen_random_uuid()"
2702
+ },
2703
+ "organization_id": {
2704
+ "name": "organization_id",
2705
+ "type": "text",
2706
+ "primaryKey": false,
2707
+ "notNull": false
2708
+ },
2709
+ "user_id": {
2710
+ "name": "user_id",
2711
+ "type": "text",
2712
+ "primaryKey": false,
2713
+ "notNull": true
2714
+ },
2715
+ "user_email": {
2716
+ "name": "user_email",
2717
+ "type": "text",
2718
+ "primaryKey": false,
2719
+ "notNull": true
2720
+ },
2721
+ "journey_id": {
2722
+ "name": "journey_id",
2723
+ "type": "text",
2724
+ "primaryKey": false,
2725
+ "notNull": true
2726
+ },
2727
+ "current_node_id": {
2728
+ "name": "current_node_id",
2729
+ "type": "text",
2730
+ "primaryKey": false,
2731
+ "notNull": true
2732
+ },
2733
+ "status": {
2734
+ "name": "status",
2735
+ "type": "journey_status",
2736
+ "typeSchema": "public",
2737
+ "primaryKey": false,
2738
+ "notNull": true,
2739
+ "default": "'active'"
2740
+ },
2741
+ "hatchet_run_id": {
2742
+ "name": "hatchet_run_id",
2743
+ "type": "text",
2744
+ "primaryKey": false,
2745
+ "notNull": false
2746
+ },
2747
+ "context": {
2748
+ "name": "context",
2749
+ "type": "jsonb",
2750
+ "primaryKey": false,
2751
+ "notNull": false,
2752
+ "default": "'{}'::jsonb"
2753
+ },
2754
+ "error_message": {
2755
+ "name": "error_message",
2756
+ "type": "text",
2757
+ "primaryKey": false,
2758
+ "notNull": false
2759
+ },
2760
+ "entry_count": {
2761
+ "name": "entry_count",
2762
+ "type": "integer",
2763
+ "primaryKey": false,
2764
+ "notNull": true,
2765
+ "default": 1
2766
+ },
2767
+ "completed_at": {
2768
+ "name": "completed_at",
2769
+ "type": "timestamp with time zone",
2770
+ "primaryKey": false,
2771
+ "notNull": false
2772
+ },
2773
+ "exited_at": {
2774
+ "name": "exited_at",
2775
+ "type": "timestamp with time zone",
2776
+ "primaryKey": false,
2777
+ "notNull": false
2778
+ },
2779
+ "deleted_at": {
2780
+ "name": "deleted_at",
2781
+ "type": "timestamp with time zone",
2782
+ "primaryKey": false,
2783
+ "notNull": false
2784
+ },
2785
+ "created_at": {
2786
+ "name": "created_at",
2787
+ "type": "timestamp with time zone",
2788
+ "primaryKey": false,
2789
+ "notNull": true,
2790
+ "default": "now()"
2791
+ },
2792
+ "updated_at": {
2793
+ "name": "updated_at",
2794
+ "type": "timestamp with time zone",
2795
+ "primaryKey": false,
2796
+ "notNull": true,
2797
+ "default": "now()"
2798
+ }
2799
+ },
2800
+ "indexes": {
2801
+ "uq_user_journey_active": {
2802
+ "name": "uq_user_journey_active",
2803
+ "columns": [
2804
+ {
2805
+ "expression": "user_id",
2806
+ "isExpression": false,
2807
+ "asc": true,
2808
+ "nulls": "last"
2809
+ },
2810
+ {
2811
+ "expression": "journey_id",
2812
+ "isExpression": false,
2813
+ "asc": true,
2814
+ "nulls": "last"
2815
+ },
2816
+ {
2817
+ "expression": "status",
2818
+ "isExpression": false,
2819
+ "asc": true,
2820
+ "nulls": "last"
2821
+ }
2822
+ ],
2823
+ "isUnique": true,
2824
+ "concurrently": false,
2825
+ "method": "btree",
2826
+ "with": {}
2827
+ },
2828
+ "journey_states_status_idx": {
2829
+ "name": "journey_states_status_idx",
2830
+ "columns": [
2831
+ {
2832
+ "expression": "status",
2833
+ "isExpression": false,
2834
+ "asc": true,
2835
+ "nulls": "last"
2836
+ }
2837
+ ],
2838
+ "isUnique": false,
2839
+ "concurrently": false,
2840
+ "method": "btree",
2841
+ "with": {}
2842
+ },
2843
+ "journey_states_hatchet_run_idx": {
2844
+ "name": "journey_states_hatchet_run_idx",
2845
+ "columns": [
2846
+ {
2847
+ "expression": "hatchet_run_id",
2848
+ "isExpression": false,
2849
+ "asc": true,
2850
+ "nulls": "last"
2851
+ }
2852
+ ],
2853
+ "isUnique": false,
2854
+ "concurrently": false,
2855
+ "method": "btree",
2856
+ "with": {}
2857
+ },
2858
+ "journey_states_user_id_idx": {
2859
+ "name": "journey_states_user_id_idx",
2860
+ "columns": [
2861
+ {
2862
+ "expression": "user_id",
2863
+ "isExpression": false,
2864
+ "asc": true,
2865
+ "nulls": "last"
2866
+ }
2867
+ ],
2868
+ "isUnique": false,
2869
+ "concurrently": false,
2870
+ "method": "btree",
2871
+ "with": {}
2872
+ },
2873
+ "journey_states_journey_id_status_idx": {
2874
+ "name": "journey_states_journey_id_status_idx",
2875
+ "columns": [
2876
+ {
2877
+ "expression": "journey_id",
2878
+ "isExpression": false,
2879
+ "asc": true,
2880
+ "nulls": "last"
2881
+ },
2882
+ {
2883
+ "expression": "status",
2884
+ "isExpression": false,
2885
+ "asc": true,
2886
+ "nulls": "last"
2887
+ }
2888
+ ],
2889
+ "isUnique": false,
2890
+ "concurrently": false,
2891
+ "method": "btree",
2892
+ "with": {}
2893
+ },
2894
+ "journey_states_updated_at_idx": {
2895
+ "name": "journey_states_updated_at_idx",
2896
+ "columns": [
2897
+ {
2898
+ "expression": "updated_at",
2899
+ "isExpression": false,
2900
+ "asc": true,
2901
+ "nulls": "last"
2902
+ }
2903
+ ],
2904
+ "isUnique": false,
2905
+ "concurrently": false,
2906
+ "method": "btree",
2907
+ "with": {}
2908
+ }
2909
+ },
2910
+ "foreignKeys": {},
2911
+ "compositePrimaryKeys": {},
2912
+ "uniqueConstraints": {},
2913
+ "policies": {},
2914
+ "checkConstraints": {},
2915
+ "isRLSEnabled": false
2916
+ },
2917
+ "public.link_clicks": {
2918
+ "name": "link_clicks",
2919
+ "schema": "",
2920
+ "columns": {
2921
+ "id": {
2922
+ "name": "id",
2923
+ "type": "uuid",
2924
+ "primaryKey": true,
2925
+ "notNull": true,
2926
+ "default": "gen_random_uuid()"
2927
+ },
2928
+ "tracked_link_id": {
2929
+ "name": "tracked_link_id",
2930
+ "type": "uuid",
2931
+ "primaryKey": false,
2932
+ "notNull": true
2933
+ },
2934
+ "ip_address": {
2935
+ "name": "ip_address",
2936
+ "type": "text",
2937
+ "primaryKey": false,
2938
+ "notNull": false
2939
+ },
2940
+ "user_agent": {
2941
+ "name": "user_agent",
2942
+ "type": "text",
2943
+ "primaryKey": false,
2944
+ "notNull": false
2945
+ },
2946
+ "clicked_at": {
2947
+ "name": "clicked_at",
2948
+ "type": "timestamp with time zone",
2949
+ "primaryKey": false,
2950
+ "notNull": true,
2951
+ "default": "now()"
2952
+ }
2953
+ },
2954
+ "indexes": {
2955
+ "link_clicks_tracked_link_id_idx": {
2956
+ "name": "link_clicks_tracked_link_id_idx",
2957
+ "columns": [
2958
+ {
2959
+ "expression": "tracked_link_id",
2960
+ "isExpression": false,
2961
+ "asc": true,
2962
+ "nulls": "last"
2963
+ }
2964
+ ],
2965
+ "isUnique": false,
2966
+ "concurrently": false,
2967
+ "method": "btree",
2968
+ "with": {}
2969
+ },
2970
+ "link_clicks_clicked_at_idx": {
2971
+ "name": "link_clicks_clicked_at_idx",
2972
+ "columns": [
2973
+ {
2974
+ "expression": "clicked_at",
2975
+ "isExpression": false,
2976
+ "asc": true,
2977
+ "nulls": "last"
2978
+ }
2979
+ ],
2980
+ "isUnique": false,
2981
+ "concurrently": false,
2982
+ "method": "btree",
2983
+ "with": {}
2984
+ }
2985
+ },
2986
+ "foreignKeys": {
2987
+ "link_clicks_tracked_link_id_tracked_links_id_fk": {
2988
+ "name": "link_clicks_tracked_link_id_tracked_links_id_fk",
2989
+ "tableFrom": "link_clicks",
2990
+ "tableTo": "tracked_links",
2991
+ "columnsFrom": [
2992
+ "tracked_link_id"
2993
+ ],
2994
+ "columnsTo": [
2995
+ "id"
2996
+ ],
2997
+ "onDelete": "cascade",
2998
+ "onUpdate": "no action"
2999
+ }
3000
+ },
3001
+ "compositePrimaryKeys": {},
3002
+ "uniqueConstraints": {},
3003
+ "policies": {},
3004
+ "checkConstraints": {},
3005
+ "isRLSEnabled": false
3006
+ },
3007
+ "public.tracked_links": {
3008
+ "name": "tracked_links",
3009
+ "schema": "",
3010
+ "columns": {
3011
+ "id": {
3012
+ "name": "id",
3013
+ "type": "uuid",
3014
+ "primaryKey": true,
3015
+ "notNull": true,
3016
+ "default": "gen_random_uuid()"
3017
+ },
3018
+ "email_send_id": {
3019
+ "name": "email_send_id",
3020
+ "type": "uuid",
3021
+ "primaryKey": false,
3022
+ "notNull": true
3023
+ },
3024
+ "original_url": {
3025
+ "name": "original_url",
3026
+ "type": "text",
3027
+ "primaryKey": false,
3028
+ "notNull": true
3029
+ },
3030
+ "click_count": {
3031
+ "name": "click_count",
3032
+ "type": "integer",
3033
+ "primaryKey": false,
3034
+ "notNull": true,
3035
+ "default": 0
3036
+ },
3037
+ "created_at": {
3038
+ "name": "created_at",
3039
+ "type": "timestamp with time zone",
3040
+ "primaryKey": false,
3041
+ "notNull": true,
3042
+ "default": "now()"
3043
+ },
3044
+ "updated_at": {
3045
+ "name": "updated_at",
3046
+ "type": "timestamp with time zone",
3047
+ "primaryKey": false,
3048
+ "notNull": true,
3049
+ "default": "now()"
3050
+ }
3051
+ },
3052
+ "indexes": {
3053
+ "tracked_links_email_send_id_idx": {
3054
+ "name": "tracked_links_email_send_id_idx",
3055
+ "columns": [
3056
+ {
3057
+ "expression": "email_send_id",
3058
+ "isExpression": false,
3059
+ "asc": true,
3060
+ "nulls": "last"
3061
+ }
3062
+ ],
3063
+ "isUnique": false,
3064
+ "concurrently": false,
3065
+ "method": "btree",
3066
+ "with": {}
3067
+ }
3068
+ },
3069
+ "foreignKeys": {
3070
+ "tracked_links_email_send_id_email_sends_id_fk": {
3071
+ "name": "tracked_links_email_send_id_email_sends_id_fk",
3072
+ "tableFrom": "tracked_links",
3073
+ "tableTo": "email_sends",
3074
+ "columnsFrom": [
3075
+ "email_send_id"
3076
+ ],
3077
+ "columnsTo": [
3078
+ "id"
3079
+ ],
3080
+ "onDelete": "cascade",
3081
+ "onUpdate": "no action"
3082
+ }
3083
+ },
3084
+ "compositePrimaryKeys": {},
3085
+ "uniqueConstraints": {},
3086
+ "policies": {},
3087
+ "checkConstraints": {},
3088
+ "isRLSEnabled": false
3089
+ },
3090
+ "public.user_events": {
3091
+ "name": "user_events",
3092
+ "schema": "",
3093
+ "columns": {
3094
+ "id": {
3095
+ "name": "id",
3096
+ "type": "uuid",
3097
+ "primaryKey": true,
3098
+ "notNull": true,
3099
+ "default": "gen_random_uuid()"
3100
+ },
3101
+ "organization_id": {
3102
+ "name": "organization_id",
3103
+ "type": "text",
3104
+ "primaryKey": false,
3105
+ "notNull": false
3106
+ },
3107
+ "user_id": {
3108
+ "name": "user_id",
3109
+ "type": "text",
3110
+ "primaryKey": false,
3111
+ "notNull": true
3112
+ },
3113
+ "event": {
3114
+ "name": "event",
3115
+ "type": "text",
3116
+ "primaryKey": false,
3117
+ "notNull": true
3118
+ },
3119
+ "properties": {
3120
+ "name": "properties",
3121
+ "type": "jsonb",
3122
+ "primaryKey": false,
3123
+ "notNull": false
3124
+ },
3125
+ "idempotency_key": {
3126
+ "name": "idempotency_key",
3127
+ "type": "text",
3128
+ "primaryKey": false,
3129
+ "notNull": false
3130
+ },
3131
+ "occurred_at": {
3132
+ "name": "occurred_at",
3133
+ "type": "timestamp with time zone",
3134
+ "primaryKey": false,
3135
+ "notNull": true,
3136
+ "default": "now()"
3137
+ }
3138
+ },
3139
+ "indexes": {
3140
+ "user_events_user_id_idx": {
3141
+ "name": "user_events_user_id_idx",
3142
+ "columns": [
3143
+ {
3144
+ "expression": "user_id",
3145
+ "isExpression": false,
3146
+ "asc": true,
3147
+ "nulls": "last"
3148
+ }
3149
+ ],
3150
+ "isUnique": false,
3151
+ "concurrently": false,
3152
+ "method": "btree",
3153
+ "with": {}
3154
+ },
3155
+ "user_events_event_idx": {
3156
+ "name": "user_events_event_idx",
3157
+ "columns": [
3158
+ {
3159
+ "expression": "event",
3160
+ "isExpression": false,
3161
+ "asc": true,
3162
+ "nulls": "last"
3163
+ }
3164
+ ],
3165
+ "isUnique": false,
3166
+ "concurrently": false,
3167
+ "method": "btree",
3168
+ "with": {}
3169
+ },
3170
+ "user_events_occurred_at_idx": {
3171
+ "name": "user_events_occurred_at_idx",
3172
+ "columns": [
3173
+ {
3174
+ "expression": "occurred_at",
3175
+ "isExpression": false,
3176
+ "asc": true,
3177
+ "nulls": "last"
3178
+ }
3179
+ ],
3180
+ "isUnique": false,
3181
+ "concurrently": false,
3182
+ "method": "btree",
3183
+ "with": {}
3184
+ },
3185
+ "user_events_user_event_occurred_idx": {
3186
+ "name": "user_events_user_event_occurred_idx",
3187
+ "columns": [
3188
+ {
3189
+ "expression": "user_id",
3190
+ "isExpression": false,
3191
+ "asc": true,
3192
+ "nulls": "last"
3193
+ },
3194
+ {
3195
+ "expression": "event",
3196
+ "isExpression": false,
3197
+ "asc": true,
3198
+ "nulls": "last"
3199
+ },
3200
+ {
3201
+ "expression": "occurred_at",
3202
+ "isExpression": false,
3203
+ "asc": true,
3204
+ "nulls": "last"
3205
+ }
3206
+ ],
3207
+ "isUnique": false,
3208
+ "concurrently": false,
3209
+ "method": "btree",
3210
+ "with": {}
3211
+ },
3212
+ "user_events_idempotency_key_idx": {
3213
+ "name": "user_events_idempotency_key_idx",
3214
+ "columns": [
3215
+ {
3216
+ "expression": "idempotency_key",
3217
+ "isExpression": false,
3218
+ "asc": true,
3219
+ "nulls": "last"
3220
+ }
3221
+ ],
3222
+ "isUnique": true,
3223
+ "concurrently": false,
3224
+ "method": "btree",
3225
+ "with": {}
3226
+ }
3227
+ },
3228
+ "foreignKeys": {},
3229
+ "compositePrimaryKeys": {},
3230
+ "uniqueConstraints": {},
3231
+ "policies": {},
3232
+ "checkConstraints": {},
3233
+ "isRLSEnabled": false
3234
+ },
3235
+ "public.webhook_deliveries": {
3236
+ "name": "webhook_deliveries",
3237
+ "schema": "",
3238
+ "columns": {
3239
+ "id": {
3240
+ "name": "id",
3241
+ "type": "uuid",
3242
+ "primaryKey": true,
3243
+ "notNull": true,
3244
+ "default": "gen_random_uuid()"
3245
+ },
3246
+ "endpoint_id": {
3247
+ "name": "endpoint_id",
3248
+ "type": "uuid",
3249
+ "primaryKey": false,
3250
+ "notNull": true
3251
+ },
3252
+ "organization_id": {
3253
+ "name": "organization_id",
3254
+ "type": "text",
3255
+ "primaryKey": false,
3256
+ "notNull": false
3257
+ },
3258
+ "webhook_id": {
3259
+ "name": "webhook_id",
3260
+ "type": "text",
3261
+ "primaryKey": false,
3262
+ "notNull": true
3263
+ },
3264
+ "event_type": {
3265
+ "name": "event_type",
3266
+ "type": "text",
3267
+ "primaryKey": false,
3268
+ "notNull": true
3269
+ },
3270
+ "dedupe_key": {
3271
+ "name": "dedupe_key",
3272
+ "type": "text",
3273
+ "primaryKey": false,
3274
+ "notNull": false
3275
+ },
3276
+ "payload": {
3277
+ "name": "payload",
3278
+ "type": "jsonb",
3279
+ "primaryKey": false,
3280
+ "notNull": true
3281
+ },
3282
+ "status": {
3283
+ "name": "status",
3284
+ "type": "webhook_delivery_status",
3285
+ "typeSchema": "public",
3286
+ "primaryKey": false,
3287
+ "notNull": true,
3288
+ "default": "'pending'"
3289
+ },
3290
+ "attempt_count": {
3291
+ "name": "attempt_count",
3292
+ "type": "integer",
3293
+ "primaryKey": false,
3294
+ "notNull": true,
3295
+ "default": 0
3296
+ },
3297
+ "next_retry_at": {
3298
+ "name": "next_retry_at",
3299
+ "type": "timestamp with time zone",
3300
+ "primaryKey": false,
3301
+ "notNull": false
3302
+ },
3303
+ "last_attempt_at": {
3304
+ "name": "last_attempt_at",
3305
+ "type": "timestamp with time zone",
3306
+ "primaryKey": false,
3307
+ "notNull": false
3308
+ },
3309
+ "response_status": {
3310
+ "name": "response_status",
3311
+ "type": "integer",
3312
+ "primaryKey": false,
3313
+ "notNull": false
3314
+ },
3315
+ "response_body_snippet": {
3316
+ "name": "response_body_snippet",
3317
+ "type": "text",
3318
+ "primaryKey": false,
3319
+ "notNull": false
3320
+ },
3321
+ "delivered_at": {
3322
+ "name": "delivered_at",
3323
+ "type": "timestamp with time zone",
3324
+ "primaryKey": false,
3325
+ "notNull": false
3326
+ },
3327
+ "last_error": {
3328
+ "name": "last_error",
3329
+ "type": "text",
3330
+ "primaryKey": false,
3331
+ "notNull": false
3332
+ },
3333
+ "created_at": {
3334
+ "name": "created_at",
3335
+ "type": "timestamp with time zone",
3336
+ "primaryKey": false,
3337
+ "notNull": true,
3338
+ "default": "now()"
3339
+ },
3340
+ "updated_at": {
3341
+ "name": "updated_at",
3342
+ "type": "timestamp with time zone",
3343
+ "primaryKey": false,
3344
+ "notNull": true,
3345
+ "default": "now()"
3346
+ }
3347
+ },
3348
+ "indexes": {
3349
+ "webhook_deliveries_endpoint_idx": {
3350
+ "name": "webhook_deliveries_endpoint_idx",
3351
+ "columns": [
3352
+ {
3353
+ "expression": "endpoint_id",
3354
+ "isExpression": false,
3355
+ "asc": true,
3356
+ "nulls": "last"
3357
+ }
3358
+ ],
3359
+ "isUnique": false,
3360
+ "concurrently": false,
3361
+ "method": "btree",
3362
+ "with": {}
3363
+ },
3364
+ "webhook_deliveries_status_next_retry_idx": {
3365
+ "name": "webhook_deliveries_status_next_retry_idx",
3366
+ "columns": [
3367
+ {
3368
+ "expression": "status",
3369
+ "isExpression": false,
3370
+ "asc": true,
3371
+ "nulls": "last"
3372
+ },
3373
+ {
3374
+ "expression": "next_retry_at",
3375
+ "isExpression": false,
3376
+ "asc": true,
3377
+ "nulls": "last"
3378
+ }
3379
+ ],
3380
+ "isUnique": false,
3381
+ "concurrently": false,
3382
+ "method": "btree",
3383
+ "with": {}
3384
+ },
3385
+ "webhook_deliveries_endpoint_dedupe_idx": {
3386
+ "name": "webhook_deliveries_endpoint_dedupe_idx",
3387
+ "columns": [
3388
+ {
3389
+ "expression": "endpoint_id",
3390
+ "isExpression": false,
3391
+ "asc": true,
3392
+ "nulls": "last"
3393
+ },
3394
+ {
3395
+ "expression": "dedupe_key",
3396
+ "isExpression": false,
3397
+ "asc": true,
3398
+ "nulls": "last"
3399
+ }
3400
+ ],
3401
+ "isUnique": true,
3402
+ "concurrently": false,
3403
+ "method": "btree",
3404
+ "with": {}
3405
+ }
3406
+ },
3407
+ "foreignKeys": {
3408
+ "webhook_deliveries_endpoint_id_webhook_endpoints_id_fk": {
3409
+ "name": "webhook_deliveries_endpoint_id_webhook_endpoints_id_fk",
3410
+ "tableFrom": "webhook_deliveries",
3411
+ "tableTo": "webhook_endpoints",
3412
+ "columnsFrom": [
3413
+ "endpoint_id"
3414
+ ],
3415
+ "columnsTo": [
3416
+ "id"
3417
+ ],
3418
+ "onDelete": "cascade",
3419
+ "onUpdate": "no action"
3420
+ }
3421
+ },
3422
+ "compositePrimaryKeys": {},
3423
+ "uniqueConstraints": {},
3424
+ "policies": {},
3425
+ "checkConstraints": {},
3426
+ "isRLSEnabled": false
3427
+ },
3428
+ "public.webhook_endpoints": {
3429
+ "name": "webhook_endpoints",
3430
+ "schema": "",
3431
+ "columns": {
3432
+ "id": {
3433
+ "name": "id",
3434
+ "type": "uuid",
3435
+ "primaryKey": true,
3436
+ "notNull": true,
3437
+ "default": "gen_random_uuid()"
3438
+ },
3439
+ "organization_id": {
3440
+ "name": "organization_id",
3441
+ "type": "text",
3442
+ "primaryKey": false,
3443
+ "notNull": false
3444
+ },
3445
+ "url": {
3446
+ "name": "url",
3447
+ "type": "text",
3448
+ "primaryKey": false,
3449
+ "notNull": true
3450
+ },
3451
+ "description": {
3452
+ "name": "description",
3453
+ "type": "text",
3454
+ "primaryKey": false,
3455
+ "notNull": false
3456
+ },
3457
+ "kind": {
3458
+ "name": "kind",
3459
+ "type": "text",
3460
+ "primaryKey": false,
3461
+ "notNull": true,
3462
+ "default": "'webhook'"
3463
+ },
3464
+ "config": {
3465
+ "name": "config",
3466
+ "type": "jsonb",
3467
+ "primaryKey": false,
3468
+ "notNull": false
3469
+ },
3470
+ "secret": {
3471
+ "name": "secret",
3472
+ "type": "text",
3473
+ "primaryKey": false,
3474
+ "notNull": false
3475
+ },
3476
+ "secret_prefix": {
3477
+ "name": "secret_prefix",
3478
+ "type": "text",
3479
+ "primaryKey": false,
3480
+ "notNull": false
3481
+ },
3482
+ "event_types": {
3483
+ "name": "event_types",
3484
+ "type": "jsonb",
3485
+ "primaryKey": false,
3486
+ "notNull": true,
3487
+ "default": "'[]'::jsonb"
3488
+ },
3489
+ "disabled": {
3490
+ "name": "disabled",
3491
+ "type": "boolean",
3492
+ "primaryKey": false,
3493
+ "notNull": true,
3494
+ "default": false
3495
+ },
3496
+ "last_delivery_at": {
3497
+ "name": "last_delivery_at",
3498
+ "type": "timestamp with time zone",
3499
+ "primaryKey": false,
3500
+ "notNull": false
3501
+ },
3502
+ "created_at": {
3503
+ "name": "created_at",
3504
+ "type": "timestamp with time zone",
3505
+ "primaryKey": false,
3506
+ "notNull": true,
3507
+ "default": "now()"
3508
+ },
3509
+ "updated_at": {
3510
+ "name": "updated_at",
3511
+ "type": "timestamp with time zone",
3512
+ "primaryKey": false,
3513
+ "notNull": true,
3514
+ "default": "now()"
3515
+ }
3516
+ },
3517
+ "indexes": {
3518
+ "webhook_endpoints_org_idx": {
3519
+ "name": "webhook_endpoints_org_idx",
3520
+ "columns": [
3521
+ {
3522
+ "expression": "organization_id",
3523
+ "isExpression": false,
3524
+ "asc": true,
3525
+ "nulls": "last"
3526
+ }
3527
+ ],
3528
+ "isUnique": false,
3529
+ "concurrently": false,
3530
+ "method": "btree",
3531
+ "with": {}
3532
+ },
3533
+ "webhook_endpoints_disabled_idx": {
3534
+ "name": "webhook_endpoints_disabled_idx",
3535
+ "columns": [
3536
+ {
3537
+ "expression": "disabled",
3538
+ "isExpression": false,
3539
+ "asc": true,
3540
+ "nulls": "last"
3541
+ }
3542
+ ],
3543
+ "isUnique": false,
3544
+ "concurrently": false,
3545
+ "method": "btree",
3546
+ "with": {}
3547
+ }
3548
+ },
3549
+ "foreignKeys": {},
3550
+ "compositePrimaryKeys": {},
3551
+ "uniqueConstraints": {},
3552
+ "policies": {},
3553
+ "checkConstraints": {},
3554
+ "isRLSEnabled": false
3555
+ }
3556
+ },
3557
+ "enums": {
3558
+ "public.alert_channel": {
3559
+ "name": "alert_channel",
3560
+ "schema": "public",
3561
+ "values": [
3562
+ "webhook",
3563
+ "slack",
3564
+ "email"
3565
+ ]
3566
+ },
3567
+ "public.alert_rule_type": {
3568
+ "name": "alert_rule_type",
3569
+ "schema": "public",
3570
+ "values": [
3571
+ "bounce_rate_exceeded",
3572
+ "journey_failure_spike",
3573
+ "delivery_issue",
3574
+ "high_complaint_rate"
3575
+ ]
3576
+ },
3577
+ "public.bucket_membership_status": {
3578
+ "name": "bucket_membership_status",
3579
+ "schema": "public",
3580
+ "values": [
3581
+ "active",
3582
+ "left"
3583
+ ]
3584
+ },
3585
+ "public.dlq_status": {
3586
+ "name": "dlq_status",
3587
+ "schema": "public",
3588
+ "values": [
3589
+ "pending",
3590
+ "retried",
3591
+ "discarded"
3592
+ ]
3593
+ },
3594
+ "public.email_send_status": {
3595
+ "name": "email_send_status",
3596
+ "schema": "public",
3597
+ "values": [
3598
+ "queued",
3599
+ "rendered",
3600
+ "sent",
3601
+ "delivered",
3602
+ "opened",
3603
+ "clicked",
3604
+ "bounced",
3605
+ "complained",
3606
+ "failed"
3607
+ ]
3608
+ },
3609
+ "public.import_job_status": {
3610
+ "name": "import_job_status",
3611
+ "schema": "public",
3612
+ "values": [
3613
+ "pending",
3614
+ "processing",
3615
+ "completed",
3616
+ "failed"
3617
+ ]
3618
+ },
3619
+ "public.journey_status": {
3620
+ "name": "journey_status",
3621
+ "schema": "public",
3622
+ "values": [
3623
+ "active",
3624
+ "waiting",
3625
+ "completed",
3626
+ "failed",
3627
+ "exited"
3628
+ ]
3629
+ },
3630
+ "public.webhook_delivery_status": {
3631
+ "name": "webhook_delivery_status",
3632
+ "schema": "public",
3633
+ "values": [
3634
+ "pending",
3635
+ "sending",
3636
+ "delivered",
3637
+ "failed",
3638
+ "discarded"
3639
+ ]
3640
+ }
3641
+ },
3642
+ "schemas": {},
3643
+ "sequences": {},
3644
+ "roles": {},
3645
+ "policies": {},
3646
+ "views": {},
3647
+ "_meta": {
3648
+ "columns": {},
3649
+ "schemas": {},
3650
+ "tables": {}
3651
+ }
3652
+ }