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