@hogsend/db 0.0.1

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.
Files changed (47) hide show
  1. package/LICENSE +93 -0
  2. package/README.md +14 -0
  3. package/drizzle/0000_nifty_songbird.sql +188 -0
  4. package/drizzle/0001_minor_shockwave.sql +13 -0
  5. package/drizzle/0002_early_owl.sql +1 -0
  6. package/drizzle/0003_bizarre_annihilus.sql +9 -0
  7. package/drizzle/0004_brave_betty_brant.sql +1 -0
  8. package/drizzle/0005_groovy_princess_powerful.sql +8 -0
  9. package/drizzle/0006_groovy_charles_xavier.sql +100 -0
  10. package/drizzle/0007_serious_captain_universe.sql +1 -0
  11. package/drizzle/0008_demonic_agent_brand.sql +5 -0
  12. package/drizzle/meta/0000_snapshot.json +1264 -0
  13. package/drizzle/meta/0001_snapshot.json +1353 -0
  14. package/drizzle/meta/0002_snapshot.json +1380 -0
  15. package/drizzle/meta/0003_snapshot.json +1443 -0
  16. package/drizzle/meta/0004_snapshot.json +1464 -0
  17. package/drizzle/meta/0005_snapshot.json +1588 -0
  18. package/drizzle/meta/0006_snapshot.json +2331 -0
  19. package/drizzle/meta/0007_snapshot.json +2346 -0
  20. package/drizzle/meta/0008_snapshot.json +2449 -0
  21. package/drizzle/meta/_journal.json +69 -0
  22. package/package.json +49 -0
  23. package/src/index.ts +35 -0
  24. package/src/migrate-client.ts +56 -0
  25. package/src/migrate.ts +173 -0
  26. package/src/schema/_shared.ts +10 -0
  27. package/src/schema/alert-history.ts +21 -0
  28. package/src/schema/alert-rules.ts +36 -0
  29. package/src/schema/api-keys.ts +30 -0
  30. package/src/schema/audit-logs.ts +22 -0
  31. package/src/schema/auth.ts +89 -0
  32. package/src/schema/contacts.ts +31 -0
  33. package/src/schema/dead-letter-queue.ts +31 -0
  34. package/src/schema/email-preferences.ts +35 -0
  35. package/src/schema/email-sends.ts +34 -0
  36. package/src/schema/enums.ts +47 -0
  37. package/src/schema/import-jobs.ts +26 -0
  38. package/src/schema/index.ts +18 -0
  39. package/src/schema/journey-configs.ts +15 -0
  40. package/src/schema/journey-logs.ts +21 -0
  41. package/src/schema/journey-states.ts +54 -0
  42. package/src/schema/link-clicks.ts +21 -0
  43. package/src/schema/relations.ts +160 -0
  44. package/src/schema/tracked-links.ts +17 -0
  45. package/src/schema/user-events.ts +35 -0
  46. package/src/seed.ts +91 -0
  47. package/src/version.ts +162 -0
@@ -0,0 +1,1264 @@
1
+ {
2
+ "id": "e83e28ee-c2ab-4708-bbfb-3444f0a15069",
3
+ "prevId": "00000000-0000-0000-0000-000000000000",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.account": {
8
+ "name": "account",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "account_id": {
18
+ "name": "account_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "provider_id": {
24
+ "name": "provider_id",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": true
28
+ },
29
+ "user_id": {
30
+ "name": "user_id",
31
+ "type": "text",
32
+ "primaryKey": false,
33
+ "notNull": true
34
+ },
35
+ "access_token": {
36
+ "name": "access_token",
37
+ "type": "text",
38
+ "primaryKey": false,
39
+ "notNull": false
40
+ },
41
+ "refresh_token": {
42
+ "name": "refresh_token",
43
+ "type": "text",
44
+ "primaryKey": false,
45
+ "notNull": false
46
+ },
47
+ "id_token": {
48
+ "name": "id_token",
49
+ "type": "text",
50
+ "primaryKey": false,
51
+ "notNull": false
52
+ },
53
+ "access_token_expires_at": {
54
+ "name": "access_token_expires_at",
55
+ "type": "timestamp with time zone",
56
+ "primaryKey": false,
57
+ "notNull": false
58
+ },
59
+ "refresh_token_expires_at": {
60
+ "name": "refresh_token_expires_at",
61
+ "type": "timestamp with time zone",
62
+ "primaryKey": false,
63
+ "notNull": false
64
+ },
65
+ "scope": {
66
+ "name": "scope",
67
+ "type": "text",
68
+ "primaryKey": false,
69
+ "notNull": false
70
+ },
71
+ "password": {
72
+ "name": "password",
73
+ "type": "text",
74
+ "primaryKey": false,
75
+ "notNull": false
76
+ },
77
+ "created_at": {
78
+ "name": "created_at",
79
+ "type": "timestamp with time zone",
80
+ "primaryKey": false,
81
+ "notNull": true,
82
+ "default": "now()"
83
+ },
84
+ "updated_at": {
85
+ "name": "updated_at",
86
+ "type": "timestamp with time zone",
87
+ "primaryKey": false,
88
+ "notNull": true,
89
+ "default": "now()"
90
+ }
91
+ },
92
+ "indexes": {},
93
+ "foreignKeys": {
94
+ "account_user_id_user_id_fk": {
95
+ "name": "account_user_id_user_id_fk",
96
+ "tableFrom": "account",
97
+ "tableTo": "user",
98
+ "columnsFrom": ["user_id"],
99
+ "columnsTo": ["id"],
100
+ "onDelete": "cascade",
101
+ "onUpdate": "no action"
102
+ }
103
+ },
104
+ "compositePrimaryKeys": {},
105
+ "uniqueConstraints": {},
106
+ "policies": {},
107
+ "checkConstraints": {},
108
+ "isRLSEnabled": false
109
+ },
110
+ "public.invitation": {
111
+ "name": "invitation",
112
+ "schema": "",
113
+ "columns": {
114
+ "id": {
115
+ "name": "id",
116
+ "type": "text",
117
+ "primaryKey": true,
118
+ "notNull": true
119
+ },
120
+ "organization_id": {
121
+ "name": "organization_id",
122
+ "type": "text",
123
+ "primaryKey": false,
124
+ "notNull": true
125
+ },
126
+ "email": {
127
+ "name": "email",
128
+ "type": "text",
129
+ "primaryKey": false,
130
+ "notNull": true
131
+ },
132
+ "role": {
133
+ "name": "role",
134
+ "type": "text",
135
+ "primaryKey": false,
136
+ "notNull": false
137
+ },
138
+ "status": {
139
+ "name": "status",
140
+ "type": "text",
141
+ "primaryKey": false,
142
+ "notNull": true,
143
+ "default": "'pending'"
144
+ },
145
+ "expires_at": {
146
+ "name": "expires_at",
147
+ "type": "timestamp with time zone",
148
+ "primaryKey": false,
149
+ "notNull": true
150
+ },
151
+ "inviter_id": {
152
+ "name": "inviter_id",
153
+ "type": "text",
154
+ "primaryKey": false,
155
+ "notNull": true
156
+ },
157
+ "created_at": {
158
+ "name": "created_at",
159
+ "type": "timestamp with time zone",
160
+ "primaryKey": false,
161
+ "notNull": true,
162
+ "default": "now()"
163
+ },
164
+ "updated_at": {
165
+ "name": "updated_at",
166
+ "type": "timestamp with time zone",
167
+ "primaryKey": false,
168
+ "notNull": true,
169
+ "default": "now()"
170
+ }
171
+ },
172
+ "indexes": {},
173
+ "foreignKeys": {
174
+ "invitation_organization_id_organization_id_fk": {
175
+ "name": "invitation_organization_id_organization_id_fk",
176
+ "tableFrom": "invitation",
177
+ "tableTo": "organization",
178
+ "columnsFrom": ["organization_id"],
179
+ "columnsTo": ["id"],
180
+ "onDelete": "cascade",
181
+ "onUpdate": "no action"
182
+ },
183
+ "invitation_inviter_id_user_id_fk": {
184
+ "name": "invitation_inviter_id_user_id_fk",
185
+ "tableFrom": "invitation",
186
+ "tableTo": "user",
187
+ "columnsFrom": ["inviter_id"],
188
+ "columnsTo": ["id"],
189
+ "onDelete": "cascade",
190
+ "onUpdate": "no action"
191
+ }
192
+ },
193
+ "compositePrimaryKeys": {},
194
+ "uniqueConstraints": {},
195
+ "policies": {},
196
+ "checkConstraints": {},
197
+ "isRLSEnabled": false
198
+ },
199
+ "public.member": {
200
+ "name": "member",
201
+ "schema": "",
202
+ "columns": {
203
+ "id": {
204
+ "name": "id",
205
+ "type": "text",
206
+ "primaryKey": true,
207
+ "notNull": true
208
+ },
209
+ "organization_id": {
210
+ "name": "organization_id",
211
+ "type": "text",
212
+ "primaryKey": false,
213
+ "notNull": true
214
+ },
215
+ "user_id": {
216
+ "name": "user_id",
217
+ "type": "text",
218
+ "primaryKey": false,
219
+ "notNull": true
220
+ },
221
+ "role": {
222
+ "name": "role",
223
+ "type": "text",
224
+ "primaryKey": false,
225
+ "notNull": true,
226
+ "default": "'member'"
227
+ },
228
+ "created_at": {
229
+ "name": "created_at",
230
+ "type": "timestamp with time zone",
231
+ "primaryKey": false,
232
+ "notNull": true,
233
+ "default": "now()"
234
+ },
235
+ "updated_at": {
236
+ "name": "updated_at",
237
+ "type": "timestamp with time zone",
238
+ "primaryKey": false,
239
+ "notNull": true,
240
+ "default": "now()"
241
+ }
242
+ },
243
+ "indexes": {},
244
+ "foreignKeys": {
245
+ "member_organization_id_organization_id_fk": {
246
+ "name": "member_organization_id_organization_id_fk",
247
+ "tableFrom": "member",
248
+ "tableTo": "organization",
249
+ "columnsFrom": ["organization_id"],
250
+ "columnsTo": ["id"],
251
+ "onDelete": "cascade",
252
+ "onUpdate": "no action"
253
+ },
254
+ "member_user_id_user_id_fk": {
255
+ "name": "member_user_id_user_id_fk",
256
+ "tableFrom": "member",
257
+ "tableTo": "user",
258
+ "columnsFrom": ["user_id"],
259
+ "columnsTo": ["id"],
260
+ "onDelete": "cascade",
261
+ "onUpdate": "no action"
262
+ }
263
+ },
264
+ "compositePrimaryKeys": {},
265
+ "uniqueConstraints": {},
266
+ "policies": {},
267
+ "checkConstraints": {},
268
+ "isRLSEnabled": false
269
+ },
270
+ "public.organization": {
271
+ "name": "organization",
272
+ "schema": "",
273
+ "columns": {
274
+ "id": {
275
+ "name": "id",
276
+ "type": "text",
277
+ "primaryKey": true,
278
+ "notNull": true
279
+ },
280
+ "name": {
281
+ "name": "name",
282
+ "type": "text",
283
+ "primaryKey": false,
284
+ "notNull": true
285
+ },
286
+ "slug": {
287
+ "name": "slug",
288
+ "type": "text",
289
+ "primaryKey": false,
290
+ "notNull": false
291
+ },
292
+ "logo": {
293
+ "name": "logo",
294
+ "type": "text",
295
+ "primaryKey": false,
296
+ "notNull": false
297
+ },
298
+ "metadata": {
299
+ "name": "metadata",
300
+ "type": "text",
301
+ "primaryKey": false,
302
+ "notNull": false
303
+ },
304
+ "created_at": {
305
+ "name": "created_at",
306
+ "type": "timestamp with time zone",
307
+ "primaryKey": false,
308
+ "notNull": true,
309
+ "default": "now()"
310
+ },
311
+ "updated_at": {
312
+ "name": "updated_at",
313
+ "type": "timestamp with time zone",
314
+ "primaryKey": false,
315
+ "notNull": true,
316
+ "default": "now()"
317
+ }
318
+ },
319
+ "indexes": {},
320
+ "foreignKeys": {},
321
+ "compositePrimaryKeys": {},
322
+ "uniqueConstraints": {
323
+ "organization_slug_unique": {
324
+ "name": "organization_slug_unique",
325
+ "nullsNotDistinct": false,
326
+ "columns": ["slug"]
327
+ }
328
+ },
329
+ "policies": {},
330
+ "checkConstraints": {},
331
+ "isRLSEnabled": false
332
+ },
333
+ "public.session": {
334
+ "name": "session",
335
+ "schema": "",
336
+ "columns": {
337
+ "id": {
338
+ "name": "id",
339
+ "type": "text",
340
+ "primaryKey": true,
341
+ "notNull": true
342
+ },
343
+ "expires_at": {
344
+ "name": "expires_at",
345
+ "type": "timestamp with time zone",
346
+ "primaryKey": false,
347
+ "notNull": true
348
+ },
349
+ "token": {
350
+ "name": "token",
351
+ "type": "text",
352
+ "primaryKey": false,
353
+ "notNull": true
354
+ },
355
+ "ip_address": {
356
+ "name": "ip_address",
357
+ "type": "text",
358
+ "primaryKey": false,
359
+ "notNull": false
360
+ },
361
+ "user_agent": {
362
+ "name": "user_agent",
363
+ "type": "text",
364
+ "primaryKey": false,
365
+ "notNull": false
366
+ },
367
+ "user_id": {
368
+ "name": "user_id",
369
+ "type": "text",
370
+ "primaryKey": false,
371
+ "notNull": true
372
+ },
373
+ "active_organization_id": {
374
+ "name": "active_organization_id",
375
+ "type": "text",
376
+ "primaryKey": false,
377
+ "notNull": false
378
+ },
379
+ "created_at": {
380
+ "name": "created_at",
381
+ "type": "timestamp with time zone",
382
+ "primaryKey": false,
383
+ "notNull": true,
384
+ "default": "now()"
385
+ },
386
+ "updated_at": {
387
+ "name": "updated_at",
388
+ "type": "timestamp with time zone",
389
+ "primaryKey": false,
390
+ "notNull": true,
391
+ "default": "now()"
392
+ }
393
+ },
394
+ "indexes": {},
395
+ "foreignKeys": {
396
+ "session_user_id_user_id_fk": {
397
+ "name": "session_user_id_user_id_fk",
398
+ "tableFrom": "session",
399
+ "tableTo": "user",
400
+ "columnsFrom": ["user_id"],
401
+ "columnsTo": ["id"],
402
+ "onDelete": "cascade",
403
+ "onUpdate": "no action"
404
+ }
405
+ },
406
+ "compositePrimaryKeys": {},
407
+ "uniqueConstraints": {
408
+ "session_token_unique": {
409
+ "name": "session_token_unique",
410
+ "nullsNotDistinct": false,
411
+ "columns": ["token"]
412
+ }
413
+ },
414
+ "policies": {},
415
+ "checkConstraints": {},
416
+ "isRLSEnabled": false
417
+ },
418
+ "public.user": {
419
+ "name": "user",
420
+ "schema": "",
421
+ "columns": {
422
+ "id": {
423
+ "name": "id",
424
+ "type": "text",
425
+ "primaryKey": true,
426
+ "notNull": true
427
+ },
428
+ "name": {
429
+ "name": "name",
430
+ "type": "text",
431
+ "primaryKey": false,
432
+ "notNull": true
433
+ },
434
+ "email": {
435
+ "name": "email",
436
+ "type": "text",
437
+ "primaryKey": false,
438
+ "notNull": true
439
+ },
440
+ "email_verified": {
441
+ "name": "email_verified",
442
+ "type": "boolean",
443
+ "primaryKey": false,
444
+ "notNull": true,
445
+ "default": false
446
+ },
447
+ "image": {
448
+ "name": "image",
449
+ "type": "text",
450
+ "primaryKey": false,
451
+ "notNull": false
452
+ },
453
+ "created_at": {
454
+ "name": "created_at",
455
+ "type": "timestamp with time zone",
456
+ "primaryKey": false,
457
+ "notNull": true,
458
+ "default": "now()"
459
+ },
460
+ "updated_at": {
461
+ "name": "updated_at",
462
+ "type": "timestamp with time zone",
463
+ "primaryKey": false,
464
+ "notNull": true,
465
+ "default": "now()"
466
+ }
467
+ },
468
+ "indexes": {},
469
+ "foreignKeys": {},
470
+ "compositePrimaryKeys": {},
471
+ "uniqueConstraints": {
472
+ "user_email_unique": {
473
+ "name": "user_email_unique",
474
+ "nullsNotDistinct": false,
475
+ "columns": ["email"]
476
+ }
477
+ },
478
+ "policies": {},
479
+ "checkConstraints": {},
480
+ "isRLSEnabled": false
481
+ },
482
+ "public.verification": {
483
+ "name": "verification",
484
+ "schema": "",
485
+ "columns": {
486
+ "id": {
487
+ "name": "id",
488
+ "type": "text",
489
+ "primaryKey": true,
490
+ "notNull": true
491
+ },
492
+ "identifier": {
493
+ "name": "identifier",
494
+ "type": "text",
495
+ "primaryKey": false,
496
+ "notNull": true
497
+ },
498
+ "value": {
499
+ "name": "value",
500
+ "type": "text",
501
+ "primaryKey": false,
502
+ "notNull": true
503
+ },
504
+ "expires_at": {
505
+ "name": "expires_at",
506
+ "type": "timestamp with time zone",
507
+ "primaryKey": false,
508
+ "notNull": true
509
+ },
510
+ "created_at": {
511
+ "name": "created_at",
512
+ "type": "timestamp with time zone",
513
+ "primaryKey": false,
514
+ "notNull": true,
515
+ "default": "now()"
516
+ },
517
+ "updated_at": {
518
+ "name": "updated_at",
519
+ "type": "timestamp with time zone",
520
+ "primaryKey": false,
521
+ "notNull": true,
522
+ "default": "now()"
523
+ }
524
+ },
525
+ "indexes": {},
526
+ "foreignKeys": {},
527
+ "compositePrimaryKeys": {},
528
+ "uniqueConstraints": {},
529
+ "policies": {},
530
+ "checkConstraints": {},
531
+ "isRLSEnabled": false
532
+ },
533
+ "public.email_preferences": {
534
+ "name": "email_preferences",
535
+ "schema": "",
536
+ "columns": {
537
+ "id": {
538
+ "name": "id",
539
+ "type": "uuid",
540
+ "primaryKey": true,
541
+ "notNull": true,
542
+ "default": "gen_random_uuid()"
543
+ },
544
+ "user_id": {
545
+ "name": "user_id",
546
+ "type": "text",
547
+ "primaryKey": false,
548
+ "notNull": true
549
+ },
550
+ "email": {
551
+ "name": "email",
552
+ "type": "text",
553
+ "primaryKey": false,
554
+ "notNull": true
555
+ },
556
+ "unsubscribed_all": {
557
+ "name": "unsubscribed_all",
558
+ "type": "boolean",
559
+ "primaryKey": false,
560
+ "notNull": true,
561
+ "default": false
562
+ },
563
+ "suppressed": {
564
+ "name": "suppressed",
565
+ "type": "boolean",
566
+ "primaryKey": false,
567
+ "notNull": true,
568
+ "default": false
569
+ },
570
+ "bounce_count": {
571
+ "name": "bounce_count",
572
+ "type": "integer",
573
+ "primaryKey": false,
574
+ "notNull": true,
575
+ "default": 0
576
+ },
577
+ "categories": {
578
+ "name": "categories",
579
+ "type": "jsonb",
580
+ "primaryKey": false,
581
+ "notNull": false,
582
+ "default": "'{}'::jsonb"
583
+ },
584
+ "suppressed_at": {
585
+ "name": "suppressed_at",
586
+ "type": "timestamp with time zone",
587
+ "primaryKey": false,
588
+ "notNull": false
589
+ },
590
+ "last_bounce_at": {
591
+ "name": "last_bounce_at",
592
+ "type": "timestamp with time zone",
593
+ "primaryKey": false,
594
+ "notNull": false
595
+ },
596
+ "created_at": {
597
+ "name": "created_at",
598
+ "type": "timestamp with time zone",
599
+ "primaryKey": false,
600
+ "notNull": true,
601
+ "default": "now()"
602
+ },
603
+ "updated_at": {
604
+ "name": "updated_at",
605
+ "type": "timestamp with time zone",
606
+ "primaryKey": false,
607
+ "notNull": true,
608
+ "default": "now()"
609
+ }
610
+ },
611
+ "indexes": {
612
+ "email_preferences_user_email_idx": {
613
+ "name": "email_preferences_user_email_idx",
614
+ "columns": [
615
+ {
616
+ "expression": "user_id",
617
+ "isExpression": false,
618
+ "asc": true,
619
+ "nulls": "last"
620
+ },
621
+ {
622
+ "expression": "email",
623
+ "isExpression": false,
624
+ "asc": true,
625
+ "nulls": "last"
626
+ }
627
+ ],
628
+ "isUnique": true,
629
+ "concurrently": false,
630
+ "method": "btree",
631
+ "with": {}
632
+ }
633
+ },
634
+ "foreignKeys": {},
635
+ "compositePrimaryKeys": {},
636
+ "uniqueConstraints": {},
637
+ "policies": {},
638
+ "checkConstraints": {},
639
+ "isRLSEnabled": false
640
+ },
641
+ "public.email_sends": {
642
+ "name": "email_sends",
643
+ "schema": "",
644
+ "columns": {
645
+ "id": {
646
+ "name": "id",
647
+ "type": "uuid",
648
+ "primaryKey": true,
649
+ "notNull": true,
650
+ "default": "gen_random_uuid()"
651
+ },
652
+ "journey_state_id": {
653
+ "name": "journey_state_id",
654
+ "type": "uuid",
655
+ "primaryKey": false,
656
+ "notNull": false
657
+ },
658
+ "template_key": {
659
+ "name": "template_key",
660
+ "type": "text",
661
+ "primaryKey": false,
662
+ "notNull": false
663
+ },
664
+ "resend_id": {
665
+ "name": "resend_id",
666
+ "type": "text",
667
+ "primaryKey": false,
668
+ "notNull": false
669
+ },
670
+ "from_email": {
671
+ "name": "from_email",
672
+ "type": "text",
673
+ "primaryKey": false,
674
+ "notNull": true
675
+ },
676
+ "to_email": {
677
+ "name": "to_email",
678
+ "type": "text",
679
+ "primaryKey": false,
680
+ "notNull": true
681
+ },
682
+ "subject": {
683
+ "name": "subject",
684
+ "type": "text",
685
+ "primaryKey": false,
686
+ "notNull": true
687
+ },
688
+ "category": {
689
+ "name": "category",
690
+ "type": "text",
691
+ "primaryKey": false,
692
+ "notNull": false
693
+ },
694
+ "status": {
695
+ "name": "status",
696
+ "type": "email_send_status",
697
+ "typeSchema": "public",
698
+ "primaryKey": false,
699
+ "notNull": true,
700
+ "default": "'queued'"
701
+ },
702
+ "sent_at": {
703
+ "name": "sent_at",
704
+ "type": "timestamp with time zone",
705
+ "primaryKey": false,
706
+ "notNull": false
707
+ },
708
+ "delivered_at": {
709
+ "name": "delivered_at",
710
+ "type": "timestamp with time zone",
711
+ "primaryKey": false,
712
+ "notNull": false
713
+ },
714
+ "opened_at": {
715
+ "name": "opened_at",
716
+ "type": "timestamp with time zone",
717
+ "primaryKey": false,
718
+ "notNull": false
719
+ },
720
+ "clicked_at": {
721
+ "name": "clicked_at",
722
+ "type": "timestamp with time zone",
723
+ "primaryKey": false,
724
+ "notNull": false
725
+ },
726
+ "bounced_at": {
727
+ "name": "bounced_at",
728
+ "type": "timestamp with time zone",
729
+ "primaryKey": false,
730
+ "notNull": false
731
+ },
732
+ "complained_at": {
733
+ "name": "complained_at",
734
+ "type": "timestamp with time zone",
735
+ "primaryKey": false,
736
+ "notNull": false
737
+ },
738
+ "created_at": {
739
+ "name": "created_at",
740
+ "type": "timestamp with time zone",
741
+ "primaryKey": false,
742
+ "notNull": true,
743
+ "default": "now()"
744
+ },
745
+ "updated_at": {
746
+ "name": "updated_at",
747
+ "type": "timestamp with time zone",
748
+ "primaryKey": false,
749
+ "notNull": true,
750
+ "default": "now()"
751
+ }
752
+ },
753
+ "indexes": {},
754
+ "foreignKeys": {
755
+ "email_sends_journey_state_id_journey_states_id_fk": {
756
+ "name": "email_sends_journey_state_id_journey_states_id_fk",
757
+ "tableFrom": "email_sends",
758
+ "tableTo": "journey_states",
759
+ "columnsFrom": ["journey_state_id"],
760
+ "columnsTo": ["id"],
761
+ "onDelete": "no action",
762
+ "onUpdate": "no action"
763
+ }
764
+ },
765
+ "compositePrimaryKeys": {},
766
+ "uniqueConstraints": {},
767
+ "policies": {},
768
+ "checkConstraints": {},
769
+ "isRLSEnabled": false
770
+ },
771
+ "public.journey_logs": {
772
+ "name": "journey_logs",
773
+ "schema": "",
774
+ "columns": {
775
+ "id": {
776
+ "name": "id",
777
+ "type": "uuid",
778
+ "primaryKey": true,
779
+ "notNull": true,
780
+ "default": "gen_random_uuid()"
781
+ },
782
+ "journey_state_id": {
783
+ "name": "journey_state_id",
784
+ "type": "uuid",
785
+ "primaryKey": false,
786
+ "notNull": true
787
+ },
788
+ "from_node_id": {
789
+ "name": "from_node_id",
790
+ "type": "text",
791
+ "primaryKey": false,
792
+ "notNull": false
793
+ },
794
+ "to_node_id": {
795
+ "name": "to_node_id",
796
+ "type": "text",
797
+ "primaryKey": false,
798
+ "notNull": false
799
+ },
800
+ "action": {
801
+ "name": "action",
802
+ "type": "text",
803
+ "primaryKey": false,
804
+ "notNull": true
805
+ },
806
+ "detail": {
807
+ "name": "detail",
808
+ "type": "jsonb",
809
+ "primaryKey": false,
810
+ "notNull": false
811
+ },
812
+ "created_at": {
813
+ "name": "created_at",
814
+ "type": "timestamp with time zone",
815
+ "primaryKey": false,
816
+ "notNull": true,
817
+ "default": "now()"
818
+ },
819
+ "updated_at": {
820
+ "name": "updated_at",
821
+ "type": "timestamp with time zone",
822
+ "primaryKey": false,
823
+ "notNull": true,
824
+ "default": "now()"
825
+ }
826
+ },
827
+ "indexes": {},
828
+ "foreignKeys": {
829
+ "journey_logs_journey_state_id_journey_states_id_fk": {
830
+ "name": "journey_logs_journey_state_id_journey_states_id_fk",
831
+ "tableFrom": "journey_logs",
832
+ "tableTo": "journey_states",
833
+ "columnsFrom": ["journey_state_id"],
834
+ "columnsTo": ["id"],
835
+ "onDelete": "cascade",
836
+ "onUpdate": "no action"
837
+ }
838
+ },
839
+ "compositePrimaryKeys": {},
840
+ "uniqueConstraints": {},
841
+ "policies": {},
842
+ "checkConstraints": {},
843
+ "isRLSEnabled": false
844
+ },
845
+ "public.journey_states": {
846
+ "name": "journey_states",
847
+ "schema": "",
848
+ "columns": {
849
+ "id": {
850
+ "name": "id",
851
+ "type": "uuid",
852
+ "primaryKey": true,
853
+ "notNull": true,
854
+ "default": "gen_random_uuid()"
855
+ },
856
+ "user_id": {
857
+ "name": "user_id",
858
+ "type": "text",
859
+ "primaryKey": false,
860
+ "notNull": true
861
+ },
862
+ "user_email": {
863
+ "name": "user_email",
864
+ "type": "text",
865
+ "primaryKey": false,
866
+ "notNull": true
867
+ },
868
+ "journey_id": {
869
+ "name": "journey_id",
870
+ "type": "text",
871
+ "primaryKey": false,
872
+ "notNull": true
873
+ },
874
+ "current_node_id": {
875
+ "name": "current_node_id",
876
+ "type": "text",
877
+ "primaryKey": false,
878
+ "notNull": true
879
+ },
880
+ "status": {
881
+ "name": "status",
882
+ "type": "journey_status",
883
+ "typeSchema": "public",
884
+ "primaryKey": false,
885
+ "notNull": true,
886
+ "default": "'active'"
887
+ },
888
+ "hatchet_run_id": {
889
+ "name": "hatchet_run_id",
890
+ "type": "text",
891
+ "primaryKey": false,
892
+ "notNull": false
893
+ },
894
+ "context": {
895
+ "name": "context",
896
+ "type": "jsonb",
897
+ "primaryKey": false,
898
+ "notNull": false,
899
+ "default": "'{}'::jsonb"
900
+ },
901
+ "error_message": {
902
+ "name": "error_message",
903
+ "type": "text",
904
+ "primaryKey": false,
905
+ "notNull": false
906
+ },
907
+ "entry_count": {
908
+ "name": "entry_count",
909
+ "type": "integer",
910
+ "primaryKey": false,
911
+ "notNull": true,
912
+ "default": 1
913
+ },
914
+ "completed_at": {
915
+ "name": "completed_at",
916
+ "type": "timestamp with time zone",
917
+ "primaryKey": false,
918
+ "notNull": false
919
+ },
920
+ "exited_at": {
921
+ "name": "exited_at",
922
+ "type": "timestamp with time zone",
923
+ "primaryKey": false,
924
+ "notNull": false
925
+ },
926
+ "created_at": {
927
+ "name": "created_at",
928
+ "type": "timestamp with time zone",
929
+ "primaryKey": false,
930
+ "notNull": true,
931
+ "default": "now()"
932
+ },
933
+ "updated_at": {
934
+ "name": "updated_at",
935
+ "type": "timestamp with time zone",
936
+ "primaryKey": false,
937
+ "notNull": true,
938
+ "default": "now()"
939
+ }
940
+ },
941
+ "indexes": {
942
+ "uq_user_journey_active": {
943
+ "name": "uq_user_journey_active",
944
+ "columns": [
945
+ {
946
+ "expression": "user_id",
947
+ "isExpression": false,
948
+ "asc": true,
949
+ "nulls": "last"
950
+ },
951
+ {
952
+ "expression": "journey_id",
953
+ "isExpression": false,
954
+ "asc": true,
955
+ "nulls": "last"
956
+ },
957
+ {
958
+ "expression": "status",
959
+ "isExpression": false,
960
+ "asc": true,
961
+ "nulls": "last"
962
+ }
963
+ ],
964
+ "isUnique": true,
965
+ "concurrently": false,
966
+ "method": "btree",
967
+ "with": {}
968
+ },
969
+ "journey_states_status_idx": {
970
+ "name": "journey_states_status_idx",
971
+ "columns": [
972
+ {
973
+ "expression": "status",
974
+ "isExpression": false,
975
+ "asc": true,
976
+ "nulls": "last"
977
+ }
978
+ ],
979
+ "isUnique": false,
980
+ "concurrently": false,
981
+ "method": "btree",
982
+ "with": {}
983
+ },
984
+ "journey_states_hatchet_run_idx": {
985
+ "name": "journey_states_hatchet_run_idx",
986
+ "columns": [
987
+ {
988
+ "expression": "hatchet_run_id",
989
+ "isExpression": false,
990
+ "asc": true,
991
+ "nulls": "last"
992
+ }
993
+ ],
994
+ "isUnique": false,
995
+ "concurrently": false,
996
+ "method": "btree",
997
+ "with": {}
998
+ },
999
+ "journey_states_user_id_idx": {
1000
+ "name": "journey_states_user_id_idx",
1001
+ "columns": [
1002
+ {
1003
+ "expression": "user_id",
1004
+ "isExpression": false,
1005
+ "asc": true,
1006
+ "nulls": "last"
1007
+ }
1008
+ ],
1009
+ "isUnique": false,
1010
+ "concurrently": false,
1011
+ "method": "btree",
1012
+ "with": {}
1013
+ }
1014
+ },
1015
+ "foreignKeys": {},
1016
+ "compositePrimaryKeys": {},
1017
+ "uniqueConstraints": {},
1018
+ "policies": {},
1019
+ "checkConstraints": {},
1020
+ "isRLSEnabled": false
1021
+ },
1022
+ "public.link_clicks": {
1023
+ "name": "link_clicks",
1024
+ "schema": "",
1025
+ "columns": {
1026
+ "id": {
1027
+ "name": "id",
1028
+ "type": "uuid",
1029
+ "primaryKey": true,
1030
+ "notNull": true,
1031
+ "default": "gen_random_uuid()"
1032
+ },
1033
+ "tracked_link_id": {
1034
+ "name": "tracked_link_id",
1035
+ "type": "uuid",
1036
+ "primaryKey": false,
1037
+ "notNull": true
1038
+ },
1039
+ "ip_address": {
1040
+ "name": "ip_address",
1041
+ "type": "text",
1042
+ "primaryKey": false,
1043
+ "notNull": false
1044
+ },
1045
+ "user_agent": {
1046
+ "name": "user_agent",
1047
+ "type": "text",
1048
+ "primaryKey": false,
1049
+ "notNull": false
1050
+ },
1051
+ "clicked_at": {
1052
+ "name": "clicked_at",
1053
+ "type": "timestamp with time zone",
1054
+ "primaryKey": false,
1055
+ "notNull": true,
1056
+ "default": "now()"
1057
+ }
1058
+ },
1059
+ "indexes": {},
1060
+ "foreignKeys": {
1061
+ "link_clicks_tracked_link_id_tracked_links_id_fk": {
1062
+ "name": "link_clicks_tracked_link_id_tracked_links_id_fk",
1063
+ "tableFrom": "link_clicks",
1064
+ "tableTo": "tracked_links",
1065
+ "columnsFrom": ["tracked_link_id"],
1066
+ "columnsTo": ["id"],
1067
+ "onDelete": "cascade",
1068
+ "onUpdate": "no action"
1069
+ }
1070
+ },
1071
+ "compositePrimaryKeys": {},
1072
+ "uniqueConstraints": {},
1073
+ "policies": {},
1074
+ "checkConstraints": {},
1075
+ "isRLSEnabled": false
1076
+ },
1077
+ "public.tracked_links": {
1078
+ "name": "tracked_links",
1079
+ "schema": "",
1080
+ "columns": {
1081
+ "id": {
1082
+ "name": "id",
1083
+ "type": "uuid",
1084
+ "primaryKey": true,
1085
+ "notNull": true,
1086
+ "default": "gen_random_uuid()"
1087
+ },
1088
+ "email_send_id": {
1089
+ "name": "email_send_id",
1090
+ "type": "uuid",
1091
+ "primaryKey": false,
1092
+ "notNull": true
1093
+ },
1094
+ "original_url": {
1095
+ "name": "original_url",
1096
+ "type": "text",
1097
+ "primaryKey": false,
1098
+ "notNull": true
1099
+ },
1100
+ "click_count": {
1101
+ "name": "click_count",
1102
+ "type": "integer",
1103
+ "primaryKey": false,
1104
+ "notNull": true,
1105
+ "default": 0
1106
+ },
1107
+ "created_at": {
1108
+ "name": "created_at",
1109
+ "type": "timestamp with time zone",
1110
+ "primaryKey": false,
1111
+ "notNull": true,
1112
+ "default": "now()"
1113
+ },
1114
+ "updated_at": {
1115
+ "name": "updated_at",
1116
+ "type": "timestamp with time zone",
1117
+ "primaryKey": false,
1118
+ "notNull": true,
1119
+ "default": "now()"
1120
+ }
1121
+ },
1122
+ "indexes": {},
1123
+ "foreignKeys": {
1124
+ "tracked_links_email_send_id_email_sends_id_fk": {
1125
+ "name": "tracked_links_email_send_id_email_sends_id_fk",
1126
+ "tableFrom": "tracked_links",
1127
+ "tableTo": "email_sends",
1128
+ "columnsFrom": ["email_send_id"],
1129
+ "columnsTo": ["id"],
1130
+ "onDelete": "cascade",
1131
+ "onUpdate": "no action"
1132
+ }
1133
+ },
1134
+ "compositePrimaryKeys": {},
1135
+ "uniqueConstraints": {},
1136
+ "policies": {},
1137
+ "checkConstraints": {},
1138
+ "isRLSEnabled": false
1139
+ },
1140
+ "public.user_events": {
1141
+ "name": "user_events",
1142
+ "schema": "",
1143
+ "columns": {
1144
+ "id": {
1145
+ "name": "id",
1146
+ "type": "uuid",
1147
+ "primaryKey": true,
1148
+ "notNull": true,
1149
+ "default": "gen_random_uuid()"
1150
+ },
1151
+ "user_id": {
1152
+ "name": "user_id",
1153
+ "type": "text",
1154
+ "primaryKey": false,
1155
+ "notNull": true
1156
+ },
1157
+ "event": {
1158
+ "name": "event",
1159
+ "type": "text",
1160
+ "primaryKey": false,
1161
+ "notNull": true
1162
+ },
1163
+ "properties": {
1164
+ "name": "properties",
1165
+ "type": "jsonb",
1166
+ "primaryKey": false,
1167
+ "notNull": false
1168
+ },
1169
+ "occurred_at": {
1170
+ "name": "occurred_at",
1171
+ "type": "timestamp with time zone",
1172
+ "primaryKey": false,
1173
+ "notNull": true,
1174
+ "default": "now()"
1175
+ }
1176
+ },
1177
+ "indexes": {
1178
+ "user_events_user_id_idx": {
1179
+ "name": "user_events_user_id_idx",
1180
+ "columns": [
1181
+ {
1182
+ "expression": "user_id",
1183
+ "isExpression": false,
1184
+ "asc": true,
1185
+ "nulls": "last"
1186
+ }
1187
+ ],
1188
+ "isUnique": false,
1189
+ "concurrently": false,
1190
+ "method": "btree",
1191
+ "with": {}
1192
+ },
1193
+ "user_events_event_idx": {
1194
+ "name": "user_events_event_idx",
1195
+ "columns": [
1196
+ {
1197
+ "expression": "event",
1198
+ "isExpression": false,
1199
+ "asc": true,
1200
+ "nulls": "last"
1201
+ }
1202
+ ],
1203
+ "isUnique": false,
1204
+ "concurrently": false,
1205
+ "method": "btree",
1206
+ "with": {}
1207
+ },
1208
+ "user_events_occurred_at_idx": {
1209
+ "name": "user_events_occurred_at_idx",
1210
+ "columns": [
1211
+ {
1212
+ "expression": "occurred_at",
1213
+ "isExpression": false,
1214
+ "asc": true,
1215
+ "nulls": "last"
1216
+ }
1217
+ ],
1218
+ "isUnique": false,
1219
+ "concurrently": false,
1220
+ "method": "btree",
1221
+ "with": {}
1222
+ }
1223
+ },
1224
+ "foreignKeys": {},
1225
+ "compositePrimaryKeys": {},
1226
+ "uniqueConstraints": {},
1227
+ "policies": {},
1228
+ "checkConstraints": {},
1229
+ "isRLSEnabled": false
1230
+ }
1231
+ },
1232
+ "enums": {
1233
+ "public.email_send_status": {
1234
+ "name": "email_send_status",
1235
+ "schema": "public",
1236
+ "values": [
1237
+ "queued",
1238
+ "rendered",
1239
+ "sent",
1240
+ "delivered",
1241
+ "opened",
1242
+ "clicked",
1243
+ "bounced",
1244
+ "complained",
1245
+ "failed"
1246
+ ]
1247
+ },
1248
+ "public.journey_status": {
1249
+ "name": "journey_status",
1250
+ "schema": "public",
1251
+ "values": ["active", "waiting", "completed", "failed", "exited"]
1252
+ }
1253
+ },
1254
+ "schemas": {},
1255
+ "sequences": {},
1256
+ "roles": {},
1257
+ "policies": {},
1258
+ "views": {},
1259
+ "_meta": {
1260
+ "columns": {},
1261
+ "schemas": {},
1262
+ "tables": {}
1263
+ }
1264
+ }