@haatlabs-core/templates 0.19.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/package.json +3 -3
  2. package/starter/apps/api/package.json.tmpl +1 -0
  3. package/starter/apps/api/src/app.module.ts +36 -0
  4. package/starter/apps/api/src/notifications.int.test.ts +210 -0
  5. package/starter/apps/api/src/security-sweep.int.test.ts +63 -10
  6. package/starter/apps/api/src/seed.ts +16 -3
  7. package/starter/apps/web/public/notifications-sw.js +47 -0
  8. package/starter/apps/worker/package.json.tmpl +2 -0
  9. package/starter/apps/worker/src/handlers/notifications.handler.ts +63 -0
  10. package/starter/apps/worker/src/runtime.ts +52 -26
  11. package/starter/dot-env.example +16 -0
  12. package/starter/packages/config/src/config.test.ts +26 -0
  13. package/starter/packages/config/src/config.ts +11 -2
  14. package/starter/packages/contracts/package.json.tmpl +3 -1
  15. package/starter/packages/contracts/src/notifications.ts +38 -0
  16. package/starter/packages/database/drizzle/0009_notifications.sql +87 -0
  17. package/starter/packages/database/drizzle/meta/0009_snapshot.json +2446 -0
  18. package/starter/packages/database/drizzle/meta/_journal.json +7 -0
  19. package/starter/packages/database/package.json.tmpl +1 -0
  20. package/starter/packages/database/src/index.ts +1 -0
  21. package/starter/packages/database/src/repositories/notification.repository.ts +65 -0
  22. package/starter/packages/database/src/schema/index.ts +1 -0
  23. package/starter/packages/database/src/schema/notifications.ts +37 -0
  24. package/starter/packages/database/src/schema-tables.int.test.ts +10 -0
  25. package/starter/packages/queue/src/topology.test.ts +1 -0
  26. package/starter/packages/queue/src/topology.ts +3 -0
  27. package/starter/packages/web-ui/package.json.tmpl +1 -0
  28. package/starter/packages/web-ui/src/App.test.tsx +51 -2
  29. package/starter/packages/web-ui/src/App.tsx +84 -8
  30. package/starter/packages/web-ui/src/api-client.test.ts +204 -1
  31. package/starter/packages/web-ui/src/api-client.ts +207 -1
  32. package/starter/packages/web-ui/src/components/Logo.tsx +5 -0
  33. package/starter/packages/web-ui/src/pages/NotificationSettingsPage.tsx +24 -0
  34. package/starter/packages/web-ui/src/pages/NotificationsPage.tsx +19 -0
  35. package/starter/packages/web-ui/src/styles.css +21 -0
  36. package/starter/packages/web-ui/src/testing/fake-client.ts +15 -0
@@ -0,0 +1,2446 @@
1
+ {
2
+ "id": "847beaf1-bac6-4710-96c4-10d67cf495bb",
3
+ "prevId": "88cdfbf5-1246-488f-afbc-4cad5582c38a",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.api_keys": {
8
+ "name": "api_keys",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "uuid",
14
+ "primaryKey": true,
15
+ "notNull": true,
16
+ "default": "gen_random_uuid()"
17
+ },
18
+ "organization_id": {
19
+ "name": "organization_id",
20
+ "type": "uuid",
21
+ "primaryKey": false,
22
+ "notNull": true
23
+ },
24
+ "name": {
25
+ "name": "name",
26
+ "type": "text",
27
+ "primaryKey": false,
28
+ "notNull": true
29
+ },
30
+ "key_hash": {
31
+ "name": "key_hash",
32
+ "type": "text",
33
+ "primaryKey": false,
34
+ "notNull": true
35
+ },
36
+ "prefix": {
37
+ "name": "prefix",
38
+ "type": "text",
39
+ "primaryKey": false,
40
+ "notNull": true
41
+ },
42
+ "last_used_at": {
43
+ "name": "last_used_at",
44
+ "type": "timestamp with time zone",
45
+ "primaryKey": false,
46
+ "notNull": false
47
+ },
48
+ "revoked_at": {
49
+ "name": "revoked_at",
50
+ "type": "timestamp with time zone",
51
+ "primaryKey": false,
52
+ "notNull": false
53
+ },
54
+ "created_at": {
55
+ "name": "created_at",
56
+ "type": "timestamp with time zone",
57
+ "primaryKey": false,
58
+ "notNull": true,
59
+ "default": "now()"
60
+ },
61
+ "updated_at": {
62
+ "name": "updated_at",
63
+ "type": "timestamp with time zone",
64
+ "primaryKey": false,
65
+ "notNull": true,
66
+ "default": "now()"
67
+ }
68
+ },
69
+ "indexes": {},
70
+ "foreignKeys": {
71
+ "api_keys_organization_id_organizations_id_fk": {
72
+ "name": "api_keys_organization_id_organizations_id_fk",
73
+ "tableFrom": "api_keys",
74
+ "tableTo": "organizations",
75
+ "columnsFrom": [
76
+ "organization_id"
77
+ ],
78
+ "columnsTo": [
79
+ "id"
80
+ ],
81
+ "onDelete": "cascade",
82
+ "onUpdate": "no action"
83
+ }
84
+ },
85
+ "compositePrimaryKeys": {},
86
+ "uniqueConstraints": {
87
+ "api_keys_key_hash_unique": {
88
+ "name": "api_keys_key_hash_unique",
89
+ "nullsNotDistinct": false,
90
+ "columns": [
91
+ "key_hash"
92
+ ]
93
+ }
94
+ },
95
+ "policies": {},
96
+ "checkConstraints": {},
97
+ "isRLSEnabled": false
98
+ },
99
+ "public.disposable_email_domains": {
100
+ "name": "disposable_email_domains",
101
+ "schema": "",
102
+ "columns": {
103
+ "domain": {
104
+ "name": "domain",
105
+ "type": "text",
106
+ "primaryKey": true,
107
+ "notNull": true
108
+ }
109
+ },
110
+ "indexes": {},
111
+ "foreignKeys": {},
112
+ "compositePrimaryKeys": {},
113
+ "uniqueConstraints": {},
114
+ "policies": {},
115
+ "checkConstraints": {},
116
+ "isRLSEnabled": false
117
+ },
118
+ "public.extension_keys": {
119
+ "name": "extension_keys",
120
+ "schema": "",
121
+ "columns": {
122
+ "id": {
123
+ "name": "id",
124
+ "type": "uuid",
125
+ "primaryKey": true,
126
+ "notNull": true,
127
+ "default": "gen_random_uuid()"
128
+ },
129
+ "organization_id": {
130
+ "name": "organization_id",
131
+ "type": "uuid",
132
+ "primaryKey": false,
133
+ "notNull": true
134
+ },
135
+ "user_id": {
136
+ "name": "user_id",
137
+ "type": "uuid",
138
+ "primaryKey": false,
139
+ "notNull": true
140
+ },
141
+ "name": {
142
+ "name": "name",
143
+ "type": "text",
144
+ "primaryKey": false,
145
+ "notNull": true
146
+ },
147
+ "extension_id": {
148
+ "name": "extension_id",
149
+ "type": "text",
150
+ "primaryKey": false,
151
+ "notNull": true
152
+ },
153
+ "key_hash": {
154
+ "name": "key_hash",
155
+ "type": "text",
156
+ "primaryKey": false,
157
+ "notNull": true
158
+ },
159
+ "prefix": {
160
+ "name": "prefix",
161
+ "type": "text",
162
+ "primaryKey": false,
163
+ "notNull": true
164
+ },
165
+ "last_used_at": {
166
+ "name": "last_used_at",
167
+ "type": "timestamp with time zone",
168
+ "primaryKey": false,
169
+ "notNull": false
170
+ },
171
+ "revoked_at": {
172
+ "name": "revoked_at",
173
+ "type": "timestamp with time zone",
174
+ "primaryKey": false,
175
+ "notNull": false
176
+ },
177
+ "created_at": {
178
+ "name": "created_at",
179
+ "type": "timestamp with time zone",
180
+ "primaryKey": false,
181
+ "notNull": true,
182
+ "default": "now()"
183
+ },
184
+ "updated_at": {
185
+ "name": "updated_at",
186
+ "type": "timestamp with time zone",
187
+ "primaryKey": false,
188
+ "notNull": true,
189
+ "default": "now()"
190
+ }
191
+ },
192
+ "indexes": {
193
+ "extension_keys_org_user_idx": {
194
+ "name": "extension_keys_org_user_idx",
195
+ "columns": [
196
+ {
197
+ "expression": "organization_id",
198
+ "isExpression": false,
199
+ "asc": true,
200
+ "nulls": "last"
201
+ },
202
+ {
203
+ "expression": "user_id",
204
+ "isExpression": false,
205
+ "asc": true,
206
+ "nulls": "last"
207
+ }
208
+ ],
209
+ "isUnique": false,
210
+ "concurrently": false,
211
+ "method": "btree",
212
+ "with": {}
213
+ }
214
+ },
215
+ "foreignKeys": {
216
+ "extension_keys_organization_id_organizations_id_fk": {
217
+ "name": "extension_keys_organization_id_organizations_id_fk",
218
+ "tableFrom": "extension_keys",
219
+ "tableTo": "organizations",
220
+ "columnsFrom": [
221
+ "organization_id"
222
+ ],
223
+ "columnsTo": [
224
+ "id"
225
+ ],
226
+ "onDelete": "cascade",
227
+ "onUpdate": "no action"
228
+ },
229
+ "extension_keys_user_id_users_id_fk": {
230
+ "name": "extension_keys_user_id_users_id_fk",
231
+ "tableFrom": "extension_keys",
232
+ "tableTo": "users",
233
+ "columnsFrom": [
234
+ "user_id"
235
+ ],
236
+ "columnsTo": [
237
+ "id"
238
+ ],
239
+ "onDelete": "cascade",
240
+ "onUpdate": "no action"
241
+ }
242
+ },
243
+ "compositePrimaryKeys": {},
244
+ "uniqueConstraints": {
245
+ "extension_keys_key_hash_unique": {
246
+ "name": "extension_keys_key_hash_unique",
247
+ "nullsNotDistinct": false,
248
+ "columns": [
249
+ "key_hash"
250
+ ]
251
+ }
252
+ },
253
+ "policies": {},
254
+ "checkConstraints": {},
255
+ "isRLSEnabled": false
256
+ },
257
+ "public.memberships": {
258
+ "name": "memberships",
259
+ "schema": "",
260
+ "columns": {
261
+ "id": {
262
+ "name": "id",
263
+ "type": "uuid",
264
+ "primaryKey": true,
265
+ "notNull": true,
266
+ "default": "gen_random_uuid()"
267
+ },
268
+ "user_id": {
269
+ "name": "user_id",
270
+ "type": "uuid",
271
+ "primaryKey": false,
272
+ "notNull": true
273
+ },
274
+ "organization_id": {
275
+ "name": "organization_id",
276
+ "type": "uuid",
277
+ "primaryKey": false,
278
+ "notNull": true
279
+ },
280
+ "role": {
281
+ "name": "role",
282
+ "type": "role",
283
+ "typeSchema": "public",
284
+ "primaryKey": false,
285
+ "notNull": true
286
+ },
287
+ "created_at": {
288
+ "name": "created_at",
289
+ "type": "timestamp with time zone",
290
+ "primaryKey": false,
291
+ "notNull": true,
292
+ "default": "now()"
293
+ },
294
+ "updated_at": {
295
+ "name": "updated_at",
296
+ "type": "timestamp with time zone",
297
+ "primaryKey": false,
298
+ "notNull": true,
299
+ "default": "now()"
300
+ }
301
+ },
302
+ "indexes": {},
303
+ "foreignKeys": {
304
+ "memberships_user_id_users_id_fk": {
305
+ "name": "memberships_user_id_users_id_fk",
306
+ "tableFrom": "memberships",
307
+ "tableTo": "users",
308
+ "columnsFrom": [
309
+ "user_id"
310
+ ],
311
+ "columnsTo": [
312
+ "id"
313
+ ],
314
+ "onDelete": "cascade",
315
+ "onUpdate": "no action"
316
+ },
317
+ "memberships_organization_id_organizations_id_fk": {
318
+ "name": "memberships_organization_id_organizations_id_fk",
319
+ "tableFrom": "memberships",
320
+ "tableTo": "organizations",
321
+ "columnsFrom": [
322
+ "organization_id"
323
+ ],
324
+ "columnsTo": [
325
+ "id"
326
+ ],
327
+ "onDelete": "cascade",
328
+ "onUpdate": "no action"
329
+ }
330
+ },
331
+ "compositePrimaryKeys": {},
332
+ "uniqueConstraints": {
333
+ "memberships_user_org_unique": {
334
+ "name": "memberships_user_org_unique",
335
+ "nullsNotDistinct": false,
336
+ "columns": [
337
+ "user_id",
338
+ "organization_id"
339
+ ]
340
+ }
341
+ },
342
+ "policies": {},
343
+ "checkConstraints": {},
344
+ "isRLSEnabled": false
345
+ },
346
+ "public.organizations": {
347
+ "name": "organizations",
348
+ "schema": "",
349
+ "columns": {
350
+ "id": {
351
+ "name": "id",
352
+ "type": "uuid",
353
+ "primaryKey": true,
354
+ "notNull": true,
355
+ "default": "gen_random_uuid()"
356
+ },
357
+ "name": {
358
+ "name": "name",
359
+ "type": "text",
360
+ "primaryKey": false,
361
+ "notNull": true
362
+ },
363
+ "origin": {
364
+ "name": "origin",
365
+ "type": "organization_origin",
366
+ "typeSchema": "public",
367
+ "primaryKey": false,
368
+ "notNull": true,
369
+ "default": "'dashboard'"
370
+ },
371
+ "store_limit": {
372
+ "name": "store_limit",
373
+ "type": "integer",
374
+ "primaryKey": false,
375
+ "notNull": false
376
+ },
377
+ "suspended_at": {
378
+ "name": "suspended_at",
379
+ "type": "timestamp with time zone",
380
+ "primaryKey": false,
381
+ "notNull": false
382
+ },
383
+ "suspended_reason": {
384
+ "name": "suspended_reason",
385
+ "type": "text",
386
+ "primaryKey": false,
387
+ "notNull": false
388
+ },
389
+ "created_at": {
390
+ "name": "created_at",
391
+ "type": "timestamp with time zone",
392
+ "primaryKey": false,
393
+ "notNull": true,
394
+ "default": "now()"
395
+ },
396
+ "updated_at": {
397
+ "name": "updated_at",
398
+ "type": "timestamp with time zone",
399
+ "primaryKey": false,
400
+ "notNull": true,
401
+ "default": "now()"
402
+ }
403
+ },
404
+ "indexes": {},
405
+ "foreignKeys": {},
406
+ "compositePrimaryKeys": {},
407
+ "uniqueConstraints": {},
408
+ "policies": {},
409
+ "checkConstraints": {},
410
+ "isRLSEnabled": false
411
+ },
412
+ "public.platform_admins": {
413
+ "name": "platform_admins",
414
+ "schema": "",
415
+ "columns": {
416
+ "id": {
417
+ "name": "id",
418
+ "type": "uuid",
419
+ "primaryKey": true,
420
+ "notNull": true,
421
+ "default": "gen_random_uuid()"
422
+ },
423
+ "email": {
424
+ "name": "email",
425
+ "type": "text",
426
+ "primaryKey": false,
427
+ "notNull": true
428
+ },
429
+ "password_hash": {
430
+ "name": "password_hash",
431
+ "type": "text",
432
+ "primaryKey": false,
433
+ "notNull": true
434
+ },
435
+ "disabled_at": {
436
+ "name": "disabled_at",
437
+ "type": "timestamp with time zone",
438
+ "primaryKey": false,
439
+ "notNull": false
440
+ },
441
+ "last_login_at": {
442
+ "name": "last_login_at",
443
+ "type": "timestamp with time zone",
444
+ "primaryKey": false,
445
+ "notNull": false
446
+ },
447
+ "created_at": {
448
+ "name": "created_at",
449
+ "type": "timestamp with time zone",
450
+ "primaryKey": false,
451
+ "notNull": true,
452
+ "default": "now()"
453
+ },
454
+ "updated_at": {
455
+ "name": "updated_at",
456
+ "type": "timestamp with time zone",
457
+ "primaryKey": false,
458
+ "notNull": true,
459
+ "default": "now()"
460
+ }
461
+ },
462
+ "indexes": {},
463
+ "foreignKeys": {},
464
+ "compositePrimaryKeys": {},
465
+ "uniqueConstraints": {
466
+ "platform_admins_email_unique": {
467
+ "name": "platform_admins_email_unique",
468
+ "nullsNotDistinct": false,
469
+ "columns": [
470
+ "email"
471
+ ]
472
+ }
473
+ },
474
+ "policies": {},
475
+ "checkConstraints": {},
476
+ "isRLSEnabled": false
477
+ },
478
+ "public.user_identities": {
479
+ "name": "user_identities",
480
+ "schema": "",
481
+ "columns": {
482
+ "id": {
483
+ "name": "id",
484
+ "type": "uuid",
485
+ "primaryKey": true,
486
+ "notNull": true,
487
+ "default": "gen_random_uuid()"
488
+ },
489
+ "user_id": {
490
+ "name": "user_id",
491
+ "type": "uuid",
492
+ "primaryKey": false,
493
+ "notNull": true
494
+ },
495
+ "provider": {
496
+ "name": "provider",
497
+ "type": "text",
498
+ "primaryKey": false,
499
+ "notNull": true
500
+ },
501
+ "provider_user_id": {
502
+ "name": "provider_user_id",
503
+ "type": "text",
504
+ "primaryKey": false,
505
+ "notNull": true
506
+ },
507
+ "email_at_link": {
508
+ "name": "email_at_link",
509
+ "type": "text",
510
+ "primaryKey": false,
511
+ "notNull": true
512
+ },
513
+ "created_at": {
514
+ "name": "created_at",
515
+ "type": "timestamp with time zone",
516
+ "primaryKey": false,
517
+ "notNull": true,
518
+ "default": "now()"
519
+ },
520
+ "updated_at": {
521
+ "name": "updated_at",
522
+ "type": "timestamp with time zone",
523
+ "primaryKey": false,
524
+ "notNull": true,
525
+ "default": "now()"
526
+ }
527
+ },
528
+ "indexes": {
529
+ "user_identities_user_idx": {
530
+ "name": "user_identities_user_idx",
531
+ "columns": [
532
+ {
533
+ "expression": "user_id",
534
+ "isExpression": false,
535
+ "asc": true,
536
+ "nulls": "last"
537
+ }
538
+ ],
539
+ "isUnique": false,
540
+ "concurrently": false,
541
+ "method": "btree",
542
+ "with": {}
543
+ }
544
+ },
545
+ "foreignKeys": {
546
+ "user_identities_user_id_users_id_fk": {
547
+ "name": "user_identities_user_id_users_id_fk",
548
+ "tableFrom": "user_identities",
549
+ "tableTo": "users",
550
+ "columnsFrom": [
551
+ "user_id"
552
+ ],
553
+ "columnsTo": [
554
+ "id"
555
+ ],
556
+ "onDelete": "cascade",
557
+ "onUpdate": "no action"
558
+ }
559
+ },
560
+ "compositePrimaryKeys": {},
561
+ "uniqueConstraints": {
562
+ "user_identities_provider_user_unique": {
563
+ "name": "user_identities_provider_user_unique",
564
+ "nullsNotDistinct": false,
565
+ "columns": [
566
+ "provider",
567
+ "provider_user_id"
568
+ ]
569
+ }
570
+ },
571
+ "policies": {},
572
+ "checkConstraints": {},
573
+ "isRLSEnabled": false
574
+ },
575
+ "public.users": {
576
+ "name": "users",
577
+ "schema": "",
578
+ "columns": {
579
+ "id": {
580
+ "name": "id",
581
+ "type": "uuid",
582
+ "primaryKey": true,
583
+ "notNull": true,
584
+ "default": "gen_random_uuid()"
585
+ },
586
+ "email": {
587
+ "name": "email",
588
+ "type": "text",
589
+ "primaryKey": false,
590
+ "notNull": false
591
+ },
592
+ "password_hash": {
593
+ "name": "password_hash",
594
+ "type": "text",
595
+ "primaryKey": false,
596
+ "notNull": false
597
+ },
598
+ "created_at": {
599
+ "name": "created_at",
600
+ "type": "timestamp with time zone",
601
+ "primaryKey": false,
602
+ "notNull": true,
603
+ "default": "now()"
604
+ },
605
+ "updated_at": {
606
+ "name": "updated_at",
607
+ "type": "timestamp with time zone",
608
+ "primaryKey": false,
609
+ "notNull": true,
610
+ "default": "now()"
611
+ }
612
+ },
613
+ "indexes": {},
614
+ "foreignKeys": {},
615
+ "compositePrimaryKeys": {},
616
+ "uniqueConstraints": {
617
+ "users_email_unique": {
618
+ "name": "users_email_unique",
619
+ "nullsNotDistinct": false,
620
+ "columns": [
621
+ "email"
622
+ ]
623
+ }
624
+ },
625
+ "policies": {},
626
+ "checkConstraints": {},
627
+ "isRLSEnabled": false
628
+ },
629
+ "public.shopify_installations": {
630
+ "name": "shopify_installations",
631
+ "schema": "",
632
+ "columns": {
633
+ "id": {
634
+ "name": "id",
635
+ "type": "uuid",
636
+ "primaryKey": true,
637
+ "notNull": true,
638
+ "default": "gen_random_uuid()"
639
+ },
640
+ "organization_id": {
641
+ "name": "organization_id",
642
+ "type": "uuid",
643
+ "primaryKey": false,
644
+ "notNull": true
645
+ },
646
+ "store_id": {
647
+ "name": "store_id",
648
+ "type": "uuid",
649
+ "primaryKey": false,
650
+ "notNull": true
651
+ },
652
+ "access_token_encrypted": {
653
+ "name": "access_token_encrypted",
654
+ "type": "text",
655
+ "primaryKey": false,
656
+ "notNull": true
657
+ },
658
+ "key_version": {
659
+ "name": "key_version",
660
+ "type": "integer",
661
+ "primaryKey": false,
662
+ "notNull": true
663
+ },
664
+ "access_token_expires_at": {
665
+ "name": "access_token_expires_at",
666
+ "type": "timestamp with time zone",
667
+ "primaryKey": false,
668
+ "notNull": false
669
+ },
670
+ "refresh_token_encrypted": {
671
+ "name": "refresh_token_encrypted",
672
+ "type": "text",
673
+ "primaryKey": false,
674
+ "notNull": false
675
+ },
676
+ "refresh_token_expires_at": {
677
+ "name": "refresh_token_expires_at",
678
+ "type": "timestamp with time zone",
679
+ "primaryKey": false,
680
+ "notNull": false
681
+ },
682
+ "scopes": {
683
+ "name": "scopes",
684
+ "type": "text",
685
+ "primaryKey": false,
686
+ "notNull": true
687
+ },
688
+ "created_at": {
689
+ "name": "created_at",
690
+ "type": "timestamp with time zone",
691
+ "primaryKey": false,
692
+ "notNull": true,
693
+ "default": "now()"
694
+ },
695
+ "updated_at": {
696
+ "name": "updated_at",
697
+ "type": "timestamp with time zone",
698
+ "primaryKey": false,
699
+ "notNull": true,
700
+ "default": "now()"
701
+ }
702
+ },
703
+ "indexes": {},
704
+ "foreignKeys": {
705
+ "shopify_installations_organization_id_organizations_id_fk": {
706
+ "name": "shopify_installations_organization_id_organizations_id_fk",
707
+ "tableFrom": "shopify_installations",
708
+ "tableTo": "organizations",
709
+ "columnsFrom": [
710
+ "organization_id"
711
+ ],
712
+ "columnsTo": [
713
+ "id"
714
+ ],
715
+ "onDelete": "cascade",
716
+ "onUpdate": "no action"
717
+ },
718
+ "shopify_installations_store_id_stores_id_fk": {
719
+ "name": "shopify_installations_store_id_stores_id_fk",
720
+ "tableFrom": "shopify_installations",
721
+ "tableTo": "stores",
722
+ "columnsFrom": [
723
+ "store_id"
724
+ ],
725
+ "columnsTo": [
726
+ "id"
727
+ ],
728
+ "onDelete": "cascade",
729
+ "onUpdate": "no action"
730
+ }
731
+ },
732
+ "compositePrimaryKeys": {},
733
+ "uniqueConstraints": {
734
+ "shopify_installations_store_id_unique": {
735
+ "name": "shopify_installations_store_id_unique",
736
+ "nullsNotDistinct": false,
737
+ "columns": [
738
+ "store_id"
739
+ ]
740
+ }
741
+ },
742
+ "policies": {},
743
+ "checkConstraints": {},
744
+ "isRLSEnabled": false
745
+ },
746
+ "public.stores": {
747
+ "name": "stores",
748
+ "schema": "",
749
+ "columns": {
750
+ "id": {
751
+ "name": "id",
752
+ "type": "uuid",
753
+ "primaryKey": true,
754
+ "notNull": true,
755
+ "default": "gen_random_uuid()"
756
+ },
757
+ "organization_id": {
758
+ "name": "organization_id",
759
+ "type": "uuid",
760
+ "primaryKey": false,
761
+ "notNull": true
762
+ },
763
+ "shop_domain": {
764
+ "name": "shop_domain",
765
+ "type": "text",
766
+ "primaryKey": false,
767
+ "notNull": true
768
+ },
769
+ "status": {
770
+ "name": "status",
771
+ "type": "store_status",
772
+ "typeSchema": "public",
773
+ "primaryKey": false,
774
+ "notNull": true,
775
+ "default": "'ACTIVE'"
776
+ },
777
+ "installed_at": {
778
+ "name": "installed_at",
779
+ "type": "timestamp with time zone",
780
+ "primaryKey": false,
781
+ "notNull": true,
782
+ "default": "now()"
783
+ },
784
+ "uninstalled_at": {
785
+ "name": "uninstalled_at",
786
+ "type": "timestamp with time zone",
787
+ "primaryKey": false,
788
+ "notNull": false
789
+ },
790
+ "last_synced_at": {
791
+ "name": "last_synced_at",
792
+ "type": "timestamp with time zone",
793
+ "primaryKey": false,
794
+ "notNull": false
795
+ },
796
+ "deleted_at": {
797
+ "name": "deleted_at",
798
+ "type": "timestamp with time zone",
799
+ "primaryKey": false,
800
+ "notNull": false
801
+ },
802
+ "created_at": {
803
+ "name": "created_at",
804
+ "type": "timestamp with time zone",
805
+ "primaryKey": false,
806
+ "notNull": true,
807
+ "default": "now()"
808
+ },
809
+ "updated_at": {
810
+ "name": "updated_at",
811
+ "type": "timestamp with time zone",
812
+ "primaryKey": false,
813
+ "notNull": true,
814
+ "default": "now()"
815
+ }
816
+ },
817
+ "indexes": {},
818
+ "foreignKeys": {
819
+ "stores_organization_id_organizations_id_fk": {
820
+ "name": "stores_organization_id_organizations_id_fk",
821
+ "tableFrom": "stores",
822
+ "tableTo": "organizations",
823
+ "columnsFrom": [
824
+ "organization_id"
825
+ ],
826
+ "columnsTo": [
827
+ "id"
828
+ ],
829
+ "onDelete": "cascade",
830
+ "onUpdate": "no action"
831
+ }
832
+ },
833
+ "compositePrimaryKeys": {},
834
+ "uniqueConstraints": {
835
+ "stores_shop_domain_unique": {
836
+ "name": "stores_shop_domain_unique",
837
+ "nullsNotDistinct": false,
838
+ "columns": [
839
+ "shop_domain"
840
+ ]
841
+ },
842
+ "stores_id_org_unique": {
843
+ "name": "stores_id_org_unique",
844
+ "nullsNotDistinct": false,
845
+ "columns": [
846
+ "id",
847
+ "organization_id"
848
+ ]
849
+ }
850
+ },
851
+ "policies": {},
852
+ "checkConstraints": {},
853
+ "isRLSEnabled": false
854
+ },
855
+ "public.audit_logs": {
856
+ "name": "audit_logs",
857
+ "schema": "",
858
+ "columns": {
859
+ "id": {
860
+ "name": "id",
861
+ "type": "uuid",
862
+ "primaryKey": true,
863
+ "notNull": true,
864
+ "default": "gen_random_uuid()"
865
+ },
866
+ "organization_id": {
867
+ "name": "organization_id",
868
+ "type": "uuid",
869
+ "primaryKey": false,
870
+ "notNull": false
871
+ },
872
+ "actor": {
873
+ "name": "actor",
874
+ "type": "text",
875
+ "primaryKey": false,
876
+ "notNull": true
877
+ },
878
+ "action": {
879
+ "name": "action",
880
+ "type": "text",
881
+ "primaryKey": false,
882
+ "notNull": true
883
+ },
884
+ "entity_type": {
885
+ "name": "entity_type",
886
+ "type": "text",
887
+ "primaryKey": false,
888
+ "notNull": true
889
+ },
890
+ "entity_id": {
891
+ "name": "entity_id",
892
+ "type": "text",
893
+ "primaryKey": false,
894
+ "notNull": true
895
+ },
896
+ "request_id": {
897
+ "name": "request_id",
898
+ "type": "text",
899
+ "primaryKey": false,
900
+ "notNull": false
901
+ },
902
+ "metadata": {
903
+ "name": "metadata",
904
+ "type": "jsonb",
905
+ "primaryKey": false,
906
+ "notNull": true,
907
+ "default": "'{}'::jsonb"
908
+ },
909
+ "created_at": {
910
+ "name": "created_at",
911
+ "type": "timestamp with time zone",
912
+ "primaryKey": false,
913
+ "notNull": true,
914
+ "default": "now()"
915
+ }
916
+ },
917
+ "indexes": {
918
+ "audit_logs_org_created_idx": {
919
+ "name": "audit_logs_org_created_idx",
920
+ "columns": [
921
+ {
922
+ "expression": "organization_id",
923
+ "isExpression": false,
924
+ "asc": true,
925
+ "nulls": "last"
926
+ },
927
+ {
928
+ "expression": "created_at",
929
+ "isExpression": false,
930
+ "asc": true,
931
+ "nulls": "last"
932
+ }
933
+ ],
934
+ "isUnique": false,
935
+ "concurrently": false,
936
+ "method": "btree",
937
+ "with": {}
938
+ }
939
+ },
940
+ "foreignKeys": {
941
+ "audit_logs_organization_id_organizations_id_fk": {
942
+ "name": "audit_logs_organization_id_organizations_id_fk",
943
+ "tableFrom": "audit_logs",
944
+ "tableTo": "organizations",
945
+ "columnsFrom": [
946
+ "organization_id"
947
+ ],
948
+ "columnsTo": [
949
+ "id"
950
+ ],
951
+ "onDelete": "cascade",
952
+ "onUpdate": "no action"
953
+ }
954
+ },
955
+ "compositePrimaryKeys": {},
956
+ "uniqueConstraints": {},
957
+ "policies": {},
958
+ "checkConstraints": {},
959
+ "isRLSEnabled": false
960
+ },
961
+ "public.outbox_messages": {
962
+ "name": "outbox_messages",
963
+ "schema": "",
964
+ "columns": {
965
+ "id": {
966
+ "name": "id",
967
+ "type": "uuid",
968
+ "primaryKey": true,
969
+ "notNull": true,
970
+ "default": "gen_random_uuid()"
971
+ },
972
+ "routing_key": {
973
+ "name": "routing_key",
974
+ "type": "text",
975
+ "primaryKey": false,
976
+ "notNull": true
977
+ },
978
+ "payload": {
979
+ "name": "payload",
980
+ "type": "jsonb",
981
+ "primaryKey": false,
982
+ "notNull": true
983
+ },
984
+ "trace_context": {
985
+ "name": "trace_context",
986
+ "type": "text",
987
+ "primaryKey": false,
988
+ "notNull": false
989
+ },
990
+ "created_at": {
991
+ "name": "created_at",
992
+ "type": "timestamp with time zone",
993
+ "primaryKey": false,
994
+ "notNull": true,
995
+ "default": "now()"
996
+ },
997
+ "published_at": {
998
+ "name": "published_at",
999
+ "type": "timestamp with time zone",
1000
+ "primaryKey": false,
1001
+ "notNull": false
1002
+ },
1003
+ "priority": {
1004
+ "name": "priority",
1005
+ "type": "boolean",
1006
+ "primaryKey": false,
1007
+ "notNull": true,
1008
+ "default": "organization_goes_first()"
1009
+ }
1010
+ },
1011
+ "indexes": {
1012
+ "outbox_unpublished_idx": {
1013
+ "name": "outbox_unpublished_idx",
1014
+ "columns": [
1015
+ {
1016
+ "expression": "published_at",
1017
+ "isExpression": false,
1018
+ "asc": true,
1019
+ "nulls": "last"
1020
+ },
1021
+ {
1022
+ "expression": "created_at",
1023
+ "isExpression": false,
1024
+ "asc": true,
1025
+ "nulls": "last"
1026
+ }
1027
+ ],
1028
+ "isUnique": false,
1029
+ "concurrently": false,
1030
+ "method": "btree",
1031
+ "with": {}
1032
+ }
1033
+ },
1034
+ "foreignKeys": {},
1035
+ "compositePrimaryKeys": {},
1036
+ "uniqueConstraints": {},
1037
+ "policies": {},
1038
+ "checkConstraints": {},
1039
+ "isRLSEnabled": false
1040
+ },
1041
+ "public.webhook_events": {
1042
+ "name": "webhook_events",
1043
+ "schema": "",
1044
+ "columns": {
1045
+ "id": {
1046
+ "name": "id",
1047
+ "type": "uuid",
1048
+ "primaryKey": true,
1049
+ "notNull": true,
1050
+ "default": "gen_random_uuid()"
1051
+ },
1052
+ "organization_id": {
1053
+ "name": "organization_id",
1054
+ "type": "uuid",
1055
+ "primaryKey": false,
1056
+ "notNull": true
1057
+ },
1058
+ "store_id": {
1059
+ "name": "store_id",
1060
+ "type": "uuid",
1061
+ "primaryKey": false,
1062
+ "notNull": true
1063
+ },
1064
+ "shopify_webhook_id": {
1065
+ "name": "shopify_webhook_id",
1066
+ "type": "text",
1067
+ "primaryKey": false,
1068
+ "notNull": true
1069
+ },
1070
+ "topic": {
1071
+ "name": "topic",
1072
+ "type": "text",
1073
+ "primaryKey": false,
1074
+ "notNull": true
1075
+ },
1076
+ "received_at": {
1077
+ "name": "received_at",
1078
+ "type": "timestamp with time zone",
1079
+ "primaryKey": false,
1080
+ "notNull": true,
1081
+ "default": "now()"
1082
+ }
1083
+ },
1084
+ "indexes": {},
1085
+ "foreignKeys": {
1086
+ "webhook_events_organization_id_organizations_id_fk": {
1087
+ "name": "webhook_events_organization_id_organizations_id_fk",
1088
+ "tableFrom": "webhook_events",
1089
+ "tableTo": "organizations",
1090
+ "columnsFrom": [
1091
+ "organization_id"
1092
+ ],
1093
+ "columnsTo": [
1094
+ "id"
1095
+ ],
1096
+ "onDelete": "cascade",
1097
+ "onUpdate": "no action"
1098
+ },
1099
+ "webhook_events_store_id_stores_id_fk": {
1100
+ "name": "webhook_events_store_id_stores_id_fk",
1101
+ "tableFrom": "webhook_events",
1102
+ "tableTo": "stores",
1103
+ "columnsFrom": [
1104
+ "store_id"
1105
+ ],
1106
+ "columnsTo": [
1107
+ "id"
1108
+ ],
1109
+ "onDelete": "cascade",
1110
+ "onUpdate": "no action"
1111
+ }
1112
+ },
1113
+ "compositePrimaryKeys": {},
1114
+ "uniqueConstraints": {
1115
+ "webhook_events_shopify_webhook_id_unique": {
1116
+ "name": "webhook_events_shopify_webhook_id_unique",
1117
+ "nullsNotDistinct": false,
1118
+ "columns": [
1119
+ "shopify_webhook_id"
1120
+ ]
1121
+ }
1122
+ },
1123
+ "policies": {},
1124
+ "checkConstraints": {},
1125
+ "isRLSEnabled": false
1126
+ },
1127
+ "public.allowance_grants": {
1128
+ "name": "allowance_grants",
1129
+ "schema": "",
1130
+ "columns": {
1131
+ "id": {
1132
+ "name": "id",
1133
+ "type": "uuid",
1134
+ "primaryKey": true,
1135
+ "notNull": true,
1136
+ "default": "gen_random_uuid()"
1137
+ },
1138
+ "organization_id": {
1139
+ "name": "organization_id",
1140
+ "type": "uuid",
1141
+ "primaryKey": false,
1142
+ "notNull": true
1143
+ },
1144
+ "metric": {
1145
+ "name": "metric",
1146
+ "type": "text",
1147
+ "primaryKey": false,
1148
+ "notNull": true
1149
+ },
1150
+ "quantity": {
1151
+ "name": "quantity",
1152
+ "type": "integer",
1153
+ "primaryKey": false,
1154
+ "notNull": true
1155
+ },
1156
+ "period": {
1157
+ "name": "period",
1158
+ "type": "date",
1159
+ "primaryKey": false,
1160
+ "notNull": true
1161
+ },
1162
+ "reason": {
1163
+ "name": "reason",
1164
+ "type": "text",
1165
+ "primaryKey": false,
1166
+ "notNull": true
1167
+ },
1168
+ "granted_by": {
1169
+ "name": "granted_by",
1170
+ "type": "text",
1171
+ "primaryKey": false,
1172
+ "notNull": true
1173
+ },
1174
+ "created_at": {
1175
+ "name": "created_at",
1176
+ "type": "timestamp with time zone",
1177
+ "primaryKey": false,
1178
+ "notNull": true,
1179
+ "default": "now()"
1180
+ }
1181
+ },
1182
+ "indexes": {
1183
+ "allowance_grants_period_idx": {
1184
+ "name": "allowance_grants_period_idx",
1185
+ "columns": [
1186
+ {
1187
+ "expression": "organization_id",
1188
+ "isExpression": false,
1189
+ "asc": true,
1190
+ "nulls": "last"
1191
+ },
1192
+ {
1193
+ "expression": "period",
1194
+ "isExpression": false,
1195
+ "asc": true,
1196
+ "nulls": "last"
1197
+ },
1198
+ {
1199
+ "expression": "metric",
1200
+ "isExpression": false,
1201
+ "asc": true,
1202
+ "nulls": "last"
1203
+ }
1204
+ ],
1205
+ "isUnique": false,
1206
+ "concurrently": false,
1207
+ "method": "btree",
1208
+ "with": {}
1209
+ }
1210
+ },
1211
+ "foreignKeys": {
1212
+ "allowance_grants_organization_id_organizations_id_fk": {
1213
+ "name": "allowance_grants_organization_id_organizations_id_fk",
1214
+ "tableFrom": "allowance_grants",
1215
+ "tableTo": "organizations",
1216
+ "columnsFrom": [
1217
+ "organization_id"
1218
+ ],
1219
+ "columnsTo": [
1220
+ "id"
1221
+ ],
1222
+ "onDelete": "cascade",
1223
+ "onUpdate": "no action"
1224
+ }
1225
+ },
1226
+ "compositePrimaryKeys": {},
1227
+ "uniqueConstraints": {},
1228
+ "policies": {},
1229
+ "checkConstraints": {
1230
+ "allowance_grants_quantity_positive": {
1231
+ "name": "allowance_grants_quantity_positive",
1232
+ "value": "\"allowance_grants\".\"quantity\" > 0"
1233
+ }
1234
+ },
1235
+ "isRLSEnabled": false
1236
+ },
1237
+ "public.organization_features": {
1238
+ "name": "organization_features",
1239
+ "schema": "",
1240
+ "columns": {
1241
+ "organization_id": {
1242
+ "name": "organization_id",
1243
+ "type": "uuid",
1244
+ "primaryKey": false,
1245
+ "notNull": true
1246
+ },
1247
+ "feature": {
1248
+ "name": "feature",
1249
+ "type": "text",
1250
+ "primaryKey": false,
1251
+ "notNull": true
1252
+ },
1253
+ "enabled": {
1254
+ "name": "enabled",
1255
+ "type": "boolean",
1256
+ "primaryKey": false,
1257
+ "notNull": true
1258
+ },
1259
+ "changed_by": {
1260
+ "name": "changed_by",
1261
+ "type": "text",
1262
+ "primaryKey": false,
1263
+ "notNull": true
1264
+ },
1265
+ "updated_at": {
1266
+ "name": "updated_at",
1267
+ "type": "timestamp with time zone",
1268
+ "primaryKey": false,
1269
+ "notNull": true,
1270
+ "default": "now()"
1271
+ }
1272
+ },
1273
+ "indexes": {},
1274
+ "foreignKeys": {
1275
+ "organization_features_organization_id_organizations_id_fk": {
1276
+ "name": "organization_features_organization_id_organizations_id_fk",
1277
+ "tableFrom": "organization_features",
1278
+ "tableTo": "organizations",
1279
+ "columnsFrom": [
1280
+ "organization_id"
1281
+ ],
1282
+ "columnsTo": [
1283
+ "id"
1284
+ ],
1285
+ "onDelete": "cascade",
1286
+ "onUpdate": "no action"
1287
+ }
1288
+ },
1289
+ "compositePrimaryKeys": {
1290
+ "organization_features_organization_id_feature_pk": {
1291
+ "name": "organization_features_organization_id_feature_pk",
1292
+ "columns": [
1293
+ "organization_id",
1294
+ "feature"
1295
+ ]
1296
+ }
1297
+ },
1298
+ "uniqueConstraints": {},
1299
+ "policies": {},
1300
+ "checkConstraints": {},
1301
+ "isRLSEnabled": false
1302
+ },
1303
+ "public.payment_events": {
1304
+ "name": "payment_events",
1305
+ "schema": "",
1306
+ "columns": {
1307
+ "provider": {
1308
+ "name": "provider",
1309
+ "type": "text",
1310
+ "primaryKey": false,
1311
+ "notNull": true
1312
+ },
1313
+ "event_id": {
1314
+ "name": "event_id",
1315
+ "type": "text",
1316
+ "primaryKey": false,
1317
+ "notNull": true
1318
+ },
1319
+ "received_at": {
1320
+ "name": "received_at",
1321
+ "type": "timestamp with time zone",
1322
+ "primaryKey": false,
1323
+ "notNull": true,
1324
+ "default": "now()"
1325
+ }
1326
+ },
1327
+ "indexes": {},
1328
+ "foreignKeys": {},
1329
+ "compositePrimaryKeys": {
1330
+ "payment_events_provider_event_id_pk": {
1331
+ "name": "payment_events_provider_event_id_pk",
1332
+ "columns": [
1333
+ "provider",
1334
+ "event_id"
1335
+ ]
1336
+ }
1337
+ },
1338
+ "uniqueConstraints": {},
1339
+ "policies": {},
1340
+ "checkConstraints": {},
1341
+ "isRLSEnabled": false
1342
+ },
1343
+ "public.plan_features": {
1344
+ "name": "plan_features",
1345
+ "schema": "",
1346
+ "columns": {
1347
+ "id": {
1348
+ "name": "id",
1349
+ "type": "uuid",
1350
+ "primaryKey": true,
1351
+ "notNull": true,
1352
+ "default": "gen_random_uuid()"
1353
+ },
1354
+ "plan_id": {
1355
+ "name": "plan_id",
1356
+ "type": "uuid",
1357
+ "primaryKey": false,
1358
+ "notNull": true
1359
+ },
1360
+ "feature_key": {
1361
+ "name": "feature_key",
1362
+ "type": "text",
1363
+ "primaryKey": false,
1364
+ "notNull": true
1365
+ },
1366
+ "limit_value": {
1367
+ "name": "limit_value",
1368
+ "type": "bigint",
1369
+ "primaryKey": false,
1370
+ "notNull": false
1371
+ },
1372
+ "created_at": {
1373
+ "name": "created_at",
1374
+ "type": "timestamp with time zone",
1375
+ "primaryKey": false,
1376
+ "notNull": true,
1377
+ "default": "now()"
1378
+ },
1379
+ "updated_at": {
1380
+ "name": "updated_at",
1381
+ "type": "timestamp with time zone",
1382
+ "primaryKey": false,
1383
+ "notNull": true,
1384
+ "default": "now()"
1385
+ }
1386
+ },
1387
+ "indexes": {},
1388
+ "foreignKeys": {
1389
+ "plan_features_plan_id_plans_id_fk": {
1390
+ "name": "plan_features_plan_id_plans_id_fk",
1391
+ "tableFrom": "plan_features",
1392
+ "tableTo": "plans",
1393
+ "columnsFrom": [
1394
+ "plan_id"
1395
+ ],
1396
+ "columnsTo": [
1397
+ "id"
1398
+ ],
1399
+ "onDelete": "cascade",
1400
+ "onUpdate": "no action"
1401
+ }
1402
+ },
1403
+ "compositePrimaryKeys": {},
1404
+ "uniqueConstraints": {
1405
+ "plan_features_plan_key_unique": {
1406
+ "name": "plan_features_plan_key_unique",
1407
+ "nullsNotDistinct": false,
1408
+ "columns": [
1409
+ "plan_id",
1410
+ "feature_key"
1411
+ ]
1412
+ }
1413
+ },
1414
+ "policies": {},
1415
+ "checkConstraints": {},
1416
+ "isRLSEnabled": false
1417
+ },
1418
+ "public.plan_prices": {
1419
+ "name": "plan_prices",
1420
+ "schema": "",
1421
+ "columns": {
1422
+ "id": {
1423
+ "name": "id",
1424
+ "type": "uuid",
1425
+ "primaryKey": true,
1426
+ "notNull": true,
1427
+ "default": "gen_random_uuid()"
1428
+ },
1429
+ "plan_id": {
1430
+ "name": "plan_id",
1431
+ "type": "uuid",
1432
+ "primaryKey": false,
1433
+ "notNull": true
1434
+ },
1435
+ "provider": {
1436
+ "name": "provider",
1437
+ "type": "text",
1438
+ "primaryKey": false,
1439
+ "notNull": true
1440
+ },
1441
+ "price_ref": {
1442
+ "name": "price_ref",
1443
+ "type": "text",
1444
+ "primaryKey": false,
1445
+ "notNull": true
1446
+ },
1447
+ "currency": {
1448
+ "name": "currency",
1449
+ "type": "text",
1450
+ "primaryKey": false,
1451
+ "notNull": true
1452
+ },
1453
+ "amount_minor": {
1454
+ "name": "amount_minor",
1455
+ "type": "integer",
1456
+ "primaryKey": false,
1457
+ "notNull": true
1458
+ },
1459
+ "created_at": {
1460
+ "name": "created_at",
1461
+ "type": "timestamp with time zone",
1462
+ "primaryKey": false,
1463
+ "notNull": true,
1464
+ "default": "now()"
1465
+ },
1466
+ "updated_at": {
1467
+ "name": "updated_at",
1468
+ "type": "timestamp with time zone",
1469
+ "primaryKey": false,
1470
+ "notNull": true,
1471
+ "default": "now()"
1472
+ }
1473
+ },
1474
+ "indexes": {},
1475
+ "foreignKeys": {
1476
+ "plan_prices_plan_id_plans_id_fk": {
1477
+ "name": "plan_prices_plan_id_plans_id_fk",
1478
+ "tableFrom": "plan_prices",
1479
+ "tableTo": "plans",
1480
+ "columnsFrom": [
1481
+ "plan_id"
1482
+ ],
1483
+ "columnsTo": [
1484
+ "id"
1485
+ ],
1486
+ "onDelete": "cascade",
1487
+ "onUpdate": "no action"
1488
+ }
1489
+ },
1490
+ "compositePrimaryKeys": {},
1491
+ "uniqueConstraints": {
1492
+ "plan_prices_plan_provider_currency_unique": {
1493
+ "name": "plan_prices_plan_provider_currency_unique",
1494
+ "nullsNotDistinct": false,
1495
+ "columns": [
1496
+ "plan_id",
1497
+ "provider",
1498
+ "currency"
1499
+ ]
1500
+ },
1501
+ "plan_prices_provider_ref_unique": {
1502
+ "name": "plan_prices_provider_ref_unique",
1503
+ "nullsNotDistinct": false,
1504
+ "columns": [
1505
+ "provider",
1506
+ "price_ref"
1507
+ ]
1508
+ }
1509
+ },
1510
+ "policies": {},
1511
+ "checkConstraints": {},
1512
+ "isRLSEnabled": false
1513
+ },
1514
+ "public.plans": {
1515
+ "name": "plans",
1516
+ "schema": "",
1517
+ "columns": {
1518
+ "id": {
1519
+ "name": "id",
1520
+ "type": "uuid",
1521
+ "primaryKey": true,
1522
+ "notNull": true,
1523
+ "default": "gen_random_uuid()"
1524
+ },
1525
+ "code": {
1526
+ "name": "code",
1527
+ "type": "text",
1528
+ "primaryKey": false,
1529
+ "notNull": true
1530
+ },
1531
+ "name": {
1532
+ "name": "name",
1533
+ "type": "text",
1534
+ "primaryKey": false,
1535
+ "notNull": true
1536
+ },
1537
+ "product": {
1538
+ "name": "product",
1539
+ "type": "text",
1540
+ "primaryKey": false,
1541
+ "notNull": true,
1542
+ "default": "'app'"
1543
+ },
1544
+ "is_default": {
1545
+ "name": "is_default",
1546
+ "type": "boolean",
1547
+ "primaryKey": false,
1548
+ "notNull": true,
1549
+ "default": false
1550
+ },
1551
+ "position": {
1552
+ "name": "position",
1553
+ "type": "integer",
1554
+ "primaryKey": false,
1555
+ "notNull": true
1556
+ },
1557
+ "created_at": {
1558
+ "name": "created_at",
1559
+ "type": "timestamp with time zone",
1560
+ "primaryKey": false,
1561
+ "notNull": true,
1562
+ "default": "now()"
1563
+ },
1564
+ "updated_at": {
1565
+ "name": "updated_at",
1566
+ "type": "timestamp with time zone",
1567
+ "primaryKey": false,
1568
+ "notNull": true,
1569
+ "default": "now()"
1570
+ }
1571
+ },
1572
+ "indexes": {
1573
+ "plans_one_default_idx": {
1574
+ "name": "plans_one_default_idx",
1575
+ "columns": [
1576
+ {
1577
+ "expression": "product",
1578
+ "isExpression": false,
1579
+ "asc": true,
1580
+ "nulls": "last"
1581
+ }
1582
+ ],
1583
+ "isUnique": true,
1584
+ "where": "\"plans\".\"is_default\"",
1585
+ "concurrently": false,
1586
+ "method": "btree",
1587
+ "with": {}
1588
+ }
1589
+ },
1590
+ "foreignKeys": {},
1591
+ "compositePrimaryKeys": {},
1592
+ "uniqueConstraints": {
1593
+ "plans_code_unique": {
1594
+ "name": "plans_code_unique",
1595
+ "nullsNotDistinct": false,
1596
+ "columns": [
1597
+ "code"
1598
+ ]
1599
+ }
1600
+ },
1601
+ "policies": {},
1602
+ "checkConstraints": {},
1603
+ "isRLSEnabled": false
1604
+ },
1605
+ "public.subscriptions": {
1606
+ "name": "subscriptions",
1607
+ "schema": "",
1608
+ "columns": {
1609
+ "id": {
1610
+ "name": "id",
1611
+ "type": "uuid",
1612
+ "primaryKey": true,
1613
+ "notNull": true,
1614
+ "default": "gen_random_uuid()"
1615
+ },
1616
+ "organization_id": {
1617
+ "name": "organization_id",
1618
+ "type": "uuid",
1619
+ "primaryKey": false,
1620
+ "notNull": true
1621
+ },
1622
+ "plan_id": {
1623
+ "name": "plan_id",
1624
+ "type": "uuid",
1625
+ "primaryKey": false,
1626
+ "notNull": true
1627
+ },
1628
+ "product": {
1629
+ "name": "product",
1630
+ "type": "text",
1631
+ "primaryKey": false,
1632
+ "notNull": true,
1633
+ "default": "'app'"
1634
+ },
1635
+ "status": {
1636
+ "name": "status",
1637
+ "type": "subscription_status",
1638
+ "typeSchema": "public",
1639
+ "primaryKey": false,
1640
+ "notNull": true,
1641
+ "default": "'ACTIVE'"
1642
+ },
1643
+ "period_start": {
1644
+ "name": "period_start",
1645
+ "type": "timestamp with time zone",
1646
+ "primaryKey": false,
1647
+ "notNull": true
1648
+ },
1649
+ "period_end": {
1650
+ "name": "period_end",
1651
+ "type": "timestamp with time zone",
1652
+ "primaryKey": false,
1653
+ "notNull": true
1654
+ },
1655
+ "assigned_by": {
1656
+ "name": "assigned_by",
1657
+ "type": "text",
1658
+ "primaryKey": false,
1659
+ "notNull": true
1660
+ },
1661
+ "provider": {
1662
+ "name": "provider",
1663
+ "type": "text",
1664
+ "primaryKey": false,
1665
+ "notNull": false
1666
+ },
1667
+ "provider_subscription_ref": {
1668
+ "name": "provider_subscription_ref",
1669
+ "type": "text",
1670
+ "primaryKey": false,
1671
+ "notNull": false
1672
+ },
1673
+ "provider_customer_ref": {
1674
+ "name": "provider_customer_ref",
1675
+ "type": "text",
1676
+ "primaryKey": false,
1677
+ "notNull": false
1678
+ },
1679
+ "provider_event_at": {
1680
+ "name": "provider_event_at",
1681
+ "type": "timestamp with time zone",
1682
+ "primaryKey": false,
1683
+ "notNull": false
1684
+ },
1685
+ "provider_ended_at": {
1686
+ "name": "provider_ended_at",
1687
+ "type": "timestamp with time zone",
1688
+ "primaryKey": false,
1689
+ "notNull": false
1690
+ },
1691
+ "price_amount_minor": {
1692
+ "name": "price_amount_minor",
1693
+ "type": "bigint",
1694
+ "primaryKey": false,
1695
+ "notNull": false
1696
+ },
1697
+ "price_currency": {
1698
+ "name": "price_currency",
1699
+ "type": "text",
1700
+ "primaryKey": false,
1701
+ "notNull": false
1702
+ },
1703
+ "created_at": {
1704
+ "name": "created_at",
1705
+ "type": "timestamp with time zone",
1706
+ "primaryKey": false,
1707
+ "notNull": true,
1708
+ "default": "now()"
1709
+ },
1710
+ "updated_at": {
1711
+ "name": "updated_at",
1712
+ "type": "timestamp with time zone",
1713
+ "primaryKey": false,
1714
+ "notNull": true,
1715
+ "default": "now()"
1716
+ }
1717
+ },
1718
+ "indexes": {},
1719
+ "foreignKeys": {
1720
+ "subscriptions_organization_id_organizations_id_fk": {
1721
+ "name": "subscriptions_organization_id_organizations_id_fk",
1722
+ "tableFrom": "subscriptions",
1723
+ "tableTo": "organizations",
1724
+ "columnsFrom": [
1725
+ "organization_id"
1726
+ ],
1727
+ "columnsTo": [
1728
+ "id"
1729
+ ],
1730
+ "onDelete": "cascade",
1731
+ "onUpdate": "no action"
1732
+ },
1733
+ "subscriptions_plan_id_plans_id_fk": {
1734
+ "name": "subscriptions_plan_id_plans_id_fk",
1735
+ "tableFrom": "subscriptions",
1736
+ "tableTo": "plans",
1737
+ "columnsFrom": [
1738
+ "plan_id"
1739
+ ],
1740
+ "columnsTo": [
1741
+ "id"
1742
+ ],
1743
+ "onDelete": "no action",
1744
+ "onUpdate": "no action"
1745
+ }
1746
+ },
1747
+ "compositePrimaryKeys": {},
1748
+ "uniqueConstraints": {
1749
+ "subscriptions_org_product_unique": {
1750
+ "name": "subscriptions_org_product_unique",
1751
+ "nullsNotDistinct": false,
1752
+ "columns": [
1753
+ "organization_id",
1754
+ "product"
1755
+ ]
1756
+ }
1757
+ },
1758
+ "policies": {},
1759
+ "checkConstraints": {},
1760
+ "isRLSEnabled": false
1761
+ },
1762
+ "public.usage_records": {
1763
+ "name": "usage_records",
1764
+ "schema": "",
1765
+ "columns": {
1766
+ "id": {
1767
+ "name": "id",
1768
+ "type": "uuid",
1769
+ "primaryKey": true,
1770
+ "notNull": true,
1771
+ "default": "gen_random_uuid()"
1772
+ },
1773
+ "organization_id": {
1774
+ "name": "organization_id",
1775
+ "type": "uuid",
1776
+ "primaryKey": false,
1777
+ "notNull": true
1778
+ },
1779
+ "store_id": {
1780
+ "name": "store_id",
1781
+ "type": "uuid",
1782
+ "primaryKey": false,
1783
+ "notNull": false
1784
+ },
1785
+ "metric": {
1786
+ "name": "metric",
1787
+ "type": "text",
1788
+ "primaryKey": false,
1789
+ "notNull": true
1790
+ },
1791
+ "quantity": {
1792
+ "name": "quantity",
1793
+ "type": "integer",
1794
+ "primaryKey": false,
1795
+ "notNull": true
1796
+ },
1797
+ "period": {
1798
+ "name": "period",
1799
+ "type": "date",
1800
+ "primaryKey": false,
1801
+ "notNull": true
1802
+ },
1803
+ "idempotency_key": {
1804
+ "name": "idempotency_key",
1805
+ "type": "text",
1806
+ "primaryKey": false,
1807
+ "notNull": true
1808
+ },
1809
+ "created_at": {
1810
+ "name": "created_at",
1811
+ "type": "timestamp with time zone",
1812
+ "primaryKey": false,
1813
+ "notNull": true,
1814
+ "default": "now()"
1815
+ }
1816
+ },
1817
+ "indexes": {
1818
+ "usage_records_period_idx": {
1819
+ "name": "usage_records_period_idx",
1820
+ "columns": [
1821
+ {
1822
+ "expression": "organization_id",
1823
+ "isExpression": false,
1824
+ "asc": true,
1825
+ "nulls": "last"
1826
+ },
1827
+ {
1828
+ "expression": "period",
1829
+ "isExpression": false,
1830
+ "asc": true,
1831
+ "nulls": "last"
1832
+ },
1833
+ {
1834
+ "expression": "metric",
1835
+ "isExpression": false,
1836
+ "asc": true,
1837
+ "nulls": "last"
1838
+ }
1839
+ ],
1840
+ "isUnique": false,
1841
+ "concurrently": false,
1842
+ "method": "btree",
1843
+ "with": {}
1844
+ }
1845
+ },
1846
+ "foreignKeys": {
1847
+ "usage_records_organization_id_organizations_id_fk": {
1848
+ "name": "usage_records_organization_id_organizations_id_fk",
1849
+ "tableFrom": "usage_records",
1850
+ "tableTo": "organizations",
1851
+ "columnsFrom": [
1852
+ "organization_id"
1853
+ ],
1854
+ "columnsTo": [
1855
+ "id"
1856
+ ],
1857
+ "onDelete": "cascade",
1858
+ "onUpdate": "no action"
1859
+ },
1860
+ "usage_records_store_id_stores_id_fk": {
1861
+ "name": "usage_records_store_id_stores_id_fk",
1862
+ "tableFrom": "usage_records",
1863
+ "tableTo": "stores",
1864
+ "columnsFrom": [
1865
+ "store_id"
1866
+ ],
1867
+ "columnsTo": [
1868
+ "id"
1869
+ ],
1870
+ "onDelete": "set null",
1871
+ "onUpdate": "no action"
1872
+ }
1873
+ },
1874
+ "compositePrimaryKeys": {},
1875
+ "uniqueConstraints": {
1876
+ "usage_records_org_key_unique": {
1877
+ "name": "usage_records_org_key_unique",
1878
+ "nullsNotDistinct": false,
1879
+ "columns": [
1880
+ "organization_id",
1881
+ "idempotency_key"
1882
+ ]
1883
+ }
1884
+ },
1885
+ "policies": {},
1886
+ "checkConstraints": {},
1887
+ "isRLSEnabled": false
1888
+ },
1889
+ "public.notification_defaults": {
1890
+ "name": "notification_defaults",
1891
+ "schema": "",
1892
+ "columns": {
1893
+ "organization_id": {
1894
+ "name": "organization_id",
1895
+ "type": "uuid",
1896
+ "primaryKey": false,
1897
+ "notNull": true
1898
+ },
1899
+ "audience": {
1900
+ "name": "audience",
1901
+ "type": "text",
1902
+ "primaryKey": false,
1903
+ "notNull": true
1904
+ },
1905
+ "event": {
1906
+ "name": "event",
1907
+ "type": "text",
1908
+ "primaryKey": false,
1909
+ "notNull": true
1910
+ },
1911
+ "channel": {
1912
+ "name": "channel",
1913
+ "type": "text",
1914
+ "primaryKey": false,
1915
+ "notNull": true
1916
+ },
1917
+ "enabled": {
1918
+ "name": "enabled",
1919
+ "type": "boolean",
1920
+ "primaryKey": false,
1921
+ "notNull": true
1922
+ },
1923
+ "updated_at": {
1924
+ "name": "updated_at",
1925
+ "type": "timestamp with time zone",
1926
+ "primaryKey": false,
1927
+ "notNull": true,
1928
+ "default": "now()"
1929
+ }
1930
+ },
1931
+ "indexes": {},
1932
+ "foreignKeys": {
1933
+ "notification_defaults_organization_id_organizations_id_fk": {
1934
+ "name": "notification_defaults_organization_id_organizations_id_fk",
1935
+ "tableFrom": "notification_defaults",
1936
+ "tableTo": "organizations",
1937
+ "columnsFrom": [
1938
+ "organization_id"
1939
+ ],
1940
+ "columnsTo": [
1941
+ "id"
1942
+ ],
1943
+ "onDelete": "cascade",
1944
+ "onUpdate": "no action"
1945
+ }
1946
+ },
1947
+ "compositePrimaryKeys": {
1948
+ "notification_defaults_pkey": {
1949
+ "name": "notification_defaults_pkey",
1950
+ "columns": [
1951
+ "organization_id",
1952
+ "audience",
1953
+ "event",
1954
+ "channel"
1955
+ ]
1956
+ }
1957
+ },
1958
+ "uniqueConstraints": {},
1959
+ "policies": {},
1960
+ "checkConstraints": {},
1961
+ "isRLSEnabled": false
1962
+ },
1963
+ "public.notification_preferences": {
1964
+ "name": "notification_preferences",
1965
+ "schema": "",
1966
+ "columns": {
1967
+ "organization_id": {
1968
+ "name": "organization_id",
1969
+ "type": "uuid",
1970
+ "primaryKey": false,
1971
+ "notNull": true
1972
+ },
1973
+ "recipient_type": {
1974
+ "name": "recipient_type",
1975
+ "type": "text",
1976
+ "primaryKey": false,
1977
+ "notNull": true
1978
+ },
1979
+ "recipient_id": {
1980
+ "name": "recipient_id",
1981
+ "type": "text",
1982
+ "primaryKey": false,
1983
+ "notNull": true
1984
+ },
1985
+ "event": {
1986
+ "name": "event",
1987
+ "type": "text",
1988
+ "primaryKey": false,
1989
+ "notNull": true
1990
+ },
1991
+ "channel": {
1992
+ "name": "channel",
1993
+ "type": "text",
1994
+ "primaryKey": false,
1995
+ "notNull": true
1996
+ },
1997
+ "enabled": {
1998
+ "name": "enabled",
1999
+ "type": "boolean",
2000
+ "primaryKey": false,
2001
+ "notNull": true
2002
+ },
2003
+ "updated_at": {
2004
+ "name": "updated_at",
2005
+ "type": "timestamp with time zone",
2006
+ "primaryKey": false,
2007
+ "notNull": true,
2008
+ "default": "now()"
2009
+ }
2010
+ },
2011
+ "indexes": {},
2012
+ "foreignKeys": {
2013
+ "notification_preferences_organization_id_organizations_id_fk": {
2014
+ "name": "notification_preferences_organization_id_organizations_id_fk",
2015
+ "tableFrom": "notification_preferences",
2016
+ "tableTo": "organizations",
2017
+ "columnsFrom": [
2018
+ "organization_id"
2019
+ ],
2020
+ "columnsTo": [
2021
+ "id"
2022
+ ],
2023
+ "onDelete": "cascade",
2024
+ "onUpdate": "no action"
2025
+ }
2026
+ },
2027
+ "compositePrimaryKeys": {
2028
+ "notification_preferences_pkey": {
2029
+ "name": "notification_preferences_pkey",
2030
+ "columns": [
2031
+ "organization_id",
2032
+ "recipient_type",
2033
+ "recipient_id",
2034
+ "event",
2035
+ "channel"
2036
+ ]
2037
+ }
2038
+ },
2039
+ "uniqueConstraints": {},
2040
+ "policies": {},
2041
+ "checkConstraints": {},
2042
+ "isRLSEnabled": false
2043
+ },
2044
+ "public.notifications": {
2045
+ "name": "notifications",
2046
+ "schema": "",
2047
+ "columns": {
2048
+ "id": {
2049
+ "name": "id",
2050
+ "type": "uuid",
2051
+ "primaryKey": true,
2052
+ "notNull": true,
2053
+ "default": "gen_random_uuid()"
2054
+ },
2055
+ "organization_id": {
2056
+ "name": "organization_id",
2057
+ "type": "uuid",
2058
+ "primaryKey": false,
2059
+ "notNull": true
2060
+ },
2061
+ "recipient_type": {
2062
+ "name": "recipient_type",
2063
+ "type": "text",
2064
+ "primaryKey": false,
2065
+ "notNull": true
2066
+ },
2067
+ "recipient_id": {
2068
+ "name": "recipient_id",
2069
+ "type": "text",
2070
+ "primaryKey": false,
2071
+ "notNull": true
2072
+ },
2073
+ "event": {
2074
+ "name": "event",
2075
+ "type": "text",
2076
+ "primaryKey": false,
2077
+ "notNull": true
2078
+ },
2079
+ "title": {
2080
+ "name": "title",
2081
+ "type": "text",
2082
+ "primaryKey": false,
2083
+ "notNull": true
2084
+ },
2085
+ "body": {
2086
+ "name": "body",
2087
+ "type": "text",
2088
+ "primaryKey": false,
2089
+ "notNull": true,
2090
+ "default": "''"
2091
+ },
2092
+ "link": {
2093
+ "name": "link",
2094
+ "type": "text",
2095
+ "primaryKey": false,
2096
+ "notNull": false
2097
+ },
2098
+ "data": {
2099
+ "name": "data",
2100
+ "type": "jsonb",
2101
+ "primaryKey": false,
2102
+ "notNull": true,
2103
+ "default": "'{}'::jsonb"
2104
+ },
2105
+ "dedupe_key": {
2106
+ "name": "dedupe_key",
2107
+ "type": "text",
2108
+ "primaryKey": false,
2109
+ "notNull": false
2110
+ },
2111
+ "read_at": {
2112
+ "name": "read_at",
2113
+ "type": "timestamp with time zone",
2114
+ "primaryKey": false,
2115
+ "notNull": false
2116
+ },
2117
+ "live_sent_at": {
2118
+ "name": "live_sent_at",
2119
+ "type": "timestamp with time zone",
2120
+ "primaryKey": false,
2121
+ "notNull": false
2122
+ },
2123
+ "push_sent_at": {
2124
+ "name": "push_sent_at",
2125
+ "type": "timestamp with time zone",
2126
+ "primaryKey": false,
2127
+ "notNull": false
2128
+ },
2129
+ "email_sent_at": {
2130
+ "name": "email_sent_at",
2131
+ "type": "timestamp with time zone",
2132
+ "primaryKey": false,
2133
+ "notNull": false
2134
+ },
2135
+ "created_at": {
2136
+ "name": "created_at",
2137
+ "type": "timestamp with time zone",
2138
+ "primaryKey": false,
2139
+ "notNull": true,
2140
+ "default": "now()"
2141
+ }
2142
+ },
2143
+ "indexes": {
2144
+ "notifications_recipient_created_idx": {
2145
+ "name": "notifications_recipient_created_idx",
2146
+ "columns": [
2147
+ {
2148
+ "expression": "organization_id",
2149
+ "isExpression": false,
2150
+ "asc": true,
2151
+ "nulls": "last"
2152
+ },
2153
+ {
2154
+ "expression": "recipient_type",
2155
+ "isExpression": false,
2156
+ "asc": true,
2157
+ "nulls": "last"
2158
+ },
2159
+ {
2160
+ "expression": "recipient_id",
2161
+ "isExpression": false,
2162
+ "asc": true,
2163
+ "nulls": "last"
2164
+ },
2165
+ {
2166
+ "expression": "created_at",
2167
+ "isExpression": false,
2168
+ "asc": true,
2169
+ "nulls": "last"
2170
+ }
2171
+ ],
2172
+ "isUnique": false,
2173
+ "concurrently": false,
2174
+ "method": "btree",
2175
+ "with": {}
2176
+ },
2177
+ "notifications_unread_idx": {
2178
+ "name": "notifications_unread_idx",
2179
+ "columns": [
2180
+ {
2181
+ "expression": "organization_id",
2182
+ "isExpression": false,
2183
+ "asc": true,
2184
+ "nulls": "last"
2185
+ },
2186
+ {
2187
+ "expression": "recipient_type",
2188
+ "isExpression": false,
2189
+ "asc": true,
2190
+ "nulls": "last"
2191
+ },
2192
+ {
2193
+ "expression": "recipient_id",
2194
+ "isExpression": false,
2195
+ "asc": true,
2196
+ "nulls": "last"
2197
+ }
2198
+ ],
2199
+ "isUnique": false,
2200
+ "where": "\"notifications\".\"read_at\" is null",
2201
+ "concurrently": false,
2202
+ "method": "btree",
2203
+ "with": {}
2204
+ },
2205
+ "notifications_dedupe_uq": {
2206
+ "name": "notifications_dedupe_uq",
2207
+ "columns": [
2208
+ {
2209
+ "expression": "organization_id",
2210
+ "isExpression": false,
2211
+ "asc": true,
2212
+ "nulls": "last"
2213
+ },
2214
+ {
2215
+ "expression": "recipient_type",
2216
+ "isExpression": false,
2217
+ "asc": true,
2218
+ "nulls": "last"
2219
+ },
2220
+ {
2221
+ "expression": "recipient_id",
2222
+ "isExpression": false,
2223
+ "asc": true,
2224
+ "nulls": "last"
2225
+ },
2226
+ {
2227
+ "expression": "event",
2228
+ "isExpression": false,
2229
+ "asc": true,
2230
+ "nulls": "last"
2231
+ },
2232
+ {
2233
+ "expression": "dedupe_key",
2234
+ "isExpression": false,
2235
+ "asc": true,
2236
+ "nulls": "last"
2237
+ }
2238
+ ],
2239
+ "isUnique": true,
2240
+ "where": "\"notifications\".\"dedupe_key\" is not null",
2241
+ "concurrently": false,
2242
+ "method": "btree",
2243
+ "with": {}
2244
+ }
2245
+ },
2246
+ "foreignKeys": {
2247
+ "notifications_organization_id_organizations_id_fk": {
2248
+ "name": "notifications_organization_id_organizations_id_fk",
2249
+ "tableFrom": "notifications",
2250
+ "tableTo": "organizations",
2251
+ "columnsFrom": [
2252
+ "organization_id"
2253
+ ],
2254
+ "columnsTo": [
2255
+ "id"
2256
+ ],
2257
+ "onDelete": "cascade",
2258
+ "onUpdate": "no action"
2259
+ }
2260
+ },
2261
+ "compositePrimaryKeys": {},
2262
+ "uniqueConstraints": {},
2263
+ "policies": {},
2264
+ "checkConstraints": {},
2265
+ "isRLSEnabled": false
2266
+ },
2267
+ "public.push_subscriptions": {
2268
+ "name": "push_subscriptions",
2269
+ "schema": "",
2270
+ "columns": {
2271
+ "id": {
2272
+ "name": "id",
2273
+ "type": "uuid",
2274
+ "primaryKey": true,
2275
+ "notNull": true,
2276
+ "default": "gen_random_uuid()"
2277
+ },
2278
+ "organization_id": {
2279
+ "name": "organization_id",
2280
+ "type": "uuid",
2281
+ "primaryKey": false,
2282
+ "notNull": true
2283
+ },
2284
+ "recipient_type": {
2285
+ "name": "recipient_type",
2286
+ "type": "text",
2287
+ "primaryKey": false,
2288
+ "notNull": true
2289
+ },
2290
+ "recipient_id": {
2291
+ "name": "recipient_id",
2292
+ "type": "text",
2293
+ "primaryKey": false,
2294
+ "notNull": true
2295
+ },
2296
+ "kind": {
2297
+ "name": "kind",
2298
+ "type": "text",
2299
+ "primaryKey": false,
2300
+ "notNull": true
2301
+ },
2302
+ "endpoint": {
2303
+ "name": "endpoint",
2304
+ "type": "text",
2305
+ "primaryKey": false,
2306
+ "notNull": true
2307
+ },
2308
+ "p256dh": {
2309
+ "name": "p256dh",
2310
+ "type": "text",
2311
+ "primaryKey": false,
2312
+ "notNull": false
2313
+ },
2314
+ "auth": {
2315
+ "name": "auth",
2316
+ "type": "text",
2317
+ "primaryKey": false,
2318
+ "notNull": false
2319
+ },
2320
+ "user_agent": {
2321
+ "name": "user_agent",
2322
+ "type": "text",
2323
+ "primaryKey": false,
2324
+ "notNull": false
2325
+ },
2326
+ "created_at": {
2327
+ "name": "created_at",
2328
+ "type": "timestamp with time zone",
2329
+ "primaryKey": false,
2330
+ "notNull": true,
2331
+ "default": "now()"
2332
+ },
2333
+ "last_used_at": {
2334
+ "name": "last_used_at",
2335
+ "type": "timestamp with time zone",
2336
+ "primaryKey": false,
2337
+ "notNull": false
2338
+ }
2339
+ },
2340
+ "indexes": {
2341
+ "push_subscriptions_recipient_idx": {
2342
+ "name": "push_subscriptions_recipient_idx",
2343
+ "columns": [
2344
+ {
2345
+ "expression": "organization_id",
2346
+ "isExpression": false,
2347
+ "asc": true,
2348
+ "nulls": "last"
2349
+ },
2350
+ {
2351
+ "expression": "recipient_type",
2352
+ "isExpression": false,
2353
+ "asc": true,
2354
+ "nulls": "last"
2355
+ },
2356
+ {
2357
+ "expression": "recipient_id",
2358
+ "isExpression": false,
2359
+ "asc": true,
2360
+ "nulls": "last"
2361
+ }
2362
+ ],
2363
+ "isUnique": false,
2364
+ "concurrently": false,
2365
+ "method": "btree",
2366
+ "with": {}
2367
+ }
2368
+ },
2369
+ "foreignKeys": {
2370
+ "push_subscriptions_organization_id_organizations_id_fk": {
2371
+ "name": "push_subscriptions_organization_id_organizations_id_fk",
2372
+ "tableFrom": "push_subscriptions",
2373
+ "tableTo": "organizations",
2374
+ "columnsFrom": [
2375
+ "organization_id"
2376
+ ],
2377
+ "columnsTo": [
2378
+ "id"
2379
+ ],
2380
+ "onDelete": "cascade",
2381
+ "onUpdate": "no action"
2382
+ }
2383
+ },
2384
+ "compositePrimaryKeys": {},
2385
+ "uniqueConstraints": {
2386
+ "push_subscriptions_org_endpoint_unique": {
2387
+ "name": "push_subscriptions_org_endpoint_unique",
2388
+ "nullsNotDistinct": false,
2389
+ "columns": [
2390
+ "organization_id",
2391
+ "endpoint"
2392
+ ]
2393
+ }
2394
+ },
2395
+ "policies": {},
2396
+ "checkConstraints": {},
2397
+ "isRLSEnabled": false
2398
+ }
2399
+ },
2400
+ "enums": {
2401
+ "public.organization_origin": {
2402
+ "name": "organization_origin",
2403
+ "schema": "public",
2404
+ "values": [
2405
+ "dashboard",
2406
+ "shopify"
2407
+ ]
2408
+ },
2409
+ "public.role": {
2410
+ "name": "role",
2411
+ "schema": "public",
2412
+ "values": [
2413
+ "OWNER",
2414
+ "ADMIN",
2415
+ "MEMBER",
2416
+ "VIEWER"
2417
+ ]
2418
+ },
2419
+ "public.store_status": {
2420
+ "name": "store_status",
2421
+ "schema": "public",
2422
+ "values": [
2423
+ "ACTIVE",
2424
+ "UNINSTALLED"
2425
+ ]
2426
+ },
2427
+ "public.subscription_status": {
2428
+ "name": "subscription_status",
2429
+ "schema": "public",
2430
+ "values": [
2431
+ "ACTIVE",
2432
+ "CANCELLED"
2433
+ ]
2434
+ }
2435
+ },
2436
+ "schemas": {},
2437
+ "sequences": {},
2438
+ "roles": {},
2439
+ "policies": {},
2440
+ "views": {},
2441
+ "_meta": {
2442
+ "columns": {},
2443
+ "schemas": {},
2444
+ "tables": {}
2445
+ }
2446
+ }