@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,1380 @@
1
+ {
2
+ "id": "c16c8d76-26dc-4f41-8cb9-73915ee4ad5e",
3
+ "prevId": "6c3d5a9e-bf2a-47b6-a5dc-b09efdea2ca3",
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.contacts": {
534
+ "name": "contacts",
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
+ "external_id": {
545
+ "name": "external_id",
546
+ "type": "text",
547
+ "primaryKey": false,
548
+ "notNull": true
549
+ },
550
+ "email": {
551
+ "name": "email",
552
+ "type": "text",
553
+ "primaryKey": false,
554
+ "notNull": false
555
+ },
556
+ "properties": {
557
+ "name": "properties",
558
+ "type": "jsonb",
559
+ "primaryKey": false,
560
+ "notNull": false,
561
+ "default": "'{}'::jsonb"
562
+ },
563
+ "first_seen_at": {
564
+ "name": "first_seen_at",
565
+ "type": "timestamp with time zone",
566
+ "primaryKey": false,
567
+ "notNull": true,
568
+ "default": "now()"
569
+ },
570
+ "last_seen_at": {
571
+ "name": "last_seen_at",
572
+ "type": "timestamp with time zone",
573
+ "primaryKey": false,
574
+ "notNull": true,
575
+ "default": "now()"
576
+ },
577
+ "created_at": {
578
+ "name": "created_at",
579
+ "type": "timestamp with time zone",
580
+ "primaryKey": false,
581
+ "notNull": true,
582
+ "default": "now()"
583
+ },
584
+ "updated_at": {
585
+ "name": "updated_at",
586
+ "type": "timestamp with time zone",
587
+ "primaryKey": false,
588
+ "notNull": true,
589
+ "default": "now()"
590
+ }
591
+ },
592
+ "indexes": {
593
+ "contacts_email_idx": {
594
+ "name": "contacts_email_idx",
595
+ "columns": [
596
+ {
597
+ "expression": "email",
598
+ "isExpression": false,
599
+ "asc": true,
600
+ "nulls": "last"
601
+ }
602
+ ],
603
+ "isUnique": false,
604
+ "concurrently": false,
605
+ "method": "btree",
606
+ "with": {}
607
+ }
608
+ },
609
+ "foreignKeys": {},
610
+ "compositePrimaryKeys": {},
611
+ "uniqueConstraints": {
612
+ "contacts_external_id_unique": {
613
+ "name": "contacts_external_id_unique",
614
+ "nullsNotDistinct": false,
615
+ "columns": ["external_id"]
616
+ }
617
+ },
618
+ "policies": {},
619
+ "checkConstraints": {},
620
+ "isRLSEnabled": false
621
+ },
622
+ "public.email_preferences": {
623
+ "name": "email_preferences",
624
+ "schema": "",
625
+ "columns": {
626
+ "id": {
627
+ "name": "id",
628
+ "type": "uuid",
629
+ "primaryKey": true,
630
+ "notNull": true,
631
+ "default": "gen_random_uuid()"
632
+ },
633
+ "user_id": {
634
+ "name": "user_id",
635
+ "type": "text",
636
+ "primaryKey": false,
637
+ "notNull": true
638
+ },
639
+ "email": {
640
+ "name": "email",
641
+ "type": "text",
642
+ "primaryKey": false,
643
+ "notNull": true
644
+ },
645
+ "unsubscribed_all": {
646
+ "name": "unsubscribed_all",
647
+ "type": "boolean",
648
+ "primaryKey": false,
649
+ "notNull": true,
650
+ "default": false
651
+ },
652
+ "suppressed": {
653
+ "name": "suppressed",
654
+ "type": "boolean",
655
+ "primaryKey": false,
656
+ "notNull": true,
657
+ "default": false
658
+ },
659
+ "bounce_count": {
660
+ "name": "bounce_count",
661
+ "type": "integer",
662
+ "primaryKey": false,
663
+ "notNull": true,
664
+ "default": 0
665
+ },
666
+ "categories": {
667
+ "name": "categories",
668
+ "type": "jsonb",
669
+ "primaryKey": false,
670
+ "notNull": false,
671
+ "default": "'{}'::jsonb"
672
+ },
673
+ "suppressed_at": {
674
+ "name": "suppressed_at",
675
+ "type": "timestamp with time zone",
676
+ "primaryKey": false,
677
+ "notNull": false
678
+ },
679
+ "last_bounce_at": {
680
+ "name": "last_bounce_at",
681
+ "type": "timestamp with time zone",
682
+ "primaryKey": false,
683
+ "notNull": false
684
+ },
685
+ "created_at": {
686
+ "name": "created_at",
687
+ "type": "timestamp with time zone",
688
+ "primaryKey": false,
689
+ "notNull": true,
690
+ "default": "now()"
691
+ },
692
+ "updated_at": {
693
+ "name": "updated_at",
694
+ "type": "timestamp with time zone",
695
+ "primaryKey": false,
696
+ "notNull": true,
697
+ "default": "now()"
698
+ }
699
+ },
700
+ "indexes": {
701
+ "email_preferences_user_email_idx": {
702
+ "name": "email_preferences_user_email_idx",
703
+ "columns": [
704
+ {
705
+ "expression": "user_id",
706
+ "isExpression": false,
707
+ "asc": true,
708
+ "nulls": "last"
709
+ },
710
+ {
711
+ "expression": "email",
712
+ "isExpression": false,
713
+ "asc": true,
714
+ "nulls": "last"
715
+ }
716
+ ],
717
+ "isUnique": true,
718
+ "concurrently": false,
719
+ "method": "btree",
720
+ "with": {}
721
+ }
722
+ },
723
+ "foreignKeys": {},
724
+ "compositePrimaryKeys": {},
725
+ "uniqueConstraints": {},
726
+ "policies": {},
727
+ "checkConstraints": {},
728
+ "isRLSEnabled": false
729
+ },
730
+ "public.email_sends": {
731
+ "name": "email_sends",
732
+ "schema": "",
733
+ "columns": {
734
+ "id": {
735
+ "name": "id",
736
+ "type": "uuid",
737
+ "primaryKey": true,
738
+ "notNull": true,
739
+ "default": "gen_random_uuid()"
740
+ },
741
+ "journey_state_id": {
742
+ "name": "journey_state_id",
743
+ "type": "uuid",
744
+ "primaryKey": false,
745
+ "notNull": false
746
+ },
747
+ "template_key": {
748
+ "name": "template_key",
749
+ "type": "text",
750
+ "primaryKey": false,
751
+ "notNull": false
752
+ },
753
+ "resend_id": {
754
+ "name": "resend_id",
755
+ "type": "text",
756
+ "primaryKey": false,
757
+ "notNull": false
758
+ },
759
+ "from_email": {
760
+ "name": "from_email",
761
+ "type": "text",
762
+ "primaryKey": false,
763
+ "notNull": true
764
+ },
765
+ "to_email": {
766
+ "name": "to_email",
767
+ "type": "text",
768
+ "primaryKey": false,
769
+ "notNull": true
770
+ },
771
+ "subject": {
772
+ "name": "subject",
773
+ "type": "text",
774
+ "primaryKey": false,
775
+ "notNull": true
776
+ },
777
+ "category": {
778
+ "name": "category",
779
+ "type": "text",
780
+ "primaryKey": false,
781
+ "notNull": false
782
+ },
783
+ "status": {
784
+ "name": "status",
785
+ "type": "email_send_status",
786
+ "typeSchema": "public",
787
+ "primaryKey": false,
788
+ "notNull": true,
789
+ "default": "'queued'"
790
+ },
791
+ "sent_at": {
792
+ "name": "sent_at",
793
+ "type": "timestamp with time zone",
794
+ "primaryKey": false,
795
+ "notNull": false
796
+ },
797
+ "delivered_at": {
798
+ "name": "delivered_at",
799
+ "type": "timestamp with time zone",
800
+ "primaryKey": false,
801
+ "notNull": false
802
+ },
803
+ "opened_at": {
804
+ "name": "opened_at",
805
+ "type": "timestamp with time zone",
806
+ "primaryKey": false,
807
+ "notNull": false
808
+ },
809
+ "clicked_at": {
810
+ "name": "clicked_at",
811
+ "type": "timestamp with time zone",
812
+ "primaryKey": false,
813
+ "notNull": false
814
+ },
815
+ "bounced_at": {
816
+ "name": "bounced_at",
817
+ "type": "timestamp with time zone",
818
+ "primaryKey": false,
819
+ "notNull": false
820
+ },
821
+ "complained_at": {
822
+ "name": "complained_at",
823
+ "type": "timestamp with time zone",
824
+ "primaryKey": false,
825
+ "notNull": false
826
+ },
827
+ "created_at": {
828
+ "name": "created_at",
829
+ "type": "timestamp with time zone",
830
+ "primaryKey": false,
831
+ "notNull": true,
832
+ "default": "now()"
833
+ },
834
+ "updated_at": {
835
+ "name": "updated_at",
836
+ "type": "timestamp with time zone",
837
+ "primaryKey": false,
838
+ "notNull": true,
839
+ "default": "now()"
840
+ }
841
+ },
842
+ "indexes": {},
843
+ "foreignKeys": {
844
+ "email_sends_journey_state_id_journey_states_id_fk": {
845
+ "name": "email_sends_journey_state_id_journey_states_id_fk",
846
+ "tableFrom": "email_sends",
847
+ "tableTo": "journey_states",
848
+ "columnsFrom": ["journey_state_id"],
849
+ "columnsTo": ["id"],
850
+ "onDelete": "no action",
851
+ "onUpdate": "no action"
852
+ }
853
+ },
854
+ "compositePrimaryKeys": {},
855
+ "uniqueConstraints": {},
856
+ "policies": {},
857
+ "checkConstraints": {},
858
+ "isRLSEnabled": false
859
+ },
860
+ "public.journey_logs": {
861
+ "name": "journey_logs",
862
+ "schema": "",
863
+ "columns": {
864
+ "id": {
865
+ "name": "id",
866
+ "type": "uuid",
867
+ "primaryKey": true,
868
+ "notNull": true,
869
+ "default": "gen_random_uuid()"
870
+ },
871
+ "journey_state_id": {
872
+ "name": "journey_state_id",
873
+ "type": "uuid",
874
+ "primaryKey": false,
875
+ "notNull": true
876
+ },
877
+ "from_node_id": {
878
+ "name": "from_node_id",
879
+ "type": "text",
880
+ "primaryKey": false,
881
+ "notNull": false
882
+ },
883
+ "to_node_id": {
884
+ "name": "to_node_id",
885
+ "type": "text",
886
+ "primaryKey": false,
887
+ "notNull": false
888
+ },
889
+ "action": {
890
+ "name": "action",
891
+ "type": "text",
892
+ "primaryKey": false,
893
+ "notNull": true
894
+ },
895
+ "detail": {
896
+ "name": "detail",
897
+ "type": "jsonb",
898
+ "primaryKey": false,
899
+ "notNull": false
900
+ },
901
+ "created_at": {
902
+ "name": "created_at",
903
+ "type": "timestamp with time zone",
904
+ "primaryKey": false,
905
+ "notNull": true,
906
+ "default": "now()"
907
+ },
908
+ "updated_at": {
909
+ "name": "updated_at",
910
+ "type": "timestamp with time zone",
911
+ "primaryKey": false,
912
+ "notNull": true,
913
+ "default": "now()"
914
+ }
915
+ },
916
+ "indexes": {},
917
+ "foreignKeys": {
918
+ "journey_logs_journey_state_id_journey_states_id_fk": {
919
+ "name": "journey_logs_journey_state_id_journey_states_id_fk",
920
+ "tableFrom": "journey_logs",
921
+ "tableTo": "journey_states",
922
+ "columnsFrom": ["journey_state_id"],
923
+ "columnsTo": ["id"],
924
+ "onDelete": "cascade",
925
+ "onUpdate": "no action"
926
+ }
927
+ },
928
+ "compositePrimaryKeys": {},
929
+ "uniqueConstraints": {},
930
+ "policies": {},
931
+ "checkConstraints": {},
932
+ "isRLSEnabled": false
933
+ },
934
+ "public.journey_states": {
935
+ "name": "journey_states",
936
+ "schema": "",
937
+ "columns": {
938
+ "id": {
939
+ "name": "id",
940
+ "type": "uuid",
941
+ "primaryKey": true,
942
+ "notNull": true,
943
+ "default": "gen_random_uuid()"
944
+ },
945
+ "user_id": {
946
+ "name": "user_id",
947
+ "type": "text",
948
+ "primaryKey": false,
949
+ "notNull": true
950
+ },
951
+ "user_email": {
952
+ "name": "user_email",
953
+ "type": "text",
954
+ "primaryKey": false,
955
+ "notNull": true
956
+ },
957
+ "journey_id": {
958
+ "name": "journey_id",
959
+ "type": "text",
960
+ "primaryKey": false,
961
+ "notNull": true
962
+ },
963
+ "current_node_id": {
964
+ "name": "current_node_id",
965
+ "type": "text",
966
+ "primaryKey": false,
967
+ "notNull": true
968
+ },
969
+ "status": {
970
+ "name": "status",
971
+ "type": "journey_status",
972
+ "typeSchema": "public",
973
+ "primaryKey": false,
974
+ "notNull": true,
975
+ "default": "'active'"
976
+ },
977
+ "hatchet_run_id": {
978
+ "name": "hatchet_run_id",
979
+ "type": "text",
980
+ "primaryKey": false,
981
+ "notNull": false
982
+ },
983
+ "context": {
984
+ "name": "context",
985
+ "type": "jsonb",
986
+ "primaryKey": false,
987
+ "notNull": false,
988
+ "default": "'{}'::jsonb"
989
+ },
990
+ "error_message": {
991
+ "name": "error_message",
992
+ "type": "text",
993
+ "primaryKey": false,
994
+ "notNull": false
995
+ },
996
+ "entry_count": {
997
+ "name": "entry_count",
998
+ "type": "integer",
999
+ "primaryKey": false,
1000
+ "notNull": true,
1001
+ "default": 1
1002
+ },
1003
+ "completed_at": {
1004
+ "name": "completed_at",
1005
+ "type": "timestamp with time zone",
1006
+ "primaryKey": false,
1007
+ "notNull": false
1008
+ },
1009
+ "exited_at": {
1010
+ "name": "exited_at",
1011
+ "type": "timestamp with time zone",
1012
+ "primaryKey": false,
1013
+ "notNull": false
1014
+ },
1015
+ "created_at": {
1016
+ "name": "created_at",
1017
+ "type": "timestamp with time zone",
1018
+ "primaryKey": false,
1019
+ "notNull": true,
1020
+ "default": "now()"
1021
+ },
1022
+ "updated_at": {
1023
+ "name": "updated_at",
1024
+ "type": "timestamp with time zone",
1025
+ "primaryKey": false,
1026
+ "notNull": true,
1027
+ "default": "now()"
1028
+ }
1029
+ },
1030
+ "indexes": {
1031
+ "uq_user_journey_active": {
1032
+ "name": "uq_user_journey_active",
1033
+ "columns": [
1034
+ {
1035
+ "expression": "user_id",
1036
+ "isExpression": false,
1037
+ "asc": true,
1038
+ "nulls": "last"
1039
+ },
1040
+ {
1041
+ "expression": "journey_id",
1042
+ "isExpression": false,
1043
+ "asc": true,
1044
+ "nulls": "last"
1045
+ },
1046
+ {
1047
+ "expression": "status",
1048
+ "isExpression": false,
1049
+ "asc": true,
1050
+ "nulls": "last"
1051
+ }
1052
+ ],
1053
+ "isUnique": true,
1054
+ "concurrently": false,
1055
+ "method": "btree",
1056
+ "with": {}
1057
+ },
1058
+ "journey_states_status_idx": {
1059
+ "name": "journey_states_status_idx",
1060
+ "columns": [
1061
+ {
1062
+ "expression": "status",
1063
+ "isExpression": false,
1064
+ "asc": true,
1065
+ "nulls": "last"
1066
+ }
1067
+ ],
1068
+ "isUnique": false,
1069
+ "concurrently": false,
1070
+ "method": "btree",
1071
+ "with": {}
1072
+ },
1073
+ "journey_states_hatchet_run_idx": {
1074
+ "name": "journey_states_hatchet_run_idx",
1075
+ "columns": [
1076
+ {
1077
+ "expression": "hatchet_run_id",
1078
+ "isExpression": false,
1079
+ "asc": true,
1080
+ "nulls": "last"
1081
+ }
1082
+ ],
1083
+ "isUnique": false,
1084
+ "concurrently": false,
1085
+ "method": "btree",
1086
+ "with": {}
1087
+ },
1088
+ "journey_states_user_id_idx": {
1089
+ "name": "journey_states_user_id_idx",
1090
+ "columns": [
1091
+ {
1092
+ "expression": "user_id",
1093
+ "isExpression": false,
1094
+ "asc": true,
1095
+ "nulls": "last"
1096
+ }
1097
+ ],
1098
+ "isUnique": false,
1099
+ "concurrently": false,
1100
+ "method": "btree",
1101
+ "with": {}
1102
+ }
1103
+ },
1104
+ "foreignKeys": {},
1105
+ "compositePrimaryKeys": {},
1106
+ "uniqueConstraints": {},
1107
+ "policies": {},
1108
+ "checkConstraints": {},
1109
+ "isRLSEnabled": false
1110
+ },
1111
+ "public.link_clicks": {
1112
+ "name": "link_clicks",
1113
+ "schema": "",
1114
+ "columns": {
1115
+ "id": {
1116
+ "name": "id",
1117
+ "type": "uuid",
1118
+ "primaryKey": true,
1119
+ "notNull": true,
1120
+ "default": "gen_random_uuid()"
1121
+ },
1122
+ "tracked_link_id": {
1123
+ "name": "tracked_link_id",
1124
+ "type": "uuid",
1125
+ "primaryKey": false,
1126
+ "notNull": true
1127
+ },
1128
+ "ip_address": {
1129
+ "name": "ip_address",
1130
+ "type": "text",
1131
+ "primaryKey": false,
1132
+ "notNull": false
1133
+ },
1134
+ "user_agent": {
1135
+ "name": "user_agent",
1136
+ "type": "text",
1137
+ "primaryKey": false,
1138
+ "notNull": false
1139
+ },
1140
+ "clicked_at": {
1141
+ "name": "clicked_at",
1142
+ "type": "timestamp with time zone",
1143
+ "primaryKey": false,
1144
+ "notNull": true,
1145
+ "default": "now()"
1146
+ }
1147
+ },
1148
+ "indexes": {},
1149
+ "foreignKeys": {
1150
+ "link_clicks_tracked_link_id_tracked_links_id_fk": {
1151
+ "name": "link_clicks_tracked_link_id_tracked_links_id_fk",
1152
+ "tableFrom": "link_clicks",
1153
+ "tableTo": "tracked_links",
1154
+ "columnsFrom": ["tracked_link_id"],
1155
+ "columnsTo": ["id"],
1156
+ "onDelete": "cascade",
1157
+ "onUpdate": "no action"
1158
+ }
1159
+ },
1160
+ "compositePrimaryKeys": {},
1161
+ "uniqueConstraints": {},
1162
+ "policies": {},
1163
+ "checkConstraints": {},
1164
+ "isRLSEnabled": false
1165
+ },
1166
+ "public.tracked_links": {
1167
+ "name": "tracked_links",
1168
+ "schema": "",
1169
+ "columns": {
1170
+ "id": {
1171
+ "name": "id",
1172
+ "type": "uuid",
1173
+ "primaryKey": true,
1174
+ "notNull": true,
1175
+ "default": "gen_random_uuid()"
1176
+ },
1177
+ "email_send_id": {
1178
+ "name": "email_send_id",
1179
+ "type": "uuid",
1180
+ "primaryKey": false,
1181
+ "notNull": true
1182
+ },
1183
+ "original_url": {
1184
+ "name": "original_url",
1185
+ "type": "text",
1186
+ "primaryKey": false,
1187
+ "notNull": true
1188
+ },
1189
+ "click_count": {
1190
+ "name": "click_count",
1191
+ "type": "integer",
1192
+ "primaryKey": false,
1193
+ "notNull": true,
1194
+ "default": 0
1195
+ },
1196
+ "created_at": {
1197
+ "name": "created_at",
1198
+ "type": "timestamp with time zone",
1199
+ "primaryKey": false,
1200
+ "notNull": true,
1201
+ "default": "now()"
1202
+ },
1203
+ "updated_at": {
1204
+ "name": "updated_at",
1205
+ "type": "timestamp with time zone",
1206
+ "primaryKey": false,
1207
+ "notNull": true,
1208
+ "default": "now()"
1209
+ }
1210
+ },
1211
+ "indexes": {},
1212
+ "foreignKeys": {
1213
+ "tracked_links_email_send_id_email_sends_id_fk": {
1214
+ "name": "tracked_links_email_send_id_email_sends_id_fk",
1215
+ "tableFrom": "tracked_links",
1216
+ "tableTo": "email_sends",
1217
+ "columnsFrom": ["email_send_id"],
1218
+ "columnsTo": ["id"],
1219
+ "onDelete": "cascade",
1220
+ "onUpdate": "no action"
1221
+ }
1222
+ },
1223
+ "compositePrimaryKeys": {},
1224
+ "uniqueConstraints": {},
1225
+ "policies": {},
1226
+ "checkConstraints": {},
1227
+ "isRLSEnabled": false
1228
+ },
1229
+ "public.user_events": {
1230
+ "name": "user_events",
1231
+ "schema": "",
1232
+ "columns": {
1233
+ "id": {
1234
+ "name": "id",
1235
+ "type": "uuid",
1236
+ "primaryKey": true,
1237
+ "notNull": true,
1238
+ "default": "gen_random_uuid()"
1239
+ },
1240
+ "user_id": {
1241
+ "name": "user_id",
1242
+ "type": "text",
1243
+ "primaryKey": false,
1244
+ "notNull": true
1245
+ },
1246
+ "event": {
1247
+ "name": "event",
1248
+ "type": "text",
1249
+ "primaryKey": false,
1250
+ "notNull": true
1251
+ },
1252
+ "properties": {
1253
+ "name": "properties",
1254
+ "type": "jsonb",
1255
+ "primaryKey": false,
1256
+ "notNull": false
1257
+ },
1258
+ "occurred_at": {
1259
+ "name": "occurred_at",
1260
+ "type": "timestamp with time zone",
1261
+ "primaryKey": false,
1262
+ "notNull": true,
1263
+ "default": "now()"
1264
+ }
1265
+ },
1266
+ "indexes": {
1267
+ "user_events_user_id_idx": {
1268
+ "name": "user_events_user_id_idx",
1269
+ "columns": [
1270
+ {
1271
+ "expression": "user_id",
1272
+ "isExpression": false,
1273
+ "asc": true,
1274
+ "nulls": "last"
1275
+ }
1276
+ ],
1277
+ "isUnique": false,
1278
+ "concurrently": false,
1279
+ "method": "btree",
1280
+ "with": {}
1281
+ },
1282
+ "user_events_event_idx": {
1283
+ "name": "user_events_event_idx",
1284
+ "columns": [
1285
+ {
1286
+ "expression": "event",
1287
+ "isExpression": false,
1288
+ "asc": true,
1289
+ "nulls": "last"
1290
+ }
1291
+ ],
1292
+ "isUnique": false,
1293
+ "concurrently": false,
1294
+ "method": "btree",
1295
+ "with": {}
1296
+ },
1297
+ "user_events_occurred_at_idx": {
1298
+ "name": "user_events_occurred_at_idx",
1299
+ "columns": [
1300
+ {
1301
+ "expression": "occurred_at",
1302
+ "isExpression": false,
1303
+ "asc": true,
1304
+ "nulls": "last"
1305
+ }
1306
+ ],
1307
+ "isUnique": false,
1308
+ "concurrently": false,
1309
+ "method": "btree",
1310
+ "with": {}
1311
+ },
1312
+ "user_events_user_event_occurred_idx": {
1313
+ "name": "user_events_user_event_occurred_idx",
1314
+ "columns": [
1315
+ {
1316
+ "expression": "user_id",
1317
+ "isExpression": false,
1318
+ "asc": true,
1319
+ "nulls": "last"
1320
+ },
1321
+ {
1322
+ "expression": "event",
1323
+ "isExpression": false,
1324
+ "asc": true,
1325
+ "nulls": "last"
1326
+ },
1327
+ {
1328
+ "expression": "occurred_at",
1329
+ "isExpression": false,
1330
+ "asc": true,
1331
+ "nulls": "last"
1332
+ }
1333
+ ],
1334
+ "isUnique": false,
1335
+ "concurrently": false,
1336
+ "method": "btree",
1337
+ "with": {}
1338
+ }
1339
+ },
1340
+ "foreignKeys": {},
1341
+ "compositePrimaryKeys": {},
1342
+ "uniqueConstraints": {},
1343
+ "policies": {},
1344
+ "checkConstraints": {},
1345
+ "isRLSEnabled": false
1346
+ }
1347
+ },
1348
+ "enums": {
1349
+ "public.email_send_status": {
1350
+ "name": "email_send_status",
1351
+ "schema": "public",
1352
+ "values": [
1353
+ "queued",
1354
+ "rendered",
1355
+ "sent",
1356
+ "delivered",
1357
+ "opened",
1358
+ "clicked",
1359
+ "bounced",
1360
+ "complained",
1361
+ "failed"
1362
+ ]
1363
+ },
1364
+ "public.journey_status": {
1365
+ "name": "journey_status",
1366
+ "schema": "public",
1367
+ "values": ["active", "waiting", "completed", "failed", "exited"]
1368
+ }
1369
+ },
1370
+ "schemas": {},
1371
+ "sequences": {},
1372
+ "roles": {},
1373
+ "policies": {},
1374
+ "views": {},
1375
+ "_meta": {
1376
+ "columns": {},
1377
+ "schemas": {},
1378
+ "tables": {}
1379
+ }
1380
+ }