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