@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,1464 @@
1
+ {
2
+ "id": "1e144f9d-44e3-48cb-b875-d6b9ed8c2a85",
3
+ "prevId": "1f539e5a-d5e8-4fb0-82ba-c5c81232bba1",
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_configs": {
861
+ "name": "journey_configs",
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_id": {
872
+ "name": "journey_id",
873
+ "type": "text",
874
+ "primaryKey": false,
875
+ "notNull": true
876
+ },
877
+ "enabled": {
878
+ "name": "enabled",
879
+ "type": "boolean",
880
+ "primaryKey": false,
881
+ "notNull": true,
882
+ "default": true
883
+ },
884
+ "created_at": {
885
+ "name": "created_at",
886
+ "type": "timestamp with time zone",
887
+ "primaryKey": false,
888
+ "notNull": true,
889
+ "default": "now()"
890
+ },
891
+ "updated_at": {
892
+ "name": "updated_at",
893
+ "type": "timestamp with time zone",
894
+ "primaryKey": false,
895
+ "notNull": true,
896
+ "default": "now()"
897
+ }
898
+ },
899
+ "indexes": {
900
+ "journey_configs_journey_id_idx": {
901
+ "name": "journey_configs_journey_id_idx",
902
+ "columns": [
903
+ {
904
+ "expression": "journey_id",
905
+ "isExpression": false,
906
+ "asc": true,
907
+ "nulls": "last"
908
+ }
909
+ ],
910
+ "isUnique": true,
911
+ "concurrently": false,
912
+ "method": "btree",
913
+ "with": {}
914
+ }
915
+ },
916
+ "foreignKeys": {},
917
+ "compositePrimaryKeys": {},
918
+ "uniqueConstraints": {},
919
+ "policies": {},
920
+ "checkConstraints": {},
921
+ "isRLSEnabled": false
922
+ },
923
+ "public.journey_logs": {
924
+ "name": "journey_logs",
925
+ "schema": "",
926
+ "columns": {
927
+ "id": {
928
+ "name": "id",
929
+ "type": "uuid",
930
+ "primaryKey": true,
931
+ "notNull": true,
932
+ "default": "gen_random_uuid()"
933
+ },
934
+ "journey_state_id": {
935
+ "name": "journey_state_id",
936
+ "type": "uuid",
937
+ "primaryKey": false,
938
+ "notNull": true
939
+ },
940
+ "from_node_id": {
941
+ "name": "from_node_id",
942
+ "type": "text",
943
+ "primaryKey": false,
944
+ "notNull": false
945
+ },
946
+ "to_node_id": {
947
+ "name": "to_node_id",
948
+ "type": "text",
949
+ "primaryKey": false,
950
+ "notNull": false
951
+ },
952
+ "action": {
953
+ "name": "action",
954
+ "type": "text",
955
+ "primaryKey": false,
956
+ "notNull": true
957
+ },
958
+ "detail": {
959
+ "name": "detail",
960
+ "type": "jsonb",
961
+ "primaryKey": false,
962
+ "notNull": false
963
+ },
964
+ "created_at": {
965
+ "name": "created_at",
966
+ "type": "timestamp with time zone",
967
+ "primaryKey": false,
968
+ "notNull": true,
969
+ "default": "now()"
970
+ },
971
+ "updated_at": {
972
+ "name": "updated_at",
973
+ "type": "timestamp with time zone",
974
+ "primaryKey": false,
975
+ "notNull": true,
976
+ "default": "now()"
977
+ }
978
+ },
979
+ "indexes": {},
980
+ "foreignKeys": {
981
+ "journey_logs_journey_state_id_journey_states_id_fk": {
982
+ "name": "journey_logs_journey_state_id_journey_states_id_fk",
983
+ "tableFrom": "journey_logs",
984
+ "tableTo": "journey_states",
985
+ "columnsFrom": ["journey_state_id"],
986
+ "columnsTo": ["id"],
987
+ "onDelete": "cascade",
988
+ "onUpdate": "no action"
989
+ }
990
+ },
991
+ "compositePrimaryKeys": {},
992
+ "uniqueConstraints": {},
993
+ "policies": {},
994
+ "checkConstraints": {},
995
+ "isRLSEnabled": false
996
+ },
997
+ "public.journey_states": {
998
+ "name": "journey_states",
999
+ "schema": "",
1000
+ "columns": {
1001
+ "id": {
1002
+ "name": "id",
1003
+ "type": "uuid",
1004
+ "primaryKey": true,
1005
+ "notNull": true,
1006
+ "default": "gen_random_uuid()"
1007
+ },
1008
+ "user_id": {
1009
+ "name": "user_id",
1010
+ "type": "text",
1011
+ "primaryKey": false,
1012
+ "notNull": true
1013
+ },
1014
+ "user_email": {
1015
+ "name": "user_email",
1016
+ "type": "text",
1017
+ "primaryKey": false,
1018
+ "notNull": true
1019
+ },
1020
+ "journey_id": {
1021
+ "name": "journey_id",
1022
+ "type": "text",
1023
+ "primaryKey": false,
1024
+ "notNull": true
1025
+ },
1026
+ "current_node_id": {
1027
+ "name": "current_node_id",
1028
+ "type": "text",
1029
+ "primaryKey": false,
1030
+ "notNull": true
1031
+ },
1032
+ "status": {
1033
+ "name": "status",
1034
+ "type": "journey_status",
1035
+ "typeSchema": "public",
1036
+ "primaryKey": false,
1037
+ "notNull": true,
1038
+ "default": "'active'"
1039
+ },
1040
+ "hatchet_run_id": {
1041
+ "name": "hatchet_run_id",
1042
+ "type": "text",
1043
+ "primaryKey": false,
1044
+ "notNull": false
1045
+ },
1046
+ "context": {
1047
+ "name": "context",
1048
+ "type": "jsonb",
1049
+ "primaryKey": false,
1050
+ "notNull": false,
1051
+ "default": "'{}'::jsonb"
1052
+ },
1053
+ "error_message": {
1054
+ "name": "error_message",
1055
+ "type": "text",
1056
+ "primaryKey": false,
1057
+ "notNull": false
1058
+ },
1059
+ "entry_count": {
1060
+ "name": "entry_count",
1061
+ "type": "integer",
1062
+ "primaryKey": false,
1063
+ "notNull": true,
1064
+ "default": 1
1065
+ },
1066
+ "completed_at": {
1067
+ "name": "completed_at",
1068
+ "type": "timestamp with time zone",
1069
+ "primaryKey": false,
1070
+ "notNull": false
1071
+ },
1072
+ "exited_at": {
1073
+ "name": "exited_at",
1074
+ "type": "timestamp with time zone",
1075
+ "primaryKey": false,
1076
+ "notNull": false
1077
+ },
1078
+ "created_at": {
1079
+ "name": "created_at",
1080
+ "type": "timestamp with time zone",
1081
+ "primaryKey": false,
1082
+ "notNull": true,
1083
+ "default": "now()"
1084
+ },
1085
+ "updated_at": {
1086
+ "name": "updated_at",
1087
+ "type": "timestamp with time zone",
1088
+ "primaryKey": false,
1089
+ "notNull": true,
1090
+ "default": "now()"
1091
+ }
1092
+ },
1093
+ "indexes": {
1094
+ "uq_user_journey_active": {
1095
+ "name": "uq_user_journey_active",
1096
+ "columns": [
1097
+ {
1098
+ "expression": "user_id",
1099
+ "isExpression": false,
1100
+ "asc": true,
1101
+ "nulls": "last"
1102
+ },
1103
+ {
1104
+ "expression": "journey_id",
1105
+ "isExpression": false,
1106
+ "asc": true,
1107
+ "nulls": "last"
1108
+ },
1109
+ {
1110
+ "expression": "status",
1111
+ "isExpression": false,
1112
+ "asc": true,
1113
+ "nulls": "last"
1114
+ }
1115
+ ],
1116
+ "isUnique": true,
1117
+ "concurrently": false,
1118
+ "method": "btree",
1119
+ "with": {}
1120
+ },
1121
+ "journey_states_status_idx": {
1122
+ "name": "journey_states_status_idx",
1123
+ "columns": [
1124
+ {
1125
+ "expression": "status",
1126
+ "isExpression": false,
1127
+ "asc": true,
1128
+ "nulls": "last"
1129
+ }
1130
+ ],
1131
+ "isUnique": false,
1132
+ "concurrently": false,
1133
+ "method": "btree",
1134
+ "with": {}
1135
+ },
1136
+ "journey_states_hatchet_run_idx": {
1137
+ "name": "journey_states_hatchet_run_idx",
1138
+ "columns": [
1139
+ {
1140
+ "expression": "hatchet_run_id",
1141
+ "isExpression": false,
1142
+ "asc": true,
1143
+ "nulls": "last"
1144
+ }
1145
+ ],
1146
+ "isUnique": false,
1147
+ "concurrently": false,
1148
+ "method": "btree",
1149
+ "with": {}
1150
+ },
1151
+ "journey_states_user_id_idx": {
1152
+ "name": "journey_states_user_id_idx",
1153
+ "columns": [
1154
+ {
1155
+ "expression": "user_id",
1156
+ "isExpression": false,
1157
+ "asc": true,
1158
+ "nulls": "last"
1159
+ }
1160
+ ],
1161
+ "isUnique": false,
1162
+ "concurrently": false,
1163
+ "method": "btree",
1164
+ "with": {}
1165
+ },
1166
+ "journey_states_journey_id_status_idx": {
1167
+ "name": "journey_states_journey_id_status_idx",
1168
+ "columns": [
1169
+ {
1170
+ "expression": "journey_id",
1171
+ "isExpression": false,
1172
+ "asc": true,
1173
+ "nulls": "last"
1174
+ },
1175
+ {
1176
+ "expression": "status",
1177
+ "isExpression": false,
1178
+ "asc": true,
1179
+ "nulls": "last"
1180
+ }
1181
+ ],
1182
+ "isUnique": false,
1183
+ "concurrently": false,
1184
+ "method": "btree",
1185
+ "with": {}
1186
+ }
1187
+ },
1188
+ "foreignKeys": {},
1189
+ "compositePrimaryKeys": {},
1190
+ "uniqueConstraints": {},
1191
+ "policies": {},
1192
+ "checkConstraints": {},
1193
+ "isRLSEnabled": false
1194
+ },
1195
+ "public.link_clicks": {
1196
+ "name": "link_clicks",
1197
+ "schema": "",
1198
+ "columns": {
1199
+ "id": {
1200
+ "name": "id",
1201
+ "type": "uuid",
1202
+ "primaryKey": true,
1203
+ "notNull": true,
1204
+ "default": "gen_random_uuid()"
1205
+ },
1206
+ "tracked_link_id": {
1207
+ "name": "tracked_link_id",
1208
+ "type": "uuid",
1209
+ "primaryKey": false,
1210
+ "notNull": true
1211
+ },
1212
+ "ip_address": {
1213
+ "name": "ip_address",
1214
+ "type": "text",
1215
+ "primaryKey": false,
1216
+ "notNull": false
1217
+ },
1218
+ "user_agent": {
1219
+ "name": "user_agent",
1220
+ "type": "text",
1221
+ "primaryKey": false,
1222
+ "notNull": false
1223
+ },
1224
+ "clicked_at": {
1225
+ "name": "clicked_at",
1226
+ "type": "timestamp with time zone",
1227
+ "primaryKey": false,
1228
+ "notNull": true,
1229
+ "default": "now()"
1230
+ }
1231
+ },
1232
+ "indexes": {},
1233
+ "foreignKeys": {
1234
+ "link_clicks_tracked_link_id_tracked_links_id_fk": {
1235
+ "name": "link_clicks_tracked_link_id_tracked_links_id_fk",
1236
+ "tableFrom": "link_clicks",
1237
+ "tableTo": "tracked_links",
1238
+ "columnsFrom": ["tracked_link_id"],
1239
+ "columnsTo": ["id"],
1240
+ "onDelete": "cascade",
1241
+ "onUpdate": "no action"
1242
+ }
1243
+ },
1244
+ "compositePrimaryKeys": {},
1245
+ "uniqueConstraints": {},
1246
+ "policies": {},
1247
+ "checkConstraints": {},
1248
+ "isRLSEnabled": false
1249
+ },
1250
+ "public.tracked_links": {
1251
+ "name": "tracked_links",
1252
+ "schema": "",
1253
+ "columns": {
1254
+ "id": {
1255
+ "name": "id",
1256
+ "type": "uuid",
1257
+ "primaryKey": true,
1258
+ "notNull": true,
1259
+ "default": "gen_random_uuid()"
1260
+ },
1261
+ "email_send_id": {
1262
+ "name": "email_send_id",
1263
+ "type": "uuid",
1264
+ "primaryKey": false,
1265
+ "notNull": true
1266
+ },
1267
+ "original_url": {
1268
+ "name": "original_url",
1269
+ "type": "text",
1270
+ "primaryKey": false,
1271
+ "notNull": true
1272
+ },
1273
+ "click_count": {
1274
+ "name": "click_count",
1275
+ "type": "integer",
1276
+ "primaryKey": false,
1277
+ "notNull": true,
1278
+ "default": 0
1279
+ },
1280
+ "created_at": {
1281
+ "name": "created_at",
1282
+ "type": "timestamp with time zone",
1283
+ "primaryKey": false,
1284
+ "notNull": true,
1285
+ "default": "now()"
1286
+ },
1287
+ "updated_at": {
1288
+ "name": "updated_at",
1289
+ "type": "timestamp with time zone",
1290
+ "primaryKey": false,
1291
+ "notNull": true,
1292
+ "default": "now()"
1293
+ }
1294
+ },
1295
+ "indexes": {},
1296
+ "foreignKeys": {
1297
+ "tracked_links_email_send_id_email_sends_id_fk": {
1298
+ "name": "tracked_links_email_send_id_email_sends_id_fk",
1299
+ "tableFrom": "tracked_links",
1300
+ "tableTo": "email_sends",
1301
+ "columnsFrom": ["email_send_id"],
1302
+ "columnsTo": ["id"],
1303
+ "onDelete": "cascade",
1304
+ "onUpdate": "no action"
1305
+ }
1306
+ },
1307
+ "compositePrimaryKeys": {},
1308
+ "uniqueConstraints": {},
1309
+ "policies": {},
1310
+ "checkConstraints": {},
1311
+ "isRLSEnabled": false
1312
+ },
1313
+ "public.user_events": {
1314
+ "name": "user_events",
1315
+ "schema": "",
1316
+ "columns": {
1317
+ "id": {
1318
+ "name": "id",
1319
+ "type": "uuid",
1320
+ "primaryKey": true,
1321
+ "notNull": true,
1322
+ "default": "gen_random_uuid()"
1323
+ },
1324
+ "user_id": {
1325
+ "name": "user_id",
1326
+ "type": "text",
1327
+ "primaryKey": false,
1328
+ "notNull": true
1329
+ },
1330
+ "event": {
1331
+ "name": "event",
1332
+ "type": "text",
1333
+ "primaryKey": false,
1334
+ "notNull": true
1335
+ },
1336
+ "properties": {
1337
+ "name": "properties",
1338
+ "type": "jsonb",
1339
+ "primaryKey": false,
1340
+ "notNull": false
1341
+ },
1342
+ "occurred_at": {
1343
+ "name": "occurred_at",
1344
+ "type": "timestamp with time zone",
1345
+ "primaryKey": false,
1346
+ "notNull": true,
1347
+ "default": "now()"
1348
+ }
1349
+ },
1350
+ "indexes": {
1351
+ "user_events_user_id_idx": {
1352
+ "name": "user_events_user_id_idx",
1353
+ "columns": [
1354
+ {
1355
+ "expression": "user_id",
1356
+ "isExpression": false,
1357
+ "asc": true,
1358
+ "nulls": "last"
1359
+ }
1360
+ ],
1361
+ "isUnique": false,
1362
+ "concurrently": false,
1363
+ "method": "btree",
1364
+ "with": {}
1365
+ },
1366
+ "user_events_event_idx": {
1367
+ "name": "user_events_event_idx",
1368
+ "columns": [
1369
+ {
1370
+ "expression": "event",
1371
+ "isExpression": false,
1372
+ "asc": true,
1373
+ "nulls": "last"
1374
+ }
1375
+ ],
1376
+ "isUnique": false,
1377
+ "concurrently": false,
1378
+ "method": "btree",
1379
+ "with": {}
1380
+ },
1381
+ "user_events_occurred_at_idx": {
1382
+ "name": "user_events_occurred_at_idx",
1383
+ "columns": [
1384
+ {
1385
+ "expression": "occurred_at",
1386
+ "isExpression": false,
1387
+ "asc": true,
1388
+ "nulls": "last"
1389
+ }
1390
+ ],
1391
+ "isUnique": false,
1392
+ "concurrently": false,
1393
+ "method": "btree",
1394
+ "with": {}
1395
+ },
1396
+ "user_events_user_event_occurred_idx": {
1397
+ "name": "user_events_user_event_occurred_idx",
1398
+ "columns": [
1399
+ {
1400
+ "expression": "user_id",
1401
+ "isExpression": false,
1402
+ "asc": true,
1403
+ "nulls": "last"
1404
+ },
1405
+ {
1406
+ "expression": "event",
1407
+ "isExpression": false,
1408
+ "asc": true,
1409
+ "nulls": "last"
1410
+ },
1411
+ {
1412
+ "expression": "occurred_at",
1413
+ "isExpression": false,
1414
+ "asc": true,
1415
+ "nulls": "last"
1416
+ }
1417
+ ],
1418
+ "isUnique": false,
1419
+ "concurrently": false,
1420
+ "method": "btree",
1421
+ "with": {}
1422
+ }
1423
+ },
1424
+ "foreignKeys": {},
1425
+ "compositePrimaryKeys": {},
1426
+ "uniqueConstraints": {},
1427
+ "policies": {},
1428
+ "checkConstraints": {},
1429
+ "isRLSEnabled": false
1430
+ }
1431
+ },
1432
+ "enums": {
1433
+ "public.email_send_status": {
1434
+ "name": "email_send_status",
1435
+ "schema": "public",
1436
+ "values": [
1437
+ "queued",
1438
+ "rendered",
1439
+ "sent",
1440
+ "delivered",
1441
+ "opened",
1442
+ "clicked",
1443
+ "bounced",
1444
+ "complained",
1445
+ "failed"
1446
+ ]
1447
+ },
1448
+ "public.journey_status": {
1449
+ "name": "journey_status",
1450
+ "schema": "public",
1451
+ "values": ["active", "waiting", "completed", "failed", "exited"]
1452
+ }
1453
+ },
1454
+ "schemas": {},
1455
+ "sequences": {},
1456
+ "roles": {},
1457
+ "policies": {},
1458
+ "views": {},
1459
+ "_meta": {
1460
+ "columns": {},
1461
+ "schemas": {},
1462
+ "tables": {}
1463
+ }
1464
+ }