@hogsend/db 0.5.0 → 0.7.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,3101 @@
1
+ {
2
+ "id": "1f52ccb7-610e-4eb6-89bb-a873fafa5528",
3
+ "prevId": "7ddb5758-b306-4b65-aa2e-81969a62d5d7",
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
+ "idempotency_key": {
2060
+ "name": "idempotency_key",
2061
+ "type": "text",
2062
+ "primaryKey": false,
2063
+ "notNull": false
2064
+ },
2065
+ "created_at": {
2066
+ "name": "created_at",
2067
+ "type": "timestamp with time zone",
2068
+ "primaryKey": false,
2069
+ "notNull": true,
2070
+ "default": "now()"
2071
+ },
2072
+ "updated_at": {
2073
+ "name": "updated_at",
2074
+ "type": "timestamp with time zone",
2075
+ "primaryKey": false,
2076
+ "notNull": true,
2077
+ "default": "now()"
2078
+ }
2079
+ },
2080
+ "indexes": {
2081
+ "email_sends_to_email_idx": {
2082
+ "name": "email_sends_to_email_idx",
2083
+ "columns": [
2084
+ {
2085
+ "expression": "to_email",
2086
+ "isExpression": false,
2087
+ "asc": true,
2088
+ "nulls": "last"
2089
+ }
2090
+ ],
2091
+ "isUnique": false,
2092
+ "concurrently": false,
2093
+ "method": "btree",
2094
+ "with": {}
2095
+ },
2096
+ "email_sends_template_key_idx": {
2097
+ "name": "email_sends_template_key_idx",
2098
+ "columns": [
2099
+ {
2100
+ "expression": "template_key",
2101
+ "isExpression": false,
2102
+ "asc": true,
2103
+ "nulls": "last"
2104
+ }
2105
+ ],
2106
+ "isUnique": false,
2107
+ "concurrently": false,
2108
+ "method": "btree",
2109
+ "with": {}
2110
+ },
2111
+ "email_sends_status_idx": {
2112
+ "name": "email_sends_status_idx",
2113
+ "columns": [
2114
+ {
2115
+ "expression": "status",
2116
+ "isExpression": false,
2117
+ "asc": true,
2118
+ "nulls": "last"
2119
+ }
2120
+ ],
2121
+ "isUnique": false,
2122
+ "concurrently": false,
2123
+ "method": "btree",
2124
+ "with": {}
2125
+ },
2126
+ "email_sends_created_at_idx": {
2127
+ "name": "email_sends_created_at_idx",
2128
+ "columns": [
2129
+ {
2130
+ "expression": "created_at",
2131
+ "isExpression": false,
2132
+ "asc": true,
2133
+ "nulls": "last"
2134
+ }
2135
+ ],
2136
+ "isUnique": false,
2137
+ "concurrently": false,
2138
+ "method": "btree",
2139
+ "with": {}
2140
+ },
2141
+ "email_sends_journey_state_id_idx": {
2142
+ "name": "email_sends_journey_state_id_idx",
2143
+ "columns": [
2144
+ {
2145
+ "expression": "journey_state_id",
2146
+ "isExpression": false,
2147
+ "asc": true,
2148
+ "nulls": "last"
2149
+ }
2150
+ ],
2151
+ "isUnique": false,
2152
+ "concurrently": false,
2153
+ "method": "btree",
2154
+ "with": {}
2155
+ },
2156
+ "email_sends_user_id_idx": {
2157
+ "name": "email_sends_user_id_idx",
2158
+ "columns": [
2159
+ {
2160
+ "expression": "user_id",
2161
+ "isExpression": false,
2162
+ "asc": true,
2163
+ "nulls": "last"
2164
+ }
2165
+ ],
2166
+ "isUnique": false,
2167
+ "concurrently": false,
2168
+ "method": "btree",
2169
+ "with": {}
2170
+ },
2171
+ "email_sends_freq_cap_idx": {
2172
+ "name": "email_sends_freq_cap_idx",
2173
+ "columns": [
2174
+ {
2175
+ "expression": "to_email",
2176
+ "isExpression": false,
2177
+ "asc": true,
2178
+ "nulls": "last"
2179
+ },
2180
+ {
2181
+ "expression": "created_at",
2182
+ "isExpression": false,
2183
+ "asc": true,
2184
+ "nulls": "last"
2185
+ },
2186
+ {
2187
+ "expression": "category",
2188
+ "isExpression": false,
2189
+ "asc": true,
2190
+ "nulls": "last"
2191
+ }
2192
+ ],
2193
+ "isUnique": false,
2194
+ "concurrently": false,
2195
+ "method": "btree",
2196
+ "with": {}
2197
+ },
2198
+ "email_sends_idempotency_key_idx": {
2199
+ "name": "email_sends_idempotency_key_idx",
2200
+ "columns": [
2201
+ {
2202
+ "expression": "idempotency_key",
2203
+ "isExpression": false,
2204
+ "asc": true,
2205
+ "nulls": "last"
2206
+ }
2207
+ ],
2208
+ "isUnique": true,
2209
+ "concurrently": false,
2210
+ "method": "btree",
2211
+ "with": {}
2212
+ }
2213
+ },
2214
+ "foreignKeys": {
2215
+ "email_sends_journey_state_id_journey_states_id_fk": {
2216
+ "name": "email_sends_journey_state_id_journey_states_id_fk",
2217
+ "tableFrom": "email_sends",
2218
+ "tableTo": "journey_states",
2219
+ "columnsFrom": [
2220
+ "journey_state_id"
2221
+ ],
2222
+ "columnsTo": [
2223
+ "id"
2224
+ ],
2225
+ "onDelete": "no action",
2226
+ "onUpdate": "no action"
2227
+ }
2228
+ },
2229
+ "compositePrimaryKeys": {},
2230
+ "uniqueConstraints": {},
2231
+ "policies": {},
2232
+ "checkConstraints": {},
2233
+ "isRLSEnabled": false
2234
+ },
2235
+ "public.import_jobs": {
2236
+ "name": "import_jobs",
2237
+ "schema": "",
2238
+ "columns": {
2239
+ "id": {
2240
+ "name": "id",
2241
+ "type": "uuid",
2242
+ "primaryKey": true,
2243
+ "notNull": true,
2244
+ "default": "gen_random_uuid()"
2245
+ },
2246
+ "file_name": {
2247
+ "name": "file_name",
2248
+ "type": "text",
2249
+ "primaryKey": false,
2250
+ "notNull": false
2251
+ },
2252
+ "format": {
2253
+ "name": "format",
2254
+ "type": "text",
2255
+ "primaryKey": false,
2256
+ "notNull": true
2257
+ },
2258
+ "status": {
2259
+ "name": "status",
2260
+ "type": "import_job_status",
2261
+ "typeSchema": "public",
2262
+ "primaryKey": false,
2263
+ "notNull": true,
2264
+ "default": "'pending'"
2265
+ },
2266
+ "total_rows": {
2267
+ "name": "total_rows",
2268
+ "type": "integer",
2269
+ "primaryKey": false,
2270
+ "notNull": false
2271
+ },
2272
+ "processed_rows": {
2273
+ "name": "processed_rows",
2274
+ "type": "integer",
2275
+ "primaryKey": false,
2276
+ "notNull": true,
2277
+ "default": 0
2278
+ },
2279
+ "failed_rows": {
2280
+ "name": "failed_rows",
2281
+ "type": "integer",
2282
+ "primaryKey": false,
2283
+ "notNull": true,
2284
+ "default": 0
2285
+ },
2286
+ "errors": {
2287
+ "name": "errors",
2288
+ "type": "jsonb",
2289
+ "primaryKey": false,
2290
+ "notNull": false
2291
+ },
2292
+ "created_at": {
2293
+ "name": "created_at",
2294
+ "type": "timestamp with time zone",
2295
+ "primaryKey": false,
2296
+ "notNull": true,
2297
+ "default": "now()"
2298
+ },
2299
+ "updated_at": {
2300
+ "name": "updated_at",
2301
+ "type": "timestamp with time zone",
2302
+ "primaryKey": false,
2303
+ "notNull": true,
2304
+ "default": "now()"
2305
+ }
2306
+ },
2307
+ "indexes": {
2308
+ "import_jobs_status_idx": {
2309
+ "name": "import_jobs_status_idx",
2310
+ "columns": [
2311
+ {
2312
+ "expression": "status",
2313
+ "isExpression": false,
2314
+ "asc": true,
2315
+ "nulls": "last"
2316
+ }
2317
+ ],
2318
+ "isUnique": false,
2319
+ "concurrently": false,
2320
+ "method": "btree",
2321
+ "with": {}
2322
+ }
2323
+ },
2324
+ "foreignKeys": {},
2325
+ "compositePrimaryKeys": {},
2326
+ "uniqueConstraints": {},
2327
+ "policies": {},
2328
+ "checkConstraints": {},
2329
+ "isRLSEnabled": false
2330
+ },
2331
+ "public.journey_configs": {
2332
+ "name": "journey_configs",
2333
+ "schema": "",
2334
+ "columns": {
2335
+ "id": {
2336
+ "name": "id",
2337
+ "type": "uuid",
2338
+ "primaryKey": true,
2339
+ "notNull": true,
2340
+ "default": "gen_random_uuid()"
2341
+ },
2342
+ "journey_id": {
2343
+ "name": "journey_id",
2344
+ "type": "text",
2345
+ "primaryKey": false,
2346
+ "notNull": true
2347
+ },
2348
+ "enabled": {
2349
+ "name": "enabled",
2350
+ "type": "boolean",
2351
+ "primaryKey": false,
2352
+ "notNull": true,
2353
+ "default": true
2354
+ },
2355
+ "created_at": {
2356
+ "name": "created_at",
2357
+ "type": "timestamp with time zone",
2358
+ "primaryKey": false,
2359
+ "notNull": true,
2360
+ "default": "now()"
2361
+ },
2362
+ "updated_at": {
2363
+ "name": "updated_at",
2364
+ "type": "timestamp with time zone",
2365
+ "primaryKey": false,
2366
+ "notNull": true,
2367
+ "default": "now()"
2368
+ }
2369
+ },
2370
+ "indexes": {
2371
+ "journey_configs_journey_id_idx": {
2372
+ "name": "journey_configs_journey_id_idx",
2373
+ "columns": [
2374
+ {
2375
+ "expression": "journey_id",
2376
+ "isExpression": false,
2377
+ "asc": true,
2378
+ "nulls": "last"
2379
+ }
2380
+ ],
2381
+ "isUnique": true,
2382
+ "concurrently": false,
2383
+ "method": "btree",
2384
+ "with": {}
2385
+ }
2386
+ },
2387
+ "foreignKeys": {},
2388
+ "compositePrimaryKeys": {},
2389
+ "uniqueConstraints": {},
2390
+ "policies": {},
2391
+ "checkConstraints": {},
2392
+ "isRLSEnabled": false
2393
+ },
2394
+ "public.journey_logs": {
2395
+ "name": "journey_logs",
2396
+ "schema": "",
2397
+ "columns": {
2398
+ "id": {
2399
+ "name": "id",
2400
+ "type": "uuid",
2401
+ "primaryKey": true,
2402
+ "notNull": true,
2403
+ "default": "gen_random_uuid()"
2404
+ },
2405
+ "journey_state_id": {
2406
+ "name": "journey_state_id",
2407
+ "type": "uuid",
2408
+ "primaryKey": false,
2409
+ "notNull": true
2410
+ },
2411
+ "from_node_id": {
2412
+ "name": "from_node_id",
2413
+ "type": "text",
2414
+ "primaryKey": false,
2415
+ "notNull": false
2416
+ },
2417
+ "to_node_id": {
2418
+ "name": "to_node_id",
2419
+ "type": "text",
2420
+ "primaryKey": false,
2421
+ "notNull": false
2422
+ },
2423
+ "action": {
2424
+ "name": "action",
2425
+ "type": "text",
2426
+ "primaryKey": false,
2427
+ "notNull": true
2428
+ },
2429
+ "detail": {
2430
+ "name": "detail",
2431
+ "type": "jsonb",
2432
+ "primaryKey": false,
2433
+ "notNull": false
2434
+ },
2435
+ "created_at": {
2436
+ "name": "created_at",
2437
+ "type": "timestamp with time zone",
2438
+ "primaryKey": false,
2439
+ "notNull": true,
2440
+ "default": "now()"
2441
+ },
2442
+ "updated_at": {
2443
+ "name": "updated_at",
2444
+ "type": "timestamp with time zone",
2445
+ "primaryKey": false,
2446
+ "notNull": true,
2447
+ "default": "now()"
2448
+ }
2449
+ },
2450
+ "indexes": {
2451
+ "journey_logs_journey_state_id_idx": {
2452
+ "name": "journey_logs_journey_state_id_idx",
2453
+ "columns": [
2454
+ {
2455
+ "expression": "journey_state_id",
2456
+ "isExpression": false,
2457
+ "asc": true,
2458
+ "nulls": "last"
2459
+ }
2460
+ ],
2461
+ "isUnique": false,
2462
+ "concurrently": false,
2463
+ "method": "btree",
2464
+ "with": {}
2465
+ }
2466
+ },
2467
+ "foreignKeys": {
2468
+ "journey_logs_journey_state_id_journey_states_id_fk": {
2469
+ "name": "journey_logs_journey_state_id_journey_states_id_fk",
2470
+ "tableFrom": "journey_logs",
2471
+ "tableTo": "journey_states",
2472
+ "columnsFrom": [
2473
+ "journey_state_id"
2474
+ ],
2475
+ "columnsTo": [
2476
+ "id"
2477
+ ],
2478
+ "onDelete": "cascade",
2479
+ "onUpdate": "no action"
2480
+ }
2481
+ },
2482
+ "compositePrimaryKeys": {},
2483
+ "uniqueConstraints": {},
2484
+ "policies": {},
2485
+ "checkConstraints": {},
2486
+ "isRLSEnabled": false
2487
+ },
2488
+ "public.journey_states": {
2489
+ "name": "journey_states",
2490
+ "schema": "",
2491
+ "columns": {
2492
+ "id": {
2493
+ "name": "id",
2494
+ "type": "uuid",
2495
+ "primaryKey": true,
2496
+ "notNull": true,
2497
+ "default": "gen_random_uuid()"
2498
+ },
2499
+ "organization_id": {
2500
+ "name": "organization_id",
2501
+ "type": "text",
2502
+ "primaryKey": false,
2503
+ "notNull": false
2504
+ },
2505
+ "user_id": {
2506
+ "name": "user_id",
2507
+ "type": "text",
2508
+ "primaryKey": false,
2509
+ "notNull": true
2510
+ },
2511
+ "user_email": {
2512
+ "name": "user_email",
2513
+ "type": "text",
2514
+ "primaryKey": false,
2515
+ "notNull": true
2516
+ },
2517
+ "journey_id": {
2518
+ "name": "journey_id",
2519
+ "type": "text",
2520
+ "primaryKey": false,
2521
+ "notNull": true
2522
+ },
2523
+ "current_node_id": {
2524
+ "name": "current_node_id",
2525
+ "type": "text",
2526
+ "primaryKey": false,
2527
+ "notNull": true
2528
+ },
2529
+ "status": {
2530
+ "name": "status",
2531
+ "type": "journey_status",
2532
+ "typeSchema": "public",
2533
+ "primaryKey": false,
2534
+ "notNull": true,
2535
+ "default": "'active'"
2536
+ },
2537
+ "hatchet_run_id": {
2538
+ "name": "hatchet_run_id",
2539
+ "type": "text",
2540
+ "primaryKey": false,
2541
+ "notNull": false
2542
+ },
2543
+ "context": {
2544
+ "name": "context",
2545
+ "type": "jsonb",
2546
+ "primaryKey": false,
2547
+ "notNull": false,
2548
+ "default": "'{}'::jsonb"
2549
+ },
2550
+ "error_message": {
2551
+ "name": "error_message",
2552
+ "type": "text",
2553
+ "primaryKey": false,
2554
+ "notNull": false
2555
+ },
2556
+ "entry_count": {
2557
+ "name": "entry_count",
2558
+ "type": "integer",
2559
+ "primaryKey": false,
2560
+ "notNull": true,
2561
+ "default": 1
2562
+ },
2563
+ "completed_at": {
2564
+ "name": "completed_at",
2565
+ "type": "timestamp with time zone",
2566
+ "primaryKey": false,
2567
+ "notNull": false
2568
+ },
2569
+ "exited_at": {
2570
+ "name": "exited_at",
2571
+ "type": "timestamp with time zone",
2572
+ "primaryKey": false,
2573
+ "notNull": false
2574
+ },
2575
+ "deleted_at": {
2576
+ "name": "deleted_at",
2577
+ "type": "timestamp with time zone",
2578
+ "primaryKey": false,
2579
+ "notNull": false
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
+ "uq_user_journey_active": {
2598
+ "name": "uq_user_journey_active",
2599
+ "columns": [
2600
+ {
2601
+ "expression": "user_id",
2602
+ "isExpression": false,
2603
+ "asc": true,
2604
+ "nulls": "last"
2605
+ },
2606
+ {
2607
+ "expression": "journey_id",
2608
+ "isExpression": false,
2609
+ "asc": true,
2610
+ "nulls": "last"
2611
+ },
2612
+ {
2613
+ "expression": "status",
2614
+ "isExpression": false,
2615
+ "asc": true,
2616
+ "nulls": "last"
2617
+ }
2618
+ ],
2619
+ "isUnique": true,
2620
+ "concurrently": false,
2621
+ "method": "btree",
2622
+ "with": {}
2623
+ },
2624
+ "journey_states_status_idx": {
2625
+ "name": "journey_states_status_idx",
2626
+ "columns": [
2627
+ {
2628
+ "expression": "status",
2629
+ "isExpression": false,
2630
+ "asc": true,
2631
+ "nulls": "last"
2632
+ }
2633
+ ],
2634
+ "isUnique": false,
2635
+ "concurrently": false,
2636
+ "method": "btree",
2637
+ "with": {}
2638
+ },
2639
+ "journey_states_hatchet_run_idx": {
2640
+ "name": "journey_states_hatchet_run_idx",
2641
+ "columns": [
2642
+ {
2643
+ "expression": "hatchet_run_id",
2644
+ "isExpression": false,
2645
+ "asc": true,
2646
+ "nulls": "last"
2647
+ }
2648
+ ],
2649
+ "isUnique": false,
2650
+ "concurrently": false,
2651
+ "method": "btree",
2652
+ "with": {}
2653
+ },
2654
+ "journey_states_user_id_idx": {
2655
+ "name": "journey_states_user_id_idx",
2656
+ "columns": [
2657
+ {
2658
+ "expression": "user_id",
2659
+ "isExpression": false,
2660
+ "asc": true,
2661
+ "nulls": "last"
2662
+ }
2663
+ ],
2664
+ "isUnique": false,
2665
+ "concurrently": false,
2666
+ "method": "btree",
2667
+ "with": {}
2668
+ },
2669
+ "journey_states_journey_id_status_idx": {
2670
+ "name": "journey_states_journey_id_status_idx",
2671
+ "columns": [
2672
+ {
2673
+ "expression": "journey_id",
2674
+ "isExpression": false,
2675
+ "asc": true,
2676
+ "nulls": "last"
2677
+ },
2678
+ {
2679
+ "expression": "status",
2680
+ "isExpression": false,
2681
+ "asc": true,
2682
+ "nulls": "last"
2683
+ }
2684
+ ],
2685
+ "isUnique": false,
2686
+ "concurrently": false,
2687
+ "method": "btree",
2688
+ "with": {}
2689
+ }
2690
+ },
2691
+ "foreignKeys": {},
2692
+ "compositePrimaryKeys": {},
2693
+ "uniqueConstraints": {},
2694
+ "policies": {},
2695
+ "checkConstraints": {},
2696
+ "isRLSEnabled": false
2697
+ },
2698
+ "public.link_clicks": {
2699
+ "name": "link_clicks",
2700
+ "schema": "",
2701
+ "columns": {
2702
+ "id": {
2703
+ "name": "id",
2704
+ "type": "uuid",
2705
+ "primaryKey": true,
2706
+ "notNull": true,
2707
+ "default": "gen_random_uuid()"
2708
+ },
2709
+ "tracked_link_id": {
2710
+ "name": "tracked_link_id",
2711
+ "type": "uuid",
2712
+ "primaryKey": false,
2713
+ "notNull": true
2714
+ },
2715
+ "ip_address": {
2716
+ "name": "ip_address",
2717
+ "type": "text",
2718
+ "primaryKey": false,
2719
+ "notNull": false
2720
+ },
2721
+ "user_agent": {
2722
+ "name": "user_agent",
2723
+ "type": "text",
2724
+ "primaryKey": false,
2725
+ "notNull": false
2726
+ },
2727
+ "clicked_at": {
2728
+ "name": "clicked_at",
2729
+ "type": "timestamp with time zone",
2730
+ "primaryKey": false,
2731
+ "notNull": true,
2732
+ "default": "now()"
2733
+ }
2734
+ },
2735
+ "indexes": {
2736
+ "link_clicks_tracked_link_id_idx": {
2737
+ "name": "link_clicks_tracked_link_id_idx",
2738
+ "columns": [
2739
+ {
2740
+ "expression": "tracked_link_id",
2741
+ "isExpression": false,
2742
+ "asc": true,
2743
+ "nulls": "last"
2744
+ }
2745
+ ],
2746
+ "isUnique": false,
2747
+ "concurrently": false,
2748
+ "method": "btree",
2749
+ "with": {}
2750
+ },
2751
+ "link_clicks_clicked_at_idx": {
2752
+ "name": "link_clicks_clicked_at_idx",
2753
+ "columns": [
2754
+ {
2755
+ "expression": "clicked_at",
2756
+ "isExpression": false,
2757
+ "asc": true,
2758
+ "nulls": "last"
2759
+ }
2760
+ ],
2761
+ "isUnique": false,
2762
+ "concurrently": false,
2763
+ "method": "btree",
2764
+ "with": {}
2765
+ }
2766
+ },
2767
+ "foreignKeys": {
2768
+ "link_clicks_tracked_link_id_tracked_links_id_fk": {
2769
+ "name": "link_clicks_tracked_link_id_tracked_links_id_fk",
2770
+ "tableFrom": "link_clicks",
2771
+ "tableTo": "tracked_links",
2772
+ "columnsFrom": [
2773
+ "tracked_link_id"
2774
+ ],
2775
+ "columnsTo": [
2776
+ "id"
2777
+ ],
2778
+ "onDelete": "cascade",
2779
+ "onUpdate": "no action"
2780
+ }
2781
+ },
2782
+ "compositePrimaryKeys": {},
2783
+ "uniqueConstraints": {},
2784
+ "policies": {},
2785
+ "checkConstraints": {},
2786
+ "isRLSEnabled": false
2787
+ },
2788
+ "public.tracked_links": {
2789
+ "name": "tracked_links",
2790
+ "schema": "",
2791
+ "columns": {
2792
+ "id": {
2793
+ "name": "id",
2794
+ "type": "uuid",
2795
+ "primaryKey": true,
2796
+ "notNull": true,
2797
+ "default": "gen_random_uuid()"
2798
+ },
2799
+ "email_send_id": {
2800
+ "name": "email_send_id",
2801
+ "type": "uuid",
2802
+ "primaryKey": false,
2803
+ "notNull": true
2804
+ },
2805
+ "original_url": {
2806
+ "name": "original_url",
2807
+ "type": "text",
2808
+ "primaryKey": false,
2809
+ "notNull": true
2810
+ },
2811
+ "click_count": {
2812
+ "name": "click_count",
2813
+ "type": "integer",
2814
+ "primaryKey": false,
2815
+ "notNull": true,
2816
+ "default": 0
2817
+ },
2818
+ "created_at": {
2819
+ "name": "created_at",
2820
+ "type": "timestamp with time zone",
2821
+ "primaryKey": false,
2822
+ "notNull": true,
2823
+ "default": "now()"
2824
+ },
2825
+ "updated_at": {
2826
+ "name": "updated_at",
2827
+ "type": "timestamp with time zone",
2828
+ "primaryKey": false,
2829
+ "notNull": true,
2830
+ "default": "now()"
2831
+ }
2832
+ },
2833
+ "indexes": {
2834
+ "tracked_links_email_send_id_idx": {
2835
+ "name": "tracked_links_email_send_id_idx",
2836
+ "columns": [
2837
+ {
2838
+ "expression": "email_send_id",
2839
+ "isExpression": false,
2840
+ "asc": true,
2841
+ "nulls": "last"
2842
+ }
2843
+ ],
2844
+ "isUnique": false,
2845
+ "concurrently": false,
2846
+ "method": "btree",
2847
+ "with": {}
2848
+ }
2849
+ },
2850
+ "foreignKeys": {
2851
+ "tracked_links_email_send_id_email_sends_id_fk": {
2852
+ "name": "tracked_links_email_send_id_email_sends_id_fk",
2853
+ "tableFrom": "tracked_links",
2854
+ "tableTo": "email_sends",
2855
+ "columnsFrom": [
2856
+ "email_send_id"
2857
+ ],
2858
+ "columnsTo": [
2859
+ "id"
2860
+ ],
2861
+ "onDelete": "cascade",
2862
+ "onUpdate": "no action"
2863
+ }
2864
+ },
2865
+ "compositePrimaryKeys": {},
2866
+ "uniqueConstraints": {},
2867
+ "policies": {},
2868
+ "checkConstraints": {},
2869
+ "isRLSEnabled": false
2870
+ },
2871
+ "public.user_events": {
2872
+ "name": "user_events",
2873
+ "schema": "",
2874
+ "columns": {
2875
+ "id": {
2876
+ "name": "id",
2877
+ "type": "uuid",
2878
+ "primaryKey": true,
2879
+ "notNull": true,
2880
+ "default": "gen_random_uuid()"
2881
+ },
2882
+ "organization_id": {
2883
+ "name": "organization_id",
2884
+ "type": "text",
2885
+ "primaryKey": false,
2886
+ "notNull": false
2887
+ },
2888
+ "user_id": {
2889
+ "name": "user_id",
2890
+ "type": "text",
2891
+ "primaryKey": false,
2892
+ "notNull": true
2893
+ },
2894
+ "event": {
2895
+ "name": "event",
2896
+ "type": "text",
2897
+ "primaryKey": false,
2898
+ "notNull": true
2899
+ },
2900
+ "properties": {
2901
+ "name": "properties",
2902
+ "type": "jsonb",
2903
+ "primaryKey": false,
2904
+ "notNull": false
2905
+ },
2906
+ "idempotency_key": {
2907
+ "name": "idempotency_key",
2908
+ "type": "text",
2909
+ "primaryKey": false,
2910
+ "notNull": false
2911
+ },
2912
+ "occurred_at": {
2913
+ "name": "occurred_at",
2914
+ "type": "timestamp with time zone",
2915
+ "primaryKey": false,
2916
+ "notNull": true,
2917
+ "default": "now()"
2918
+ }
2919
+ },
2920
+ "indexes": {
2921
+ "user_events_user_id_idx": {
2922
+ "name": "user_events_user_id_idx",
2923
+ "columns": [
2924
+ {
2925
+ "expression": "user_id",
2926
+ "isExpression": false,
2927
+ "asc": true,
2928
+ "nulls": "last"
2929
+ }
2930
+ ],
2931
+ "isUnique": false,
2932
+ "concurrently": false,
2933
+ "method": "btree",
2934
+ "with": {}
2935
+ },
2936
+ "user_events_event_idx": {
2937
+ "name": "user_events_event_idx",
2938
+ "columns": [
2939
+ {
2940
+ "expression": "event",
2941
+ "isExpression": false,
2942
+ "asc": true,
2943
+ "nulls": "last"
2944
+ }
2945
+ ],
2946
+ "isUnique": false,
2947
+ "concurrently": false,
2948
+ "method": "btree",
2949
+ "with": {}
2950
+ },
2951
+ "user_events_occurred_at_idx": {
2952
+ "name": "user_events_occurred_at_idx",
2953
+ "columns": [
2954
+ {
2955
+ "expression": "occurred_at",
2956
+ "isExpression": false,
2957
+ "asc": true,
2958
+ "nulls": "last"
2959
+ }
2960
+ ],
2961
+ "isUnique": false,
2962
+ "concurrently": false,
2963
+ "method": "btree",
2964
+ "with": {}
2965
+ },
2966
+ "user_events_user_event_occurred_idx": {
2967
+ "name": "user_events_user_event_occurred_idx",
2968
+ "columns": [
2969
+ {
2970
+ "expression": "user_id",
2971
+ "isExpression": false,
2972
+ "asc": true,
2973
+ "nulls": "last"
2974
+ },
2975
+ {
2976
+ "expression": "event",
2977
+ "isExpression": false,
2978
+ "asc": true,
2979
+ "nulls": "last"
2980
+ },
2981
+ {
2982
+ "expression": "occurred_at",
2983
+ "isExpression": false,
2984
+ "asc": true,
2985
+ "nulls": "last"
2986
+ }
2987
+ ],
2988
+ "isUnique": false,
2989
+ "concurrently": false,
2990
+ "method": "btree",
2991
+ "with": {}
2992
+ },
2993
+ "user_events_idempotency_key_idx": {
2994
+ "name": "user_events_idempotency_key_idx",
2995
+ "columns": [
2996
+ {
2997
+ "expression": "idempotency_key",
2998
+ "isExpression": false,
2999
+ "asc": true,
3000
+ "nulls": "last"
3001
+ }
3002
+ ],
3003
+ "isUnique": true,
3004
+ "concurrently": false,
3005
+ "method": "btree",
3006
+ "with": {}
3007
+ }
3008
+ },
3009
+ "foreignKeys": {},
3010
+ "compositePrimaryKeys": {},
3011
+ "uniqueConstraints": {},
3012
+ "policies": {},
3013
+ "checkConstraints": {},
3014
+ "isRLSEnabled": false
3015
+ }
3016
+ },
3017
+ "enums": {
3018
+ "public.alert_channel": {
3019
+ "name": "alert_channel",
3020
+ "schema": "public",
3021
+ "values": [
3022
+ "webhook",
3023
+ "slack",
3024
+ "email"
3025
+ ]
3026
+ },
3027
+ "public.alert_rule_type": {
3028
+ "name": "alert_rule_type",
3029
+ "schema": "public",
3030
+ "values": [
3031
+ "bounce_rate_exceeded",
3032
+ "journey_failure_spike",
3033
+ "delivery_issue",
3034
+ "high_complaint_rate"
3035
+ ]
3036
+ },
3037
+ "public.bucket_membership_status": {
3038
+ "name": "bucket_membership_status",
3039
+ "schema": "public",
3040
+ "values": [
3041
+ "active",
3042
+ "left"
3043
+ ]
3044
+ },
3045
+ "public.dlq_status": {
3046
+ "name": "dlq_status",
3047
+ "schema": "public",
3048
+ "values": [
3049
+ "pending",
3050
+ "retried",
3051
+ "discarded"
3052
+ ]
3053
+ },
3054
+ "public.email_send_status": {
3055
+ "name": "email_send_status",
3056
+ "schema": "public",
3057
+ "values": [
3058
+ "queued",
3059
+ "rendered",
3060
+ "sent",
3061
+ "delivered",
3062
+ "opened",
3063
+ "clicked",
3064
+ "bounced",
3065
+ "complained",
3066
+ "failed"
3067
+ ]
3068
+ },
3069
+ "public.import_job_status": {
3070
+ "name": "import_job_status",
3071
+ "schema": "public",
3072
+ "values": [
3073
+ "pending",
3074
+ "processing",
3075
+ "completed",
3076
+ "failed"
3077
+ ]
3078
+ },
3079
+ "public.journey_status": {
3080
+ "name": "journey_status",
3081
+ "schema": "public",
3082
+ "values": [
3083
+ "active",
3084
+ "waiting",
3085
+ "completed",
3086
+ "failed",
3087
+ "exited"
3088
+ ]
3089
+ }
3090
+ },
3091
+ "schemas": {},
3092
+ "sequences": {},
3093
+ "roles": {},
3094
+ "policies": {},
3095
+ "views": {},
3096
+ "_meta": {
3097
+ "columns": {},
3098
+ "schemas": {},
3099
+ "tables": {}
3100
+ }
3101
+ }