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