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