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