@hogsend/db 0.6.0 → 0.8.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,3080 @@
1
+ {
2
+ "id": "7ddb5758-b306-4b65-aa2e-81969a62d5d7",
3
+ "prevId": "9fe792c4-82f5-4fb1-8378-9a1b8cc83f47",
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.contact_aliases": {
1430
+ "name": "contact_aliases",
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
+ "contact_id": {
1441
+ "name": "contact_id",
1442
+ "type": "uuid",
1443
+ "primaryKey": false,
1444
+ "notNull": true
1445
+ },
1446
+ "alias_kind": {
1447
+ "name": "alias_kind",
1448
+ "type": "text",
1449
+ "primaryKey": false,
1450
+ "notNull": true
1451
+ },
1452
+ "alias_value": {
1453
+ "name": "alias_value",
1454
+ "type": "text",
1455
+ "primaryKey": false,
1456
+ "notNull": true
1457
+ },
1458
+ "from_contact_id": {
1459
+ "name": "from_contact_id",
1460
+ "type": "uuid",
1461
+ "primaryKey": false,
1462
+ "notNull": false
1463
+ },
1464
+ "reason": {
1465
+ "name": "reason",
1466
+ "type": "text",
1467
+ "primaryKey": false,
1468
+ "notNull": true
1469
+ },
1470
+ "created_at": {
1471
+ "name": "created_at",
1472
+ "type": "timestamp with time zone",
1473
+ "primaryKey": false,
1474
+ "notNull": true,
1475
+ "default": "now()"
1476
+ },
1477
+ "updated_at": {
1478
+ "name": "updated_at",
1479
+ "type": "timestamp with time zone",
1480
+ "primaryKey": false,
1481
+ "notNull": true,
1482
+ "default": "now()"
1483
+ }
1484
+ },
1485
+ "indexes": {
1486
+ "contact_aliases_kind_value_idx": {
1487
+ "name": "contact_aliases_kind_value_idx",
1488
+ "columns": [
1489
+ {
1490
+ "expression": "alias_kind",
1491
+ "isExpression": false,
1492
+ "asc": true,
1493
+ "nulls": "last"
1494
+ },
1495
+ {
1496
+ "expression": "alias_value",
1497
+ "isExpression": false,
1498
+ "asc": true,
1499
+ "nulls": "last"
1500
+ }
1501
+ ],
1502
+ "isUnique": true,
1503
+ "concurrently": false,
1504
+ "method": "btree",
1505
+ "with": {}
1506
+ },
1507
+ "contact_aliases_contact_id_idx": {
1508
+ "name": "contact_aliases_contact_id_idx",
1509
+ "columns": [
1510
+ {
1511
+ "expression": "contact_id",
1512
+ "isExpression": false,
1513
+ "asc": true,
1514
+ "nulls": "last"
1515
+ }
1516
+ ],
1517
+ "isUnique": false,
1518
+ "concurrently": false,
1519
+ "method": "btree",
1520
+ "with": {}
1521
+ }
1522
+ },
1523
+ "foreignKeys": {
1524
+ "contact_aliases_contact_id_contacts_id_fk": {
1525
+ "name": "contact_aliases_contact_id_contacts_id_fk",
1526
+ "tableFrom": "contact_aliases",
1527
+ "tableTo": "contacts",
1528
+ "columnsFrom": [
1529
+ "contact_id"
1530
+ ],
1531
+ "columnsTo": [
1532
+ "id"
1533
+ ],
1534
+ "onDelete": "cascade",
1535
+ "onUpdate": "no action"
1536
+ }
1537
+ },
1538
+ "compositePrimaryKeys": {},
1539
+ "uniqueConstraints": {},
1540
+ "policies": {},
1541
+ "checkConstraints": {},
1542
+ "isRLSEnabled": false
1543
+ },
1544
+ "public.contacts": {
1545
+ "name": "contacts",
1546
+ "schema": "",
1547
+ "columns": {
1548
+ "id": {
1549
+ "name": "id",
1550
+ "type": "uuid",
1551
+ "primaryKey": true,
1552
+ "notNull": true,
1553
+ "default": "gen_random_uuid()"
1554
+ },
1555
+ "organization_id": {
1556
+ "name": "organization_id",
1557
+ "type": "text",
1558
+ "primaryKey": false,
1559
+ "notNull": false
1560
+ },
1561
+ "external_id": {
1562
+ "name": "external_id",
1563
+ "type": "text",
1564
+ "primaryKey": false,
1565
+ "notNull": false
1566
+ },
1567
+ "email": {
1568
+ "name": "email",
1569
+ "type": "text",
1570
+ "primaryKey": false,
1571
+ "notNull": false
1572
+ },
1573
+ "anonymous_id": {
1574
+ "name": "anonymous_id",
1575
+ "type": "text",
1576
+ "primaryKey": false,
1577
+ "notNull": false
1578
+ },
1579
+ "timezone": {
1580
+ "name": "timezone",
1581
+ "type": "text",
1582
+ "primaryKey": false,
1583
+ "notNull": false
1584
+ },
1585
+ "properties": {
1586
+ "name": "properties",
1587
+ "type": "jsonb",
1588
+ "primaryKey": false,
1589
+ "notNull": false,
1590
+ "default": "'{}'::jsonb"
1591
+ },
1592
+ "first_seen_at": {
1593
+ "name": "first_seen_at",
1594
+ "type": "timestamp with time zone",
1595
+ "primaryKey": false,
1596
+ "notNull": true,
1597
+ "default": "now()"
1598
+ },
1599
+ "last_seen_at": {
1600
+ "name": "last_seen_at",
1601
+ "type": "timestamp with time zone",
1602
+ "primaryKey": false,
1603
+ "notNull": true,
1604
+ "default": "now()"
1605
+ },
1606
+ "deleted_at": {
1607
+ "name": "deleted_at",
1608
+ "type": "timestamp with time zone",
1609
+ "primaryKey": false,
1610
+ "notNull": false
1611
+ },
1612
+ "created_at": {
1613
+ "name": "created_at",
1614
+ "type": "timestamp with time zone",
1615
+ "primaryKey": false,
1616
+ "notNull": true,
1617
+ "default": "now()"
1618
+ },
1619
+ "updated_at": {
1620
+ "name": "updated_at",
1621
+ "type": "timestamp with time zone",
1622
+ "primaryKey": false,
1623
+ "notNull": true,
1624
+ "default": "now()"
1625
+ }
1626
+ },
1627
+ "indexes": {
1628
+ "contacts_email_idx": {
1629
+ "name": "contacts_email_idx",
1630
+ "columns": [
1631
+ {
1632
+ "expression": "email",
1633
+ "isExpression": false,
1634
+ "asc": true,
1635
+ "nulls": "last"
1636
+ }
1637
+ ],
1638
+ "isUnique": false,
1639
+ "concurrently": false,
1640
+ "method": "btree",
1641
+ "with": {}
1642
+ },
1643
+ "contacts_external_id_unique_idx": {
1644
+ "name": "contacts_external_id_unique_idx",
1645
+ "columns": [
1646
+ {
1647
+ "expression": "external_id",
1648
+ "isExpression": false,
1649
+ "asc": true,
1650
+ "nulls": "last"
1651
+ }
1652
+ ],
1653
+ "isUnique": true,
1654
+ "where": "external_id IS NOT NULL AND deleted_at IS NULL",
1655
+ "concurrently": false,
1656
+ "method": "btree",
1657
+ "with": {}
1658
+ },
1659
+ "contacts_email_unique_idx": {
1660
+ "name": "contacts_email_unique_idx",
1661
+ "columns": [
1662
+ {
1663
+ "expression": "lower(email)",
1664
+ "asc": true,
1665
+ "isExpression": true,
1666
+ "nulls": "last"
1667
+ }
1668
+ ],
1669
+ "isUnique": true,
1670
+ "where": "email IS NOT NULL AND deleted_at IS NULL",
1671
+ "concurrently": false,
1672
+ "method": "btree",
1673
+ "with": {}
1674
+ },
1675
+ "contacts_anonymous_id_unique_idx": {
1676
+ "name": "contacts_anonymous_id_unique_idx",
1677
+ "columns": [
1678
+ {
1679
+ "expression": "anonymous_id",
1680
+ "isExpression": false,
1681
+ "asc": true,
1682
+ "nulls": "last"
1683
+ }
1684
+ ],
1685
+ "isUnique": true,
1686
+ "where": "anonymous_id IS NOT NULL AND deleted_at IS NULL",
1687
+ "concurrently": false,
1688
+ "method": "btree",
1689
+ "with": {}
1690
+ }
1691
+ },
1692
+ "foreignKeys": {},
1693
+ "compositePrimaryKeys": {},
1694
+ "uniqueConstraints": {},
1695
+ "policies": {},
1696
+ "checkConstraints": {},
1697
+ "isRLSEnabled": false
1698
+ },
1699
+ "public.dead_letter_queue": {
1700
+ "name": "dead_letter_queue",
1701
+ "schema": "",
1702
+ "columns": {
1703
+ "id": {
1704
+ "name": "id",
1705
+ "type": "uuid",
1706
+ "primaryKey": true,
1707
+ "notNull": true,
1708
+ "default": "gen_random_uuid()"
1709
+ },
1710
+ "source": {
1711
+ "name": "source",
1712
+ "type": "text",
1713
+ "primaryKey": false,
1714
+ "notNull": true
1715
+ },
1716
+ "source_id": {
1717
+ "name": "source_id",
1718
+ "type": "text",
1719
+ "primaryKey": false,
1720
+ "notNull": false
1721
+ },
1722
+ "payload": {
1723
+ "name": "payload",
1724
+ "type": "jsonb",
1725
+ "primaryKey": false,
1726
+ "notNull": true
1727
+ },
1728
+ "error": {
1729
+ "name": "error",
1730
+ "type": "text",
1731
+ "primaryKey": false,
1732
+ "notNull": true
1733
+ },
1734
+ "retry_count": {
1735
+ "name": "retry_count",
1736
+ "type": "integer",
1737
+ "primaryKey": false,
1738
+ "notNull": true,
1739
+ "default": 0
1740
+ },
1741
+ "status": {
1742
+ "name": "status",
1743
+ "type": "dlq_status",
1744
+ "typeSchema": "public",
1745
+ "primaryKey": false,
1746
+ "notNull": true,
1747
+ "default": "'pending'"
1748
+ },
1749
+ "retried_at": {
1750
+ "name": "retried_at",
1751
+ "type": "timestamp with time zone",
1752
+ "primaryKey": false,
1753
+ "notNull": false
1754
+ },
1755
+ "created_at": {
1756
+ "name": "created_at",
1757
+ "type": "timestamp with time zone",
1758
+ "primaryKey": false,
1759
+ "notNull": true,
1760
+ "default": "now()"
1761
+ },
1762
+ "updated_at": {
1763
+ "name": "updated_at",
1764
+ "type": "timestamp with time zone",
1765
+ "primaryKey": false,
1766
+ "notNull": true,
1767
+ "default": "now()"
1768
+ }
1769
+ },
1770
+ "indexes": {
1771
+ "dlq_source_idx": {
1772
+ "name": "dlq_source_idx",
1773
+ "columns": [
1774
+ {
1775
+ "expression": "source",
1776
+ "isExpression": false,
1777
+ "asc": true,
1778
+ "nulls": "last"
1779
+ }
1780
+ ],
1781
+ "isUnique": false,
1782
+ "concurrently": false,
1783
+ "method": "btree",
1784
+ "with": {}
1785
+ },
1786
+ "dlq_status_idx": {
1787
+ "name": "dlq_status_idx",
1788
+ "columns": [
1789
+ {
1790
+ "expression": "status",
1791
+ "isExpression": false,
1792
+ "asc": true,
1793
+ "nulls": "last"
1794
+ }
1795
+ ],
1796
+ "isUnique": false,
1797
+ "concurrently": false,
1798
+ "method": "btree",
1799
+ "with": {}
1800
+ },
1801
+ "dlq_created_at_idx": {
1802
+ "name": "dlq_created_at_idx",
1803
+ "columns": [
1804
+ {
1805
+ "expression": "created_at",
1806
+ "isExpression": false,
1807
+ "asc": true,
1808
+ "nulls": "last"
1809
+ }
1810
+ ],
1811
+ "isUnique": false,
1812
+ "concurrently": false,
1813
+ "method": "btree",
1814
+ "with": {}
1815
+ }
1816
+ },
1817
+ "foreignKeys": {},
1818
+ "compositePrimaryKeys": {},
1819
+ "uniqueConstraints": {},
1820
+ "policies": {},
1821
+ "checkConstraints": {},
1822
+ "isRLSEnabled": false
1823
+ },
1824
+ "public.email_preferences": {
1825
+ "name": "email_preferences",
1826
+ "schema": "",
1827
+ "columns": {
1828
+ "id": {
1829
+ "name": "id",
1830
+ "type": "uuid",
1831
+ "primaryKey": true,
1832
+ "notNull": true,
1833
+ "default": "gen_random_uuid()"
1834
+ },
1835
+ "user_id": {
1836
+ "name": "user_id",
1837
+ "type": "text",
1838
+ "primaryKey": false,
1839
+ "notNull": true
1840
+ },
1841
+ "email": {
1842
+ "name": "email",
1843
+ "type": "text",
1844
+ "primaryKey": false,
1845
+ "notNull": true
1846
+ },
1847
+ "unsubscribed_all": {
1848
+ "name": "unsubscribed_all",
1849
+ "type": "boolean",
1850
+ "primaryKey": false,
1851
+ "notNull": true,
1852
+ "default": false
1853
+ },
1854
+ "suppressed": {
1855
+ "name": "suppressed",
1856
+ "type": "boolean",
1857
+ "primaryKey": false,
1858
+ "notNull": true,
1859
+ "default": false
1860
+ },
1861
+ "bounce_count": {
1862
+ "name": "bounce_count",
1863
+ "type": "integer",
1864
+ "primaryKey": false,
1865
+ "notNull": true,
1866
+ "default": 0
1867
+ },
1868
+ "categories": {
1869
+ "name": "categories",
1870
+ "type": "jsonb",
1871
+ "primaryKey": false,
1872
+ "notNull": false,
1873
+ "default": "'{}'::jsonb"
1874
+ },
1875
+ "suppressed_at": {
1876
+ "name": "suppressed_at",
1877
+ "type": "timestamp with time zone",
1878
+ "primaryKey": false,
1879
+ "notNull": false
1880
+ },
1881
+ "last_bounce_at": {
1882
+ "name": "last_bounce_at",
1883
+ "type": "timestamp with time zone",
1884
+ "primaryKey": false,
1885
+ "notNull": false
1886
+ },
1887
+ "created_at": {
1888
+ "name": "created_at",
1889
+ "type": "timestamp with time zone",
1890
+ "primaryKey": false,
1891
+ "notNull": true,
1892
+ "default": "now()"
1893
+ },
1894
+ "updated_at": {
1895
+ "name": "updated_at",
1896
+ "type": "timestamp with time zone",
1897
+ "primaryKey": false,
1898
+ "notNull": true,
1899
+ "default": "now()"
1900
+ }
1901
+ },
1902
+ "indexes": {
1903
+ "email_preferences_user_email_idx": {
1904
+ "name": "email_preferences_user_email_idx",
1905
+ "columns": [
1906
+ {
1907
+ "expression": "user_id",
1908
+ "isExpression": false,
1909
+ "asc": true,
1910
+ "nulls": "last"
1911
+ },
1912
+ {
1913
+ "expression": "email",
1914
+ "isExpression": false,
1915
+ "asc": true,
1916
+ "nulls": "last"
1917
+ }
1918
+ ],
1919
+ "isUnique": true,
1920
+ "concurrently": false,
1921
+ "method": "btree",
1922
+ "with": {}
1923
+ }
1924
+ },
1925
+ "foreignKeys": {},
1926
+ "compositePrimaryKeys": {},
1927
+ "uniqueConstraints": {},
1928
+ "policies": {},
1929
+ "checkConstraints": {},
1930
+ "isRLSEnabled": false
1931
+ },
1932
+ "public.email_sends": {
1933
+ "name": "email_sends",
1934
+ "schema": "",
1935
+ "columns": {
1936
+ "id": {
1937
+ "name": "id",
1938
+ "type": "uuid",
1939
+ "primaryKey": true,
1940
+ "notNull": true,
1941
+ "default": "gen_random_uuid()"
1942
+ },
1943
+ "organization_id": {
1944
+ "name": "organization_id",
1945
+ "type": "text",
1946
+ "primaryKey": false,
1947
+ "notNull": false
1948
+ },
1949
+ "journey_state_id": {
1950
+ "name": "journey_state_id",
1951
+ "type": "uuid",
1952
+ "primaryKey": false,
1953
+ "notNull": false
1954
+ },
1955
+ "user_id": {
1956
+ "name": "user_id",
1957
+ "type": "text",
1958
+ "primaryKey": false,
1959
+ "notNull": false
1960
+ },
1961
+ "user_email": {
1962
+ "name": "user_email",
1963
+ "type": "text",
1964
+ "primaryKey": false,
1965
+ "notNull": false
1966
+ },
1967
+ "template_key": {
1968
+ "name": "template_key",
1969
+ "type": "text",
1970
+ "primaryKey": false,
1971
+ "notNull": false
1972
+ },
1973
+ "resend_id": {
1974
+ "name": "resend_id",
1975
+ "type": "text",
1976
+ "primaryKey": false,
1977
+ "notNull": false
1978
+ },
1979
+ "from_email": {
1980
+ "name": "from_email",
1981
+ "type": "text",
1982
+ "primaryKey": false,
1983
+ "notNull": true
1984
+ },
1985
+ "to_email": {
1986
+ "name": "to_email",
1987
+ "type": "text",
1988
+ "primaryKey": false,
1989
+ "notNull": true
1990
+ },
1991
+ "subject": {
1992
+ "name": "subject",
1993
+ "type": "text",
1994
+ "primaryKey": false,
1995
+ "notNull": true
1996
+ },
1997
+ "category": {
1998
+ "name": "category",
1999
+ "type": "text",
2000
+ "primaryKey": false,
2001
+ "notNull": false
2002
+ },
2003
+ "status": {
2004
+ "name": "status",
2005
+ "type": "email_send_status",
2006
+ "typeSchema": "public",
2007
+ "primaryKey": false,
2008
+ "notNull": true,
2009
+ "default": "'queued'"
2010
+ },
2011
+ "sent_at": {
2012
+ "name": "sent_at",
2013
+ "type": "timestamp with time zone",
2014
+ "primaryKey": false,
2015
+ "notNull": false
2016
+ },
2017
+ "delivered_at": {
2018
+ "name": "delivered_at",
2019
+ "type": "timestamp with time zone",
2020
+ "primaryKey": false,
2021
+ "notNull": false
2022
+ },
2023
+ "opened_at": {
2024
+ "name": "opened_at",
2025
+ "type": "timestamp with time zone",
2026
+ "primaryKey": false,
2027
+ "notNull": false
2028
+ },
2029
+ "clicked_at": {
2030
+ "name": "clicked_at",
2031
+ "type": "timestamp with time zone",
2032
+ "primaryKey": false,
2033
+ "notNull": false
2034
+ },
2035
+ "bounced_at": {
2036
+ "name": "bounced_at",
2037
+ "type": "timestamp with time zone",
2038
+ "primaryKey": false,
2039
+ "notNull": false
2040
+ },
2041
+ "complained_at": {
2042
+ "name": "complained_at",
2043
+ "type": "timestamp with time zone",
2044
+ "primaryKey": false,
2045
+ "notNull": false
2046
+ },
2047
+ "bounce_type": {
2048
+ "name": "bounce_type",
2049
+ "type": "text",
2050
+ "primaryKey": false,
2051
+ "notNull": false
2052
+ },
2053
+ "bounce_reason": {
2054
+ "name": "bounce_reason",
2055
+ "type": "text",
2056
+ "primaryKey": false,
2057
+ "notNull": false
2058
+ },
2059
+ "created_at": {
2060
+ "name": "created_at",
2061
+ "type": "timestamp with time zone",
2062
+ "primaryKey": false,
2063
+ "notNull": true,
2064
+ "default": "now()"
2065
+ },
2066
+ "updated_at": {
2067
+ "name": "updated_at",
2068
+ "type": "timestamp with time zone",
2069
+ "primaryKey": false,
2070
+ "notNull": true,
2071
+ "default": "now()"
2072
+ }
2073
+ },
2074
+ "indexes": {
2075
+ "email_sends_to_email_idx": {
2076
+ "name": "email_sends_to_email_idx",
2077
+ "columns": [
2078
+ {
2079
+ "expression": "to_email",
2080
+ "isExpression": false,
2081
+ "asc": true,
2082
+ "nulls": "last"
2083
+ }
2084
+ ],
2085
+ "isUnique": false,
2086
+ "concurrently": false,
2087
+ "method": "btree",
2088
+ "with": {}
2089
+ },
2090
+ "email_sends_template_key_idx": {
2091
+ "name": "email_sends_template_key_idx",
2092
+ "columns": [
2093
+ {
2094
+ "expression": "template_key",
2095
+ "isExpression": false,
2096
+ "asc": true,
2097
+ "nulls": "last"
2098
+ }
2099
+ ],
2100
+ "isUnique": false,
2101
+ "concurrently": false,
2102
+ "method": "btree",
2103
+ "with": {}
2104
+ },
2105
+ "email_sends_status_idx": {
2106
+ "name": "email_sends_status_idx",
2107
+ "columns": [
2108
+ {
2109
+ "expression": "status",
2110
+ "isExpression": false,
2111
+ "asc": true,
2112
+ "nulls": "last"
2113
+ }
2114
+ ],
2115
+ "isUnique": false,
2116
+ "concurrently": false,
2117
+ "method": "btree",
2118
+ "with": {}
2119
+ },
2120
+ "email_sends_created_at_idx": {
2121
+ "name": "email_sends_created_at_idx",
2122
+ "columns": [
2123
+ {
2124
+ "expression": "created_at",
2125
+ "isExpression": false,
2126
+ "asc": true,
2127
+ "nulls": "last"
2128
+ }
2129
+ ],
2130
+ "isUnique": false,
2131
+ "concurrently": false,
2132
+ "method": "btree",
2133
+ "with": {}
2134
+ },
2135
+ "email_sends_journey_state_id_idx": {
2136
+ "name": "email_sends_journey_state_id_idx",
2137
+ "columns": [
2138
+ {
2139
+ "expression": "journey_state_id",
2140
+ "isExpression": false,
2141
+ "asc": true,
2142
+ "nulls": "last"
2143
+ }
2144
+ ],
2145
+ "isUnique": false,
2146
+ "concurrently": false,
2147
+ "method": "btree",
2148
+ "with": {}
2149
+ },
2150
+ "email_sends_user_id_idx": {
2151
+ "name": "email_sends_user_id_idx",
2152
+ "columns": [
2153
+ {
2154
+ "expression": "user_id",
2155
+ "isExpression": false,
2156
+ "asc": true,
2157
+ "nulls": "last"
2158
+ }
2159
+ ],
2160
+ "isUnique": false,
2161
+ "concurrently": false,
2162
+ "method": "btree",
2163
+ "with": {}
2164
+ },
2165
+ "email_sends_freq_cap_idx": {
2166
+ "name": "email_sends_freq_cap_idx",
2167
+ "columns": [
2168
+ {
2169
+ "expression": "to_email",
2170
+ "isExpression": false,
2171
+ "asc": true,
2172
+ "nulls": "last"
2173
+ },
2174
+ {
2175
+ "expression": "created_at",
2176
+ "isExpression": false,
2177
+ "asc": true,
2178
+ "nulls": "last"
2179
+ },
2180
+ {
2181
+ "expression": "category",
2182
+ "isExpression": false,
2183
+ "asc": true,
2184
+ "nulls": "last"
2185
+ }
2186
+ ],
2187
+ "isUnique": false,
2188
+ "concurrently": false,
2189
+ "method": "btree",
2190
+ "with": {}
2191
+ }
2192
+ },
2193
+ "foreignKeys": {
2194
+ "email_sends_journey_state_id_journey_states_id_fk": {
2195
+ "name": "email_sends_journey_state_id_journey_states_id_fk",
2196
+ "tableFrom": "email_sends",
2197
+ "tableTo": "journey_states",
2198
+ "columnsFrom": [
2199
+ "journey_state_id"
2200
+ ],
2201
+ "columnsTo": [
2202
+ "id"
2203
+ ],
2204
+ "onDelete": "no action",
2205
+ "onUpdate": "no action"
2206
+ }
2207
+ },
2208
+ "compositePrimaryKeys": {},
2209
+ "uniqueConstraints": {},
2210
+ "policies": {},
2211
+ "checkConstraints": {},
2212
+ "isRLSEnabled": false
2213
+ },
2214
+ "public.import_jobs": {
2215
+ "name": "import_jobs",
2216
+ "schema": "",
2217
+ "columns": {
2218
+ "id": {
2219
+ "name": "id",
2220
+ "type": "uuid",
2221
+ "primaryKey": true,
2222
+ "notNull": true,
2223
+ "default": "gen_random_uuid()"
2224
+ },
2225
+ "file_name": {
2226
+ "name": "file_name",
2227
+ "type": "text",
2228
+ "primaryKey": false,
2229
+ "notNull": false
2230
+ },
2231
+ "format": {
2232
+ "name": "format",
2233
+ "type": "text",
2234
+ "primaryKey": false,
2235
+ "notNull": true
2236
+ },
2237
+ "status": {
2238
+ "name": "status",
2239
+ "type": "import_job_status",
2240
+ "typeSchema": "public",
2241
+ "primaryKey": false,
2242
+ "notNull": true,
2243
+ "default": "'pending'"
2244
+ },
2245
+ "total_rows": {
2246
+ "name": "total_rows",
2247
+ "type": "integer",
2248
+ "primaryKey": false,
2249
+ "notNull": false
2250
+ },
2251
+ "processed_rows": {
2252
+ "name": "processed_rows",
2253
+ "type": "integer",
2254
+ "primaryKey": false,
2255
+ "notNull": true,
2256
+ "default": 0
2257
+ },
2258
+ "failed_rows": {
2259
+ "name": "failed_rows",
2260
+ "type": "integer",
2261
+ "primaryKey": false,
2262
+ "notNull": true,
2263
+ "default": 0
2264
+ },
2265
+ "errors": {
2266
+ "name": "errors",
2267
+ "type": "jsonb",
2268
+ "primaryKey": false,
2269
+ "notNull": false
2270
+ },
2271
+ "created_at": {
2272
+ "name": "created_at",
2273
+ "type": "timestamp with time zone",
2274
+ "primaryKey": false,
2275
+ "notNull": true,
2276
+ "default": "now()"
2277
+ },
2278
+ "updated_at": {
2279
+ "name": "updated_at",
2280
+ "type": "timestamp with time zone",
2281
+ "primaryKey": false,
2282
+ "notNull": true,
2283
+ "default": "now()"
2284
+ }
2285
+ },
2286
+ "indexes": {
2287
+ "import_jobs_status_idx": {
2288
+ "name": "import_jobs_status_idx",
2289
+ "columns": [
2290
+ {
2291
+ "expression": "status",
2292
+ "isExpression": false,
2293
+ "asc": true,
2294
+ "nulls": "last"
2295
+ }
2296
+ ],
2297
+ "isUnique": false,
2298
+ "concurrently": false,
2299
+ "method": "btree",
2300
+ "with": {}
2301
+ }
2302
+ },
2303
+ "foreignKeys": {},
2304
+ "compositePrimaryKeys": {},
2305
+ "uniqueConstraints": {},
2306
+ "policies": {},
2307
+ "checkConstraints": {},
2308
+ "isRLSEnabled": false
2309
+ },
2310
+ "public.journey_configs": {
2311
+ "name": "journey_configs",
2312
+ "schema": "",
2313
+ "columns": {
2314
+ "id": {
2315
+ "name": "id",
2316
+ "type": "uuid",
2317
+ "primaryKey": true,
2318
+ "notNull": true,
2319
+ "default": "gen_random_uuid()"
2320
+ },
2321
+ "journey_id": {
2322
+ "name": "journey_id",
2323
+ "type": "text",
2324
+ "primaryKey": false,
2325
+ "notNull": true
2326
+ },
2327
+ "enabled": {
2328
+ "name": "enabled",
2329
+ "type": "boolean",
2330
+ "primaryKey": false,
2331
+ "notNull": true,
2332
+ "default": true
2333
+ },
2334
+ "created_at": {
2335
+ "name": "created_at",
2336
+ "type": "timestamp with time zone",
2337
+ "primaryKey": false,
2338
+ "notNull": true,
2339
+ "default": "now()"
2340
+ },
2341
+ "updated_at": {
2342
+ "name": "updated_at",
2343
+ "type": "timestamp with time zone",
2344
+ "primaryKey": false,
2345
+ "notNull": true,
2346
+ "default": "now()"
2347
+ }
2348
+ },
2349
+ "indexes": {
2350
+ "journey_configs_journey_id_idx": {
2351
+ "name": "journey_configs_journey_id_idx",
2352
+ "columns": [
2353
+ {
2354
+ "expression": "journey_id",
2355
+ "isExpression": false,
2356
+ "asc": true,
2357
+ "nulls": "last"
2358
+ }
2359
+ ],
2360
+ "isUnique": true,
2361
+ "concurrently": false,
2362
+ "method": "btree",
2363
+ "with": {}
2364
+ }
2365
+ },
2366
+ "foreignKeys": {},
2367
+ "compositePrimaryKeys": {},
2368
+ "uniqueConstraints": {},
2369
+ "policies": {},
2370
+ "checkConstraints": {},
2371
+ "isRLSEnabled": false
2372
+ },
2373
+ "public.journey_logs": {
2374
+ "name": "journey_logs",
2375
+ "schema": "",
2376
+ "columns": {
2377
+ "id": {
2378
+ "name": "id",
2379
+ "type": "uuid",
2380
+ "primaryKey": true,
2381
+ "notNull": true,
2382
+ "default": "gen_random_uuid()"
2383
+ },
2384
+ "journey_state_id": {
2385
+ "name": "journey_state_id",
2386
+ "type": "uuid",
2387
+ "primaryKey": false,
2388
+ "notNull": true
2389
+ },
2390
+ "from_node_id": {
2391
+ "name": "from_node_id",
2392
+ "type": "text",
2393
+ "primaryKey": false,
2394
+ "notNull": false
2395
+ },
2396
+ "to_node_id": {
2397
+ "name": "to_node_id",
2398
+ "type": "text",
2399
+ "primaryKey": false,
2400
+ "notNull": false
2401
+ },
2402
+ "action": {
2403
+ "name": "action",
2404
+ "type": "text",
2405
+ "primaryKey": false,
2406
+ "notNull": true
2407
+ },
2408
+ "detail": {
2409
+ "name": "detail",
2410
+ "type": "jsonb",
2411
+ "primaryKey": false,
2412
+ "notNull": false
2413
+ },
2414
+ "created_at": {
2415
+ "name": "created_at",
2416
+ "type": "timestamp with time zone",
2417
+ "primaryKey": false,
2418
+ "notNull": true,
2419
+ "default": "now()"
2420
+ },
2421
+ "updated_at": {
2422
+ "name": "updated_at",
2423
+ "type": "timestamp with time zone",
2424
+ "primaryKey": false,
2425
+ "notNull": true,
2426
+ "default": "now()"
2427
+ }
2428
+ },
2429
+ "indexes": {
2430
+ "journey_logs_journey_state_id_idx": {
2431
+ "name": "journey_logs_journey_state_id_idx",
2432
+ "columns": [
2433
+ {
2434
+ "expression": "journey_state_id",
2435
+ "isExpression": false,
2436
+ "asc": true,
2437
+ "nulls": "last"
2438
+ }
2439
+ ],
2440
+ "isUnique": false,
2441
+ "concurrently": false,
2442
+ "method": "btree",
2443
+ "with": {}
2444
+ }
2445
+ },
2446
+ "foreignKeys": {
2447
+ "journey_logs_journey_state_id_journey_states_id_fk": {
2448
+ "name": "journey_logs_journey_state_id_journey_states_id_fk",
2449
+ "tableFrom": "journey_logs",
2450
+ "tableTo": "journey_states",
2451
+ "columnsFrom": [
2452
+ "journey_state_id"
2453
+ ],
2454
+ "columnsTo": [
2455
+ "id"
2456
+ ],
2457
+ "onDelete": "cascade",
2458
+ "onUpdate": "no action"
2459
+ }
2460
+ },
2461
+ "compositePrimaryKeys": {},
2462
+ "uniqueConstraints": {},
2463
+ "policies": {},
2464
+ "checkConstraints": {},
2465
+ "isRLSEnabled": false
2466
+ },
2467
+ "public.journey_states": {
2468
+ "name": "journey_states",
2469
+ "schema": "",
2470
+ "columns": {
2471
+ "id": {
2472
+ "name": "id",
2473
+ "type": "uuid",
2474
+ "primaryKey": true,
2475
+ "notNull": true,
2476
+ "default": "gen_random_uuid()"
2477
+ },
2478
+ "organization_id": {
2479
+ "name": "organization_id",
2480
+ "type": "text",
2481
+ "primaryKey": false,
2482
+ "notNull": false
2483
+ },
2484
+ "user_id": {
2485
+ "name": "user_id",
2486
+ "type": "text",
2487
+ "primaryKey": false,
2488
+ "notNull": true
2489
+ },
2490
+ "user_email": {
2491
+ "name": "user_email",
2492
+ "type": "text",
2493
+ "primaryKey": false,
2494
+ "notNull": true
2495
+ },
2496
+ "journey_id": {
2497
+ "name": "journey_id",
2498
+ "type": "text",
2499
+ "primaryKey": false,
2500
+ "notNull": true
2501
+ },
2502
+ "current_node_id": {
2503
+ "name": "current_node_id",
2504
+ "type": "text",
2505
+ "primaryKey": false,
2506
+ "notNull": true
2507
+ },
2508
+ "status": {
2509
+ "name": "status",
2510
+ "type": "journey_status",
2511
+ "typeSchema": "public",
2512
+ "primaryKey": false,
2513
+ "notNull": true,
2514
+ "default": "'active'"
2515
+ },
2516
+ "hatchet_run_id": {
2517
+ "name": "hatchet_run_id",
2518
+ "type": "text",
2519
+ "primaryKey": false,
2520
+ "notNull": false
2521
+ },
2522
+ "context": {
2523
+ "name": "context",
2524
+ "type": "jsonb",
2525
+ "primaryKey": false,
2526
+ "notNull": false,
2527
+ "default": "'{}'::jsonb"
2528
+ },
2529
+ "error_message": {
2530
+ "name": "error_message",
2531
+ "type": "text",
2532
+ "primaryKey": false,
2533
+ "notNull": false
2534
+ },
2535
+ "entry_count": {
2536
+ "name": "entry_count",
2537
+ "type": "integer",
2538
+ "primaryKey": false,
2539
+ "notNull": true,
2540
+ "default": 1
2541
+ },
2542
+ "completed_at": {
2543
+ "name": "completed_at",
2544
+ "type": "timestamp with time zone",
2545
+ "primaryKey": false,
2546
+ "notNull": false
2547
+ },
2548
+ "exited_at": {
2549
+ "name": "exited_at",
2550
+ "type": "timestamp with time zone",
2551
+ "primaryKey": false,
2552
+ "notNull": false
2553
+ },
2554
+ "deleted_at": {
2555
+ "name": "deleted_at",
2556
+ "type": "timestamp with time zone",
2557
+ "primaryKey": false,
2558
+ "notNull": false
2559
+ },
2560
+ "created_at": {
2561
+ "name": "created_at",
2562
+ "type": "timestamp with time zone",
2563
+ "primaryKey": false,
2564
+ "notNull": true,
2565
+ "default": "now()"
2566
+ },
2567
+ "updated_at": {
2568
+ "name": "updated_at",
2569
+ "type": "timestamp with time zone",
2570
+ "primaryKey": false,
2571
+ "notNull": true,
2572
+ "default": "now()"
2573
+ }
2574
+ },
2575
+ "indexes": {
2576
+ "uq_user_journey_active": {
2577
+ "name": "uq_user_journey_active",
2578
+ "columns": [
2579
+ {
2580
+ "expression": "user_id",
2581
+ "isExpression": false,
2582
+ "asc": true,
2583
+ "nulls": "last"
2584
+ },
2585
+ {
2586
+ "expression": "journey_id",
2587
+ "isExpression": false,
2588
+ "asc": true,
2589
+ "nulls": "last"
2590
+ },
2591
+ {
2592
+ "expression": "status",
2593
+ "isExpression": false,
2594
+ "asc": true,
2595
+ "nulls": "last"
2596
+ }
2597
+ ],
2598
+ "isUnique": true,
2599
+ "concurrently": false,
2600
+ "method": "btree",
2601
+ "with": {}
2602
+ },
2603
+ "journey_states_status_idx": {
2604
+ "name": "journey_states_status_idx",
2605
+ "columns": [
2606
+ {
2607
+ "expression": "status",
2608
+ "isExpression": false,
2609
+ "asc": true,
2610
+ "nulls": "last"
2611
+ }
2612
+ ],
2613
+ "isUnique": false,
2614
+ "concurrently": false,
2615
+ "method": "btree",
2616
+ "with": {}
2617
+ },
2618
+ "journey_states_hatchet_run_idx": {
2619
+ "name": "journey_states_hatchet_run_idx",
2620
+ "columns": [
2621
+ {
2622
+ "expression": "hatchet_run_id",
2623
+ "isExpression": false,
2624
+ "asc": true,
2625
+ "nulls": "last"
2626
+ }
2627
+ ],
2628
+ "isUnique": false,
2629
+ "concurrently": false,
2630
+ "method": "btree",
2631
+ "with": {}
2632
+ },
2633
+ "journey_states_user_id_idx": {
2634
+ "name": "journey_states_user_id_idx",
2635
+ "columns": [
2636
+ {
2637
+ "expression": "user_id",
2638
+ "isExpression": false,
2639
+ "asc": true,
2640
+ "nulls": "last"
2641
+ }
2642
+ ],
2643
+ "isUnique": false,
2644
+ "concurrently": false,
2645
+ "method": "btree",
2646
+ "with": {}
2647
+ },
2648
+ "journey_states_journey_id_status_idx": {
2649
+ "name": "journey_states_journey_id_status_idx",
2650
+ "columns": [
2651
+ {
2652
+ "expression": "journey_id",
2653
+ "isExpression": false,
2654
+ "asc": true,
2655
+ "nulls": "last"
2656
+ },
2657
+ {
2658
+ "expression": "status",
2659
+ "isExpression": false,
2660
+ "asc": true,
2661
+ "nulls": "last"
2662
+ }
2663
+ ],
2664
+ "isUnique": false,
2665
+ "concurrently": false,
2666
+ "method": "btree",
2667
+ "with": {}
2668
+ }
2669
+ },
2670
+ "foreignKeys": {},
2671
+ "compositePrimaryKeys": {},
2672
+ "uniqueConstraints": {},
2673
+ "policies": {},
2674
+ "checkConstraints": {},
2675
+ "isRLSEnabled": false
2676
+ },
2677
+ "public.link_clicks": {
2678
+ "name": "link_clicks",
2679
+ "schema": "",
2680
+ "columns": {
2681
+ "id": {
2682
+ "name": "id",
2683
+ "type": "uuid",
2684
+ "primaryKey": true,
2685
+ "notNull": true,
2686
+ "default": "gen_random_uuid()"
2687
+ },
2688
+ "tracked_link_id": {
2689
+ "name": "tracked_link_id",
2690
+ "type": "uuid",
2691
+ "primaryKey": false,
2692
+ "notNull": true
2693
+ },
2694
+ "ip_address": {
2695
+ "name": "ip_address",
2696
+ "type": "text",
2697
+ "primaryKey": false,
2698
+ "notNull": false
2699
+ },
2700
+ "user_agent": {
2701
+ "name": "user_agent",
2702
+ "type": "text",
2703
+ "primaryKey": false,
2704
+ "notNull": false
2705
+ },
2706
+ "clicked_at": {
2707
+ "name": "clicked_at",
2708
+ "type": "timestamp with time zone",
2709
+ "primaryKey": false,
2710
+ "notNull": true,
2711
+ "default": "now()"
2712
+ }
2713
+ },
2714
+ "indexes": {
2715
+ "link_clicks_tracked_link_id_idx": {
2716
+ "name": "link_clicks_tracked_link_id_idx",
2717
+ "columns": [
2718
+ {
2719
+ "expression": "tracked_link_id",
2720
+ "isExpression": false,
2721
+ "asc": true,
2722
+ "nulls": "last"
2723
+ }
2724
+ ],
2725
+ "isUnique": false,
2726
+ "concurrently": false,
2727
+ "method": "btree",
2728
+ "with": {}
2729
+ },
2730
+ "link_clicks_clicked_at_idx": {
2731
+ "name": "link_clicks_clicked_at_idx",
2732
+ "columns": [
2733
+ {
2734
+ "expression": "clicked_at",
2735
+ "isExpression": false,
2736
+ "asc": true,
2737
+ "nulls": "last"
2738
+ }
2739
+ ],
2740
+ "isUnique": false,
2741
+ "concurrently": false,
2742
+ "method": "btree",
2743
+ "with": {}
2744
+ }
2745
+ },
2746
+ "foreignKeys": {
2747
+ "link_clicks_tracked_link_id_tracked_links_id_fk": {
2748
+ "name": "link_clicks_tracked_link_id_tracked_links_id_fk",
2749
+ "tableFrom": "link_clicks",
2750
+ "tableTo": "tracked_links",
2751
+ "columnsFrom": [
2752
+ "tracked_link_id"
2753
+ ],
2754
+ "columnsTo": [
2755
+ "id"
2756
+ ],
2757
+ "onDelete": "cascade",
2758
+ "onUpdate": "no action"
2759
+ }
2760
+ },
2761
+ "compositePrimaryKeys": {},
2762
+ "uniqueConstraints": {},
2763
+ "policies": {},
2764
+ "checkConstraints": {},
2765
+ "isRLSEnabled": false
2766
+ },
2767
+ "public.tracked_links": {
2768
+ "name": "tracked_links",
2769
+ "schema": "",
2770
+ "columns": {
2771
+ "id": {
2772
+ "name": "id",
2773
+ "type": "uuid",
2774
+ "primaryKey": true,
2775
+ "notNull": true,
2776
+ "default": "gen_random_uuid()"
2777
+ },
2778
+ "email_send_id": {
2779
+ "name": "email_send_id",
2780
+ "type": "uuid",
2781
+ "primaryKey": false,
2782
+ "notNull": true
2783
+ },
2784
+ "original_url": {
2785
+ "name": "original_url",
2786
+ "type": "text",
2787
+ "primaryKey": false,
2788
+ "notNull": true
2789
+ },
2790
+ "click_count": {
2791
+ "name": "click_count",
2792
+ "type": "integer",
2793
+ "primaryKey": false,
2794
+ "notNull": true,
2795
+ "default": 0
2796
+ },
2797
+ "created_at": {
2798
+ "name": "created_at",
2799
+ "type": "timestamp with time zone",
2800
+ "primaryKey": false,
2801
+ "notNull": true,
2802
+ "default": "now()"
2803
+ },
2804
+ "updated_at": {
2805
+ "name": "updated_at",
2806
+ "type": "timestamp with time zone",
2807
+ "primaryKey": false,
2808
+ "notNull": true,
2809
+ "default": "now()"
2810
+ }
2811
+ },
2812
+ "indexes": {
2813
+ "tracked_links_email_send_id_idx": {
2814
+ "name": "tracked_links_email_send_id_idx",
2815
+ "columns": [
2816
+ {
2817
+ "expression": "email_send_id",
2818
+ "isExpression": false,
2819
+ "asc": true,
2820
+ "nulls": "last"
2821
+ }
2822
+ ],
2823
+ "isUnique": false,
2824
+ "concurrently": false,
2825
+ "method": "btree",
2826
+ "with": {}
2827
+ }
2828
+ },
2829
+ "foreignKeys": {
2830
+ "tracked_links_email_send_id_email_sends_id_fk": {
2831
+ "name": "tracked_links_email_send_id_email_sends_id_fk",
2832
+ "tableFrom": "tracked_links",
2833
+ "tableTo": "email_sends",
2834
+ "columnsFrom": [
2835
+ "email_send_id"
2836
+ ],
2837
+ "columnsTo": [
2838
+ "id"
2839
+ ],
2840
+ "onDelete": "cascade",
2841
+ "onUpdate": "no action"
2842
+ }
2843
+ },
2844
+ "compositePrimaryKeys": {},
2845
+ "uniqueConstraints": {},
2846
+ "policies": {},
2847
+ "checkConstraints": {},
2848
+ "isRLSEnabled": false
2849
+ },
2850
+ "public.user_events": {
2851
+ "name": "user_events",
2852
+ "schema": "",
2853
+ "columns": {
2854
+ "id": {
2855
+ "name": "id",
2856
+ "type": "uuid",
2857
+ "primaryKey": true,
2858
+ "notNull": true,
2859
+ "default": "gen_random_uuid()"
2860
+ },
2861
+ "organization_id": {
2862
+ "name": "organization_id",
2863
+ "type": "text",
2864
+ "primaryKey": false,
2865
+ "notNull": false
2866
+ },
2867
+ "user_id": {
2868
+ "name": "user_id",
2869
+ "type": "text",
2870
+ "primaryKey": false,
2871
+ "notNull": true
2872
+ },
2873
+ "event": {
2874
+ "name": "event",
2875
+ "type": "text",
2876
+ "primaryKey": false,
2877
+ "notNull": true
2878
+ },
2879
+ "properties": {
2880
+ "name": "properties",
2881
+ "type": "jsonb",
2882
+ "primaryKey": false,
2883
+ "notNull": false
2884
+ },
2885
+ "idempotency_key": {
2886
+ "name": "idempotency_key",
2887
+ "type": "text",
2888
+ "primaryKey": false,
2889
+ "notNull": false
2890
+ },
2891
+ "occurred_at": {
2892
+ "name": "occurred_at",
2893
+ "type": "timestamp with time zone",
2894
+ "primaryKey": false,
2895
+ "notNull": true,
2896
+ "default": "now()"
2897
+ }
2898
+ },
2899
+ "indexes": {
2900
+ "user_events_user_id_idx": {
2901
+ "name": "user_events_user_id_idx",
2902
+ "columns": [
2903
+ {
2904
+ "expression": "user_id",
2905
+ "isExpression": false,
2906
+ "asc": true,
2907
+ "nulls": "last"
2908
+ }
2909
+ ],
2910
+ "isUnique": false,
2911
+ "concurrently": false,
2912
+ "method": "btree",
2913
+ "with": {}
2914
+ },
2915
+ "user_events_event_idx": {
2916
+ "name": "user_events_event_idx",
2917
+ "columns": [
2918
+ {
2919
+ "expression": "event",
2920
+ "isExpression": false,
2921
+ "asc": true,
2922
+ "nulls": "last"
2923
+ }
2924
+ ],
2925
+ "isUnique": false,
2926
+ "concurrently": false,
2927
+ "method": "btree",
2928
+ "with": {}
2929
+ },
2930
+ "user_events_occurred_at_idx": {
2931
+ "name": "user_events_occurred_at_idx",
2932
+ "columns": [
2933
+ {
2934
+ "expression": "occurred_at",
2935
+ "isExpression": false,
2936
+ "asc": true,
2937
+ "nulls": "last"
2938
+ }
2939
+ ],
2940
+ "isUnique": false,
2941
+ "concurrently": false,
2942
+ "method": "btree",
2943
+ "with": {}
2944
+ },
2945
+ "user_events_user_event_occurred_idx": {
2946
+ "name": "user_events_user_event_occurred_idx",
2947
+ "columns": [
2948
+ {
2949
+ "expression": "user_id",
2950
+ "isExpression": false,
2951
+ "asc": true,
2952
+ "nulls": "last"
2953
+ },
2954
+ {
2955
+ "expression": "event",
2956
+ "isExpression": false,
2957
+ "asc": true,
2958
+ "nulls": "last"
2959
+ },
2960
+ {
2961
+ "expression": "occurred_at",
2962
+ "isExpression": false,
2963
+ "asc": true,
2964
+ "nulls": "last"
2965
+ }
2966
+ ],
2967
+ "isUnique": false,
2968
+ "concurrently": false,
2969
+ "method": "btree",
2970
+ "with": {}
2971
+ },
2972
+ "user_events_idempotency_key_idx": {
2973
+ "name": "user_events_idempotency_key_idx",
2974
+ "columns": [
2975
+ {
2976
+ "expression": "idempotency_key",
2977
+ "isExpression": false,
2978
+ "asc": true,
2979
+ "nulls": "last"
2980
+ }
2981
+ ],
2982
+ "isUnique": true,
2983
+ "concurrently": false,
2984
+ "method": "btree",
2985
+ "with": {}
2986
+ }
2987
+ },
2988
+ "foreignKeys": {},
2989
+ "compositePrimaryKeys": {},
2990
+ "uniqueConstraints": {},
2991
+ "policies": {},
2992
+ "checkConstraints": {},
2993
+ "isRLSEnabled": false
2994
+ }
2995
+ },
2996
+ "enums": {
2997
+ "public.alert_channel": {
2998
+ "name": "alert_channel",
2999
+ "schema": "public",
3000
+ "values": [
3001
+ "webhook",
3002
+ "slack",
3003
+ "email"
3004
+ ]
3005
+ },
3006
+ "public.alert_rule_type": {
3007
+ "name": "alert_rule_type",
3008
+ "schema": "public",
3009
+ "values": [
3010
+ "bounce_rate_exceeded",
3011
+ "journey_failure_spike",
3012
+ "delivery_issue",
3013
+ "high_complaint_rate"
3014
+ ]
3015
+ },
3016
+ "public.bucket_membership_status": {
3017
+ "name": "bucket_membership_status",
3018
+ "schema": "public",
3019
+ "values": [
3020
+ "active",
3021
+ "left"
3022
+ ]
3023
+ },
3024
+ "public.dlq_status": {
3025
+ "name": "dlq_status",
3026
+ "schema": "public",
3027
+ "values": [
3028
+ "pending",
3029
+ "retried",
3030
+ "discarded"
3031
+ ]
3032
+ },
3033
+ "public.email_send_status": {
3034
+ "name": "email_send_status",
3035
+ "schema": "public",
3036
+ "values": [
3037
+ "queued",
3038
+ "rendered",
3039
+ "sent",
3040
+ "delivered",
3041
+ "opened",
3042
+ "clicked",
3043
+ "bounced",
3044
+ "complained",
3045
+ "failed"
3046
+ ]
3047
+ },
3048
+ "public.import_job_status": {
3049
+ "name": "import_job_status",
3050
+ "schema": "public",
3051
+ "values": [
3052
+ "pending",
3053
+ "processing",
3054
+ "completed",
3055
+ "failed"
3056
+ ]
3057
+ },
3058
+ "public.journey_status": {
3059
+ "name": "journey_status",
3060
+ "schema": "public",
3061
+ "values": [
3062
+ "active",
3063
+ "waiting",
3064
+ "completed",
3065
+ "failed",
3066
+ "exited"
3067
+ ]
3068
+ }
3069
+ },
3070
+ "schemas": {},
3071
+ "sequences": {},
3072
+ "roles": {},
3073
+ "policies": {},
3074
+ "views": {},
3075
+ "_meta": {
3076
+ "columns": {},
3077
+ "schemas": {},
3078
+ "tables": {}
3079
+ }
3080
+ }