@wraps.dev/cli 2.21.10 → 2.21.11

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 (63) hide show
  1. package/dist/api-lambda.zip +0 -0
  2. package/dist/lambda/event-processor/.bundled +1 -1
  3. package/dist/lambda/inbound-processor/.bundled +1 -1
  4. package/dist/lambda/sms-event-processor/.bundled +1 -1
  5. package/dist/selfhost-migrations/meta/0000_snapshot.json +1311 -0
  6. package/dist/selfhost-migrations/meta/0001_snapshot.json +1454 -0
  7. package/dist/selfhost-migrations/meta/0002_snapshot.json +1460 -0
  8. package/dist/selfhost-migrations/meta/0003_snapshot.json +1467 -0
  9. package/dist/selfhost-migrations/meta/0004_snapshot.json +1473 -0
  10. package/dist/selfhost-migrations/meta/0005_snapshot.json +1499 -0
  11. package/dist/selfhost-migrations/meta/0006_snapshot.json +1617 -0
  12. package/dist/selfhost-migrations/meta/0007_snapshot.json +2581 -0
  13. package/dist/selfhost-migrations/meta/0008_snapshot.json +2861 -0
  14. package/dist/selfhost-migrations/meta/0009_snapshot.json +3447 -0
  15. package/dist/selfhost-migrations/meta/0010_snapshot.json +3586 -0
  16. package/dist/selfhost-migrations/meta/0011_snapshot.json +3600 -0
  17. package/dist/selfhost-migrations/meta/0012_snapshot.json +3607 -0
  18. package/dist/selfhost-migrations/meta/0013_snapshot.json +4697 -0
  19. package/dist/selfhost-migrations/meta/0014_snapshot.json +4704 -0
  20. package/dist/selfhost-migrations/meta/0015_snapshot.json +4697 -0
  21. package/dist/selfhost-migrations/meta/0016_snapshot.json +4703 -0
  22. package/dist/selfhost-migrations/meta/0017_snapshot.json +4769 -0
  23. package/dist/selfhost-migrations/meta/0018_snapshot.json +4821 -0
  24. package/dist/selfhost-migrations/meta/0019_snapshot.json +4840 -0
  25. package/dist/selfhost-migrations/meta/0020_snapshot.json +5602 -0
  26. package/dist/selfhost-migrations/meta/0021_snapshot.json +5729 -0
  27. package/dist/selfhost-migrations/meta/0022_snapshot.json +5792 -0
  28. package/dist/selfhost-migrations/meta/0023_snapshot.json +5799 -0
  29. package/dist/selfhost-migrations/meta/0024_snapshot.json +5821 -0
  30. package/dist/selfhost-migrations/meta/0025_snapshot.json +5831 -0
  31. package/dist/selfhost-migrations/meta/0026_snapshot.json +5844 -0
  32. package/dist/selfhost-migrations/meta/0027_snapshot.json +5864 -0
  33. package/dist/selfhost-migrations/meta/0028_snapshot.json +5871 -0
  34. package/dist/selfhost-migrations/meta/0029_snapshot.json +5984 -0
  35. package/dist/selfhost-migrations/meta/0030_snapshot.json +5990 -0
  36. package/dist/selfhost-migrations/meta/0031_snapshot.json +5950 -0
  37. package/dist/selfhost-migrations/meta/0032_snapshot.json +6042 -0
  38. package/dist/selfhost-migrations/meta/0033_snapshot.json +6057 -0
  39. package/dist/selfhost-migrations/meta/0034_snapshot.json +6130 -0
  40. package/dist/selfhost-migrations/meta/0035_snapshot.json +6195 -0
  41. package/dist/selfhost-migrations/meta/0036_snapshot.json +6201 -0
  42. package/dist/selfhost-migrations/meta/0037_snapshot.json +6265 -0
  43. package/dist/selfhost-migrations/meta/0038_snapshot.json +6271 -0
  44. package/dist/selfhost-migrations/meta/0039_snapshot.json +6278 -0
  45. package/dist/selfhost-migrations/meta/0041_snapshot.json +6284 -0
  46. package/dist/selfhost-migrations/meta/0042_snapshot.json +6297 -0
  47. package/dist/selfhost-migrations/meta/0043_snapshot.json +6297 -0
  48. package/dist/selfhost-migrations/meta/0044_snapshot.json +6297 -0
  49. package/dist/selfhost-migrations/meta/0045_snapshot.json +6303 -0
  50. package/dist/selfhost-migrations/meta/0046_snapshot.json +6315 -0
  51. package/dist/selfhost-migrations/meta/0047_snapshot.json +6330 -0
  52. package/dist/selfhost-migrations/meta/0048_snapshot.json +6336 -0
  53. package/dist/selfhost-migrations/meta/0049_snapshot.json +6366 -0
  54. package/dist/selfhost-migrations/meta/0050_snapshot.json +6390 -0
  55. package/dist/selfhost-migrations/meta/0051_snapshot.json +6403 -0
  56. package/dist/selfhost-migrations/meta/0052_snapshot.json +6470 -0
  57. package/dist/selfhost-migrations/meta/0053_snapshot.json +6470 -0
  58. package/dist/selfhost-migrations/meta/0054_snapshot.json +6646 -0
  59. package/dist/selfhost-migrations/meta/0055_snapshot.json +6677 -0
  60. package/dist/selfhost-migrations/meta/0056_snapshot.json +6677 -0
  61. package/dist/selfhost-migrations/meta/0057_snapshot.json +6674 -0
  62. package/dist/selfhost-migrations/meta/_journal.json +412 -0
  63. package/package.json +3 -3
@@ -0,0 +1,3607 @@
1
+ {
2
+ "id": "f37c1022-3ada-489d-abf3-943303802f88",
3
+ "prevId": "360b955a-2a18-4117-b335-cfe4fbe4199b",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.api_key": {
8
+ "name": "api_key",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "organization_id": {
18
+ "name": "organization_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "name": {
24
+ "name": "name",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": true
28
+ },
29
+ "key_hash": {
30
+ "name": "key_hash",
31
+ "type": "text",
32
+ "primaryKey": false,
33
+ "notNull": true
34
+ },
35
+ "prefix": {
36
+ "name": "prefix",
37
+ "type": "text",
38
+ "primaryKey": false,
39
+ "notNull": true
40
+ },
41
+ "permissions": {
42
+ "name": "permissions",
43
+ "type": "json",
44
+ "primaryKey": false,
45
+ "notNull": false,
46
+ "default": "'[]'::json"
47
+ },
48
+ "last_used_at": {
49
+ "name": "last_used_at",
50
+ "type": "timestamp",
51
+ "primaryKey": false,
52
+ "notNull": false
53
+ },
54
+ "expires_at": {
55
+ "name": "expires_at",
56
+ "type": "timestamp",
57
+ "primaryKey": false,
58
+ "notNull": false
59
+ },
60
+ "created_by": {
61
+ "name": "created_by",
62
+ "type": "text",
63
+ "primaryKey": false,
64
+ "notNull": false
65
+ },
66
+ "created_at": {
67
+ "name": "created_at",
68
+ "type": "timestamp",
69
+ "primaryKey": false,
70
+ "notNull": true,
71
+ "default": "now()"
72
+ }
73
+ },
74
+ "indexes": {
75
+ "api_key_org_idx": {
76
+ "name": "api_key_org_idx",
77
+ "columns": [
78
+ {
79
+ "expression": "organization_id",
80
+ "isExpression": false,
81
+ "asc": true,
82
+ "nulls": "last"
83
+ }
84
+ ],
85
+ "isUnique": false,
86
+ "concurrently": false,
87
+ "method": "btree",
88
+ "with": {}
89
+ },
90
+ "api_key_prefix_idx": {
91
+ "name": "api_key_prefix_idx",
92
+ "columns": [
93
+ {
94
+ "expression": "prefix",
95
+ "isExpression": false,
96
+ "asc": true,
97
+ "nulls": "last"
98
+ }
99
+ ],
100
+ "isUnique": false,
101
+ "concurrently": false,
102
+ "method": "btree",
103
+ "with": {}
104
+ }
105
+ },
106
+ "foreignKeys": {
107
+ "api_key_organization_id_organization_id_fk": {
108
+ "name": "api_key_organization_id_organization_id_fk",
109
+ "tableFrom": "api_key",
110
+ "tableTo": "organization",
111
+ "columnsFrom": ["organization_id"],
112
+ "columnsTo": ["id"],
113
+ "onDelete": "cascade",
114
+ "onUpdate": "no action"
115
+ },
116
+ "api_key_created_by_user_id_fk": {
117
+ "name": "api_key_created_by_user_id_fk",
118
+ "tableFrom": "api_key",
119
+ "tableTo": "user",
120
+ "columnsFrom": ["created_by"],
121
+ "columnsTo": ["id"],
122
+ "onDelete": "no action",
123
+ "onUpdate": "no action"
124
+ }
125
+ },
126
+ "compositePrimaryKeys": {},
127
+ "uniqueConstraints": {},
128
+ "policies": {},
129
+ "checkConstraints": {},
130
+ "isRLSEnabled": false
131
+ },
132
+ "public.audit_log": {
133
+ "name": "audit_log",
134
+ "schema": "",
135
+ "columns": {
136
+ "id": {
137
+ "name": "id",
138
+ "type": "text",
139
+ "primaryKey": true,
140
+ "notNull": true
141
+ },
142
+ "organization_id": {
143
+ "name": "organization_id",
144
+ "type": "text",
145
+ "primaryKey": false,
146
+ "notNull": true
147
+ },
148
+ "user_id": {
149
+ "name": "user_id",
150
+ "type": "text",
151
+ "primaryKey": false,
152
+ "notNull": false
153
+ },
154
+ "action": {
155
+ "name": "action",
156
+ "type": "text",
157
+ "primaryKey": false,
158
+ "notNull": true
159
+ },
160
+ "resource": {
161
+ "name": "resource",
162
+ "type": "text",
163
+ "primaryKey": false,
164
+ "notNull": true
165
+ },
166
+ "resource_id": {
167
+ "name": "resource_id",
168
+ "type": "text",
169
+ "primaryKey": false,
170
+ "notNull": false
171
+ },
172
+ "metadata": {
173
+ "name": "metadata",
174
+ "type": "json",
175
+ "primaryKey": false,
176
+ "notNull": false
177
+ },
178
+ "ip_address": {
179
+ "name": "ip_address",
180
+ "type": "text",
181
+ "primaryKey": false,
182
+ "notNull": false
183
+ },
184
+ "user_agent": {
185
+ "name": "user_agent",
186
+ "type": "text",
187
+ "primaryKey": false,
188
+ "notNull": false
189
+ },
190
+ "created_at": {
191
+ "name": "created_at",
192
+ "type": "timestamp",
193
+ "primaryKey": false,
194
+ "notNull": true,
195
+ "default": "now()"
196
+ }
197
+ },
198
+ "indexes": {
199
+ "audit_log_org_idx": {
200
+ "name": "audit_log_org_idx",
201
+ "columns": [
202
+ {
203
+ "expression": "organization_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
+ "audit_log_timestamp_idx": {
215
+ "name": "audit_log_timestamp_idx",
216
+ "columns": [
217
+ {
218
+ "expression": "created_at",
219
+ "isExpression": false,
220
+ "asc": true,
221
+ "nulls": "last"
222
+ }
223
+ ],
224
+ "isUnique": false,
225
+ "concurrently": false,
226
+ "method": "btree",
227
+ "with": {}
228
+ }
229
+ },
230
+ "foreignKeys": {
231
+ "audit_log_organization_id_organization_id_fk": {
232
+ "name": "audit_log_organization_id_organization_id_fk",
233
+ "tableFrom": "audit_log",
234
+ "tableTo": "organization",
235
+ "columnsFrom": ["organization_id"],
236
+ "columnsTo": ["id"],
237
+ "onDelete": "cascade",
238
+ "onUpdate": "no action"
239
+ },
240
+ "audit_log_user_id_user_id_fk": {
241
+ "name": "audit_log_user_id_user_id_fk",
242
+ "tableFrom": "audit_log",
243
+ "tableTo": "user",
244
+ "columnsFrom": ["user_id"],
245
+ "columnsTo": ["id"],
246
+ "onDelete": "no action",
247
+ "onUpdate": "no action"
248
+ }
249
+ },
250
+ "compositePrimaryKeys": {},
251
+ "uniqueConstraints": {},
252
+ "policies": {},
253
+ "checkConstraints": {},
254
+ "isRLSEnabled": false
255
+ },
256
+ "public.aws_account": {
257
+ "name": "aws_account",
258
+ "schema": "",
259
+ "columns": {
260
+ "id": {
261
+ "name": "id",
262
+ "type": "text",
263
+ "primaryKey": true,
264
+ "notNull": true
265
+ },
266
+ "organization_id": {
267
+ "name": "organization_id",
268
+ "type": "text",
269
+ "primaryKey": false,
270
+ "notNull": true
271
+ },
272
+ "name": {
273
+ "name": "name",
274
+ "type": "text",
275
+ "primaryKey": false,
276
+ "notNull": true
277
+ },
278
+ "account_id": {
279
+ "name": "account_id",
280
+ "type": "text",
281
+ "primaryKey": false,
282
+ "notNull": true
283
+ },
284
+ "region": {
285
+ "name": "region",
286
+ "type": "text",
287
+ "primaryKey": false,
288
+ "notNull": true
289
+ },
290
+ "role_arn": {
291
+ "name": "role_arn",
292
+ "type": "text",
293
+ "primaryKey": false,
294
+ "notNull": true
295
+ },
296
+ "external_id": {
297
+ "name": "external_id",
298
+ "type": "text",
299
+ "primaryKey": false,
300
+ "notNull": true
301
+ },
302
+ "is_verified": {
303
+ "name": "is_verified",
304
+ "type": "boolean",
305
+ "primaryKey": false,
306
+ "notNull": true,
307
+ "default": false
308
+ },
309
+ "last_verified_at": {
310
+ "name": "last_verified_at",
311
+ "type": "timestamp",
312
+ "primaryKey": false,
313
+ "notNull": false
314
+ },
315
+ "archiving_enabled": {
316
+ "name": "archiving_enabled",
317
+ "type": "boolean",
318
+ "primaryKey": false,
319
+ "notNull": true,
320
+ "default": false
321
+ },
322
+ "archive_arn": {
323
+ "name": "archive_arn",
324
+ "type": "text",
325
+ "primaryKey": false,
326
+ "notNull": false
327
+ },
328
+ "event_history_enabled": {
329
+ "name": "event_history_enabled",
330
+ "type": "boolean",
331
+ "primaryKey": false,
332
+ "notNull": true,
333
+ "default": false
334
+ },
335
+ "event_tracking_enabled": {
336
+ "name": "event_tracking_enabled",
337
+ "type": "boolean",
338
+ "primaryKey": false,
339
+ "notNull": true,
340
+ "default": false
341
+ },
342
+ "config_set_name": {
343
+ "name": "config_set_name",
344
+ "type": "text",
345
+ "primaryKey": false,
346
+ "notNull": false
347
+ },
348
+ "custom_tracking_domain": {
349
+ "name": "custom_tracking_domain",
350
+ "type": "text",
351
+ "primaryKey": false,
352
+ "notNull": false
353
+ },
354
+ "sms_enabled": {
355
+ "name": "sms_enabled",
356
+ "type": "boolean",
357
+ "primaryKey": false,
358
+ "notNull": true,
359
+ "default": false
360
+ },
361
+ "sms_phone_number_count": {
362
+ "name": "sms_phone_number_count",
363
+ "type": "integer",
364
+ "primaryKey": false,
365
+ "notNull": true,
366
+ "default": 0
367
+ },
368
+ "sms_event_history_enabled": {
369
+ "name": "sms_event_history_enabled",
370
+ "type": "boolean",
371
+ "primaryKey": false,
372
+ "notNull": true,
373
+ "default": false
374
+ },
375
+ "created_by": {
376
+ "name": "created_by",
377
+ "type": "text",
378
+ "primaryKey": false,
379
+ "notNull": false
380
+ },
381
+ "created_at": {
382
+ "name": "created_at",
383
+ "type": "timestamp",
384
+ "primaryKey": false,
385
+ "notNull": true,
386
+ "default": "now()"
387
+ },
388
+ "updated_at": {
389
+ "name": "updated_at",
390
+ "type": "timestamp",
391
+ "primaryKey": false,
392
+ "notNull": true,
393
+ "default": "now()"
394
+ }
395
+ },
396
+ "indexes": {
397
+ "aws_account_org_idx": {
398
+ "name": "aws_account_org_idx",
399
+ "columns": [
400
+ {
401
+ "expression": "organization_id",
402
+ "isExpression": false,
403
+ "asc": true,
404
+ "nulls": "last"
405
+ }
406
+ ],
407
+ "isUnique": false,
408
+ "concurrently": false,
409
+ "method": "btree",
410
+ "with": {}
411
+ },
412
+ "aws_account_external_id_idx": {
413
+ "name": "aws_account_external_id_idx",
414
+ "columns": [
415
+ {
416
+ "expression": "external_id",
417
+ "isExpression": false,
418
+ "asc": true,
419
+ "nulls": "last"
420
+ }
421
+ ],
422
+ "isUnique": false,
423
+ "concurrently": false,
424
+ "method": "btree",
425
+ "with": {}
426
+ }
427
+ },
428
+ "foreignKeys": {
429
+ "aws_account_organization_id_organization_id_fk": {
430
+ "name": "aws_account_organization_id_organization_id_fk",
431
+ "tableFrom": "aws_account",
432
+ "tableTo": "organization",
433
+ "columnsFrom": ["organization_id"],
434
+ "columnsTo": ["id"],
435
+ "onDelete": "cascade",
436
+ "onUpdate": "no action"
437
+ },
438
+ "aws_account_created_by_user_id_fk": {
439
+ "name": "aws_account_created_by_user_id_fk",
440
+ "tableFrom": "aws_account",
441
+ "tableTo": "user",
442
+ "columnsFrom": ["created_by"],
443
+ "columnsTo": ["id"],
444
+ "onDelete": "no action",
445
+ "onUpdate": "no action"
446
+ }
447
+ },
448
+ "compositePrimaryKeys": {},
449
+ "uniqueConstraints": {
450
+ "aws_account_external_id_unique": {
451
+ "name": "aws_account_external_id_unique",
452
+ "nullsNotDistinct": false,
453
+ "columns": ["external_id"]
454
+ }
455
+ },
456
+ "policies": {},
457
+ "checkConstraints": {},
458
+ "isRLSEnabled": false
459
+ },
460
+ "public.aws_account_permission": {
461
+ "name": "aws_account_permission",
462
+ "schema": "",
463
+ "columns": {
464
+ "id": {
465
+ "name": "id",
466
+ "type": "text",
467
+ "primaryKey": true,
468
+ "notNull": true
469
+ },
470
+ "user_id": {
471
+ "name": "user_id",
472
+ "type": "text",
473
+ "primaryKey": false,
474
+ "notNull": true
475
+ },
476
+ "aws_account_id": {
477
+ "name": "aws_account_id",
478
+ "type": "text",
479
+ "primaryKey": false,
480
+ "notNull": true
481
+ },
482
+ "permissions": {
483
+ "name": "permissions",
484
+ "type": "json",
485
+ "primaryKey": false,
486
+ "notNull": true
487
+ },
488
+ "granted_by": {
489
+ "name": "granted_by",
490
+ "type": "text",
491
+ "primaryKey": false,
492
+ "notNull": true
493
+ },
494
+ "expires_at": {
495
+ "name": "expires_at",
496
+ "type": "timestamp",
497
+ "primaryKey": false,
498
+ "notNull": false
499
+ },
500
+ "created_at": {
501
+ "name": "created_at",
502
+ "type": "timestamp",
503
+ "primaryKey": false,
504
+ "notNull": true,
505
+ "default": "now()"
506
+ },
507
+ "updated_at": {
508
+ "name": "updated_at",
509
+ "type": "timestamp",
510
+ "primaryKey": false,
511
+ "notNull": true,
512
+ "default": "now()"
513
+ }
514
+ },
515
+ "indexes": {
516
+ "aws_account_permission_user_idx": {
517
+ "name": "aws_account_permission_user_idx",
518
+ "columns": [
519
+ {
520
+ "expression": "user_id",
521
+ "isExpression": false,
522
+ "asc": true,
523
+ "nulls": "last"
524
+ }
525
+ ],
526
+ "isUnique": false,
527
+ "concurrently": false,
528
+ "method": "btree",
529
+ "with": {}
530
+ },
531
+ "aws_account_permission_account_idx": {
532
+ "name": "aws_account_permission_account_idx",
533
+ "columns": [
534
+ {
535
+ "expression": "aws_account_id",
536
+ "isExpression": false,
537
+ "asc": true,
538
+ "nulls": "last"
539
+ }
540
+ ],
541
+ "isUnique": false,
542
+ "concurrently": false,
543
+ "method": "btree",
544
+ "with": {}
545
+ },
546
+ "aws_account_permission_unique_idx": {
547
+ "name": "aws_account_permission_unique_idx",
548
+ "columns": [
549
+ {
550
+ "expression": "user_id",
551
+ "isExpression": false,
552
+ "asc": true,
553
+ "nulls": "last"
554
+ },
555
+ {
556
+ "expression": "aws_account_id",
557
+ "isExpression": false,
558
+ "asc": true,
559
+ "nulls": "last"
560
+ }
561
+ ],
562
+ "isUnique": false,
563
+ "concurrently": false,
564
+ "method": "btree",
565
+ "with": {}
566
+ }
567
+ },
568
+ "foreignKeys": {
569
+ "aws_account_permission_user_id_user_id_fk": {
570
+ "name": "aws_account_permission_user_id_user_id_fk",
571
+ "tableFrom": "aws_account_permission",
572
+ "tableTo": "user",
573
+ "columnsFrom": ["user_id"],
574
+ "columnsTo": ["id"],
575
+ "onDelete": "cascade",
576
+ "onUpdate": "no action"
577
+ },
578
+ "aws_account_permission_aws_account_id_aws_account_id_fk": {
579
+ "name": "aws_account_permission_aws_account_id_aws_account_id_fk",
580
+ "tableFrom": "aws_account_permission",
581
+ "tableTo": "aws_account",
582
+ "columnsFrom": ["aws_account_id"],
583
+ "columnsTo": ["id"],
584
+ "onDelete": "cascade",
585
+ "onUpdate": "no action"
586
+ },
587
+ "aws_account_permission_granted_by_user_id_fk": {
588
+ "name": "aws_account_permission_granted_by_user_id_fk",
589
+ "tableFrom": "aws_account_permission",
590
+ "tableTo": "user",
591
+ "columnsFrom": ["granted_by"],
592
+ "columnsTo": ["id"],
593
+ "onDelete": "no action",
594
+ "onUpdate": "no action"
595
+ }
596
+ },
597
+ "compositePrimaryKeys": {},
598
+ "uniqueConstraints": {},
599
+ "policies": {},
600
+ "checkConstraints": {},
601
+ "isRLSEnabled": false
602
+ },
603
+ "public.email_template": {
604
+ "name": "email_template",
605
+ "schema": "",
606
+ "columns": {
607
+ "id": {
608
+ "name": "id",
609
+ "type": "text",
610
+ "primaryKey": true,
611
+ "notNull": true
612
+ },
613
+ "organization_id": {
614
+ "name": "organization_id",
615
+ "type": "text",
616
+ "primaryKey": false,
617
+ "notNull": true
618
+ },
619
+ "name": {
620
+ "name": "name",
621
+ "type": "text",
622
+ "primaryKey": false,
623
+ "notNull": true
624
+ },
625
+ "subject": {
626
+ "name": "subject",
627
+ "type": "text",
628
+ "primaryKey": false,
629
+ "notNull": false
630
+ },
631
+ "html": {
632
+ "name": "html",
633
+ "type": "text",
634
+ "primaryKey": false,
635
+ "notNull": false
636
+ },
637
+ "variables": {
638
+ "name": "variables",
639
+ "type": "json",
640
+ "primaryKey": false,
641
+ "notNull": false,
642
+ "default": "'[]'::json"
643
+ },
644
+ "created_by": {
645
+ "name": "created_by",
646
+ "type": "text",
647
+ "primaryKey": false,
648
+ "notNull": false
649
+ },
650
+ "created_at": {
651
+ "name": "created_at",
652
+ "type": "timestamp",
653
+ "primaryKey": false,
654
+ "notNull": true,
655
+ "default": "now()"
656
+ },
657
+ "updated_at": {
658
+ "name": "updated_at",
659
+ "type": "timestamp",
660
+ "primaryKey": false,
661
+ "notNull": true,
662
+ "default": "now()"
663
+ }
664
+ },
665
+ "indexes": {
666
+ "email_template_org_idx": {
667
+ "name": "email_template_org_idx",
668
+ "columns": [
669
+ {
670
+ "expression": "organization_id",
671
+ "isExpression": false,
672
+ "asc": true,
673
+ "nulls": "last"
674
+ }
675
+ ],
676
+ "isUnique": false,
677
+ "concurrently": false,
678
+ "method": "btree",
679
+ "with": {}
680
+ }
681
+ },
682
+ "foreignKeys": {
683
+ "email_template_organization_id_organization_id_fk": {
684
+ "name": "email_template_organization_id_organization_id_fk",
685
+ "tableFrom": "email_template",
686
+ "tableTo": "organization",
687
+ "columnsFrom": ["organization_id"],
688
+ "columnsTo": ["id"],
689
+ "onDelete": "cascade",
690
+ "onUpdate": "no action"
691
+ },
692
+ "email_template_created_by_user_id_fk": {
693
+ "name": "email_template_created_by_user_id_fk",
694
+ "tableFrom": "email_template",
695
+ "tableTo": "user",
696
+ "columnsFrom": ["created_by"],
697
+ "columnsTo": ["id"],
698
+ "onDelete": "no action",
699
+ "onUpdate": "no action"
700
+ }
701
+ },
702
+ "compositePrimaryKeys": {},
703
+ "uniqueConstraints": {},
704
+ "policies": {},
705
+ "checkConstraints": {},
706
+ "isRLSEnabled": false
707
+ },
708
+ "public.organization_extension": {
709
+ "name": "organization_extension",
710
+ "schema": "",
711
+ "columns": {
712
+ "organization_id": {
713
+ "name": "organization_id",
714
+ "type": "text",
715
+ "primaryKey": true,
716
+ "notNull": true
717
+ },
718
+ "plan": {
719
+ "name": "plan",
720
+ "type": "text",
721
+ "primaryKey": false,
722
+ "notNull": true,
723
+ "default": "'free'"
724
+ },
725
+ "stripe_customer_id": {
726
+ "name": "stripe_customer_id",
727
+ "type": "text",
728
+ "primaryKey": false,
729
+ "notNull": false
730
+ },
731
+ "stripe_subscription_id": {
732
+ "name": "stripe_subscription_id",
733
+ "type": "text",
734
+ "primaryKey": false,
735
+ "notNull": false
736
+ },
737
+ "aws_account_count": {
738
+ "name": "aws_account_count",
739
+ "type": "integer",
740
+ "primaryKey": false,
741
+ "notNull": true,
742
+ "default": 0
743
+ },
744
+ "member_count": {
745
+ "name": "member_count",
746
+ "type": "integer",
747
+ "primaryKey": false,
748
+ "notNull": true,
749
+ "default": 1
750
+ },
751
+ "onboarding_completed": {
752
+ "name": "onboarding_completed",
753
+ "type": "boolean",
754
+ "primaryKey": false,
755
+ "notNull": true,
756
+ "default": false
757
+ },
758
+ "onboarding_completed_at": {
759
+ "name": "onboarding_completed_at",
760
+ "type": "timestamp",
761
+ "primaryKey": false,
762
+ "notNull": false
763
+ },
764
+ "updated_at": {
765
+ "name": "updated_at",
766
+ "type": "timestamp",
767
+ "primaryKey": false,
768
+ "notNull": true,
769
+ "default": "now()"
770
+ }
771
+ },
772
+ "indexes": {},
773
+ "foreignKeys": {
774
+ "organization_extension_organization_id_organization_id_fk": {
775
+ "name": "organization_extension_organization_id_organization_id_fk",
776
+ "tableFrom": "organization_extension",
777
+ "tableTo": "organization",
778
+ "columnsFrom": ["organization_id"],
779
+ "columnsTo": ["id"],
780
+ "onDelete": "cascade",
781
+ "onUpdate": "no action"
782
+ }
783
+ },
784
+ "compositePrimaryKeys": {},
785
+ "uniqueConstraints": {},
786
+ "policies": {},
787
+ "checkConstraints": {},
788
+ "isRLSEnabled": false
789
+ },
790
+ "public.account": {
791
+ "name": "account",
792
+ "schema": "",
793
+ "columns": {
794
+ "id": {
795
+ "name": "id",
796
+ "type": "text",
797
+ "primaryKey": true,
798
+ "notNull": true
799
+ },
800
+ "account_id": {
801
+ "name": "account_id",
802
+ "type": "text",
803
+ "primaryKey": false,
804
+ "notNull": true
805
+ },
806
+ "provider_id": {
807
+ "name": "provider_id",
808
+ "type": "text",
809
+ "primaryKey": false,
810
+ "notNull": true
811
+ },
812
+ "user_id": {
813
+ "name": "user_id",
814
+ "type": "text",
815
+ "primaryKey": false,
816
+ "notNull": true
817
+ },
818
+ "access_token": {
819
+ "name": "access_token",
820
+ "type": "text",
821
+ "primaryKey": false,
822
+ "notNull": false
823
+ },
824
+ "refresh_token": {
825
+ "name": "refresh_token",
826
+ "type": "text",
827
+ "primaryKey": false,
828
+ "notNull": false
829
+ },
830
+ "id_token": {
831
+ "name": "id_token",
832
+ "type": "text",
833
+ "primaryKey": false,
834
+ "notNull": false
835
+ },
836
+ "access_token_expires_at": {
837
+ "name": "access_token_expires_at",
838
+ "type": "timestamp",
839
+ "primaryKey": false,
840
+ "notNull": false
841
+ },
842
+ "refresh_token_expires_at": {
843
+ "name": "refresh_token_expires_at",
844
+ "type": "timestamp",
845
+ "primaryKey": false,
846
+ "notNull": false
847
+ },
848
+ "scope": {
849
+ "name": "scope",
850
+ "type": "text",
851
+ "primaryKey": false,
852
+ "notNull": false
853
+ },
854
+ "password": {
855
+ "name": "password",
856
+ "type": "text",
857
+ "primaryKey": false,
858
+ "notNull": false
859
+ },
860
+ "created_at": {
861
+ "name": "created_at",
862
+ "type": "timestamp",
863
+ "primaryKey": false,
864
+ "notNull": true
865
+ },
866
+ "updated_at": {
867
+ "name": "updated_at",
868
+ "type": "timestamp",
869
+ "primaryKey": false,
870
+ "notNull": true
871
+ }
872
+ },
873
+ "indexes": {},
874
+ "foreignKeys": {
875
+ "account_user_id_user_id_fk": {
876
+ "name": "account_user_id_user_id_fk",
877
+ "tableFrom": "account",
878
+ "tableTo": "user",
879
+ "columnsFrom": ["user_id"],
880
+ "columnsTo": ["id"],
881
+ "onDelete": "cascade",
882
+ "onUpdate": "no action"
883
+ }
884
+ },
885
+ "compositePrimaryKeys": {},
886
+ "uniqueConstraints": {},
887
+ "policies": {},
888
+ "checkConstraints": {},
889
+ "isRLSEnabled": false
890
+ },
891
+ "public.invitation": {
892
+ "name": "invitation",
893
+ "schema": "",
894
+ "columns": {
895
+ "id": {
896
+ "name": "id",
897
+ "type": "text",
898
+ "primaryKey": true,
899
+ "notNull": true
900
+ },
901
+ "organization_id": {
902
+ "name": "organization_id",
903
+ "type": "text",
904
+ "primaryKey": false,
905
+ "notNull": true
906
+ },
907
+ "email": {
908
+ "name": "email",
909
+ "type": "text",
910
+ "primaryKey": false,
911
+ "notNull": true
912
+ },
913
+ "role": {
914
+ "name": "role",
915
+ "type": "text",
916
+ "primaryKey": false,
917
+ "notNull": false
918
+ },
919
+ "status": {
920
+ "name": "status",
921
+ "type": "text",
922
+ "primaryKey": false,
923
+ "notNull": true
924
+ },
925
+ "expires_at": {
926
+ "name": "expires_at",
927
+ "type": "timestamp",
928
+ "primaryKey": false,
929
+ "notNull": true
930
+ },
931
+ "inviter_id": {
932
+ "name": "inviter_id",
933
+ "type": "text",
934
+ "primaryKey": false,
935
+ "notNull": true
936
+ }
937
+ },
938
+ "indexes": {},
939
+ "foreignKeys": {
940
+ "invitation_organization_id_organization_id_fk": {
941
+ "name": "invitation_organization_id_organization_id_fk",
942
+ "tableFrom": "invitation",
943
+ "tableTo": "organization",
944
+ "columnsFrom": ["organization_id"],
945
+ "columnsTo": ["id"],
946
+ "onDelete": "cascade",
947
+ "onUpdate": "no action"
948
+ },
949
+ "invitation_inviter_id_user_id_fk": {
950
+ "name": "invitation_inviter_id_user_id_fk",
951
+ "tableFrom": "invitation",
952
+ "tableTo": "user",
953
+ "columnsFrom": ["inviter_id"],
954
+ "columnsTo": ["id"],
955
+ "onDelete": "cascade",
956
+ "onUpdate": "no action"
957
+ }
958
+ },
959
+ "compositePrimaryKeys": {},
960
+ "uniqueConstraints": {},
961
+ "policies": {},
962
+ "checkConstraints": {},
963
+ "isRLSEnabled": false
964
+ },
965
+ "public.member": {
966
+ "name": "member",
967
+ "schema": "",
968
+ "columns": {
969
+ "id": {
970
+ "name": "id",
971
+ "type": "text",
972
+ "primaryKey": true,
973
+ "notNull": true
974
+ },
975
+ "organization_id": {
976
+ "name": "organization_id",
977
+ "type": "text",
978
+ "primaryKey": false,
979
+ "notNull": true
980
+ },
981
+ "user_id": {
982
+ "name": "user_id",
983
+ "type": "text",
984
+ "primaryKey": false,
985
+ "notNull": true
986
+ },
987
+ "role": {
988
+ "name": "role",
989
+ "type": "text",
990
+ "primaryKey": false,
991
+ "notNull": true
992
+ },
993
+ "created_at": {
994
+ "name": "created_at",
995
+ "type": "timestamp",
996
+ "primaryKey": false,
997
+ "notNull": true
998
+ }
999
+ },
1000
+ "indexes": {},
1001
+ "foreignKeys": {
1002
+ "member_organization_id_organization_id_fk": {
1003
+ "name": "member_organization_id_organization_id_fk",
1004
+ "tableFrom": "member",
1005
+ "tableTo": "organization",
1006
+ "columnsFrom": ["organization_id"],
1007
+ "columnsTo": ["id"],
1008
+ "onDelete": "cascade",
1009
+ "onUpdate": "no action"
1010
+ },
1011
+ "member_user_id_user_id_fk": {
1012
+ "name": "member_user_id_user_id_fk",
1013
+ "tableFrom": "member",
1014
+ "tableTo": "user",
1015
+ "columnsFrom": ["user_id"],
1016
+ "columnsTo": ["id"],
1017
+ "onDelete": "cascade",
1018
+ "onUpdate": "no action"
1019
+ }
1020
+ },
1021
+ "compositePrimaryKeys": {},
1022
+ "uniqueConstraints": {},
1023
+ "policies": {},
1024
+ "checkConstraints": {},
1025
+ "isRLSEnabled": false
1026
+ },
1027
+ "public.organization": {
1028
+ "name": "organization",
1029
+ "schema": "",
1030
+ "columns": {
1031
+ "id": {
1032
+ "name": "id",
1033
+ "type": "text",
1034
+ "primaryKey": true,
1035
+ "notNull": true
1036
+ },
1037
+ "name": {
1038
+ "name": "name",
1039
+ "type": "text",
1040
+ "primaryKey": false,
1041
+ "notNull": true
1042
+ },
1043
+ "slug": {
1044
+ "name": "slug",
1045
+ "type": "text",
1046
+ "primaryKey": false,
1047
+ "notNull": false
1048
+ },
1049
+ "logo": {
1050
+ "name": "logo",
1051
+ "type": "text",
1052
+ "primaryKey": false,
1053
+ "notNull": false
1054
+ },
1055
+ "metadata": {
1056
+ "name": "metadata",
1057
+ "type": "text",
1058
+ "primaryKey": false,
1059
+ "notNull": false
1060
+ },
1061
+ "created_at": {
1062
+ "name": "created_at",
1063
+ "type": "timestamp",
1064
+ "primaryKey": false,
1065
+ "notNull": true
1066
+ }
1067
+ },
1068
+ "indexes": {},
1069
+ "foreignKeys": {},
1070
+ "compositePrimaryKeys": {},
1071
+ "uniqueConstraints": {
1072
+ "organization_slug_unique": {
1073
+ "name": "organization_slug_unique",
1074
+ "nullsNotDistinct": false,
1075
+ "columns": ["slug"]
1076
+ }
1077
+ },
1078
+ "policies": {},
1079
+ "checkConstraints": {},
1080
+ "isRLSEnabled": false
1081
+ },
1082
+ "public.passkey": {
1083
+ "name": "passkey",
1084
+ "schema": "",
1085
+ "columns": {
1086
+ "id": {
1087
+ "name": "id",
1088
+ "type": "text",
1089
+ "primaryKey": true,
1090
+ "notNull": true
1091
+ },
1092
+ "name": {
1093
+ "name": "name",
1094
+ "type": "text",
1095
+ "primaryKey": false,
1096
+ "notNull": false
1097
+ },
1098
+ "public_key": {
1099
+ "name": "public_key",
1100
+ "type": "text",
1101
+ "primaryKey": false,
1102
+ "notNull": true
1103
+ },
1104
+ "user_id": {
1105
+ "name": "user_id",
1106
+ "type": "text",
1107
+ "primaryKey": false,
1108
+ "notNull": true
1109
+ },
1110
+ "credential_id": {
1111
+ "name": "credential_id",
1112
+ "type": "text",
1113
+ "primaryKey": false,
1114
+ "notNull": true
1115
+ },
1116
+ "counter": {
1117
+ "name": "counter",
1118
+ "type": "integer",
1119
+ "primaryKey": false,
1120
+ "notNull": true
1121
+ },
1122
+ "device_type": {
1123
+ "name": "device_type",
1124
+ "type": "text",
1125
+ "primaryKey": false,
1126
+ "notNull": true
1127
+ },
1128
+ "backed_up": {
1129
+ "name": "backed_up",
1130
+ "type": "boolean",
1131
+ "primaryKey": false,
1132
+ "notNull": true
1133
+ },
1134
+ "transports": {
1135
+ "name": "transports",
1136
+ "type": "text",
1137
+ "primaryKey": false,
1138
+ "notNull": false
1139
+ },
1140
+ "created_at": {
1141
+ "name": "created_at",
1142
+ "type": "timestamp",
1143
+ "primaryKey": false,
1144
+ "notNull": true
1145
+ },
1146
+ "aaguid": {
1147
+ "name": "aaguid",
1148
+ "type": "text",
1149
+ "primaryKey": false,
1150
+ "notNull": false
1151
+ }
1152
+ },
1153
+ "indexes": {},
1154
+ "foreignKeys": {
1155
+ "passkey_user_id_user_id_fk": {
1156
+ "name": "passkey_user_id_user_id_fk",
1157
+ "tableFrom": "passkey",
1158
+ "tableTo": "user",
1159
+ "columnsFrom": ["user_id"],
1160
+ "columnsTo": ["id"],
1161
+ "onDelete": "cascade",
1162
+ "onUpdate": "no action"
1163
+ }
1164
+ },
1165
+ "compositePrimaryKeys": {},
1166
+ "uniqueConstraints": {},
1167
+ "policies": {},
1168
+ "checkConstraints": {},
1169
+ "isRLSEnabled": false
1170
+ },
1171
+ "public.session": {
1172
+ "name": "session",
1173
+ "schema": "",
1174
+ "columns": {
1175
+ "id": {
1176
+ "name": "id",
1177
+ "type": "text",
1178
+ "primaryKey": true,
1179
+ "notNull": true
1180
+ },
1181
+ "expires_at": {
1182
+ "name": "expires_at",
1183
+ "type": "timestamp",
1184
+ "primaryKey": false,
1185
+ "notNull": true
1186
+ },
1187
+ "token": {
1188
+ "name": "token",
1189
+ "type": "text",
1190
+ "primaryKey": false,
1191
+ "notNull": true
1192
+ },
1193
+ "created_at": {
1194
+ "name": "created_at",
1195
+ "type": "timestamp",
1196
+ "primaryKey": false,
1197
+ "notNull": true
1198
+ },
1199
+ "updated_at": {
1200
+ "name": "updated_at",
1201
+ "type": "timestamp",
1202
+ "primaryKey": false,
1203
+ "notNull": true
1204
+ },
1205
+ "ip_address": {
1206
+ "name": "ip_address",
1207
+ "type": "text",
1208
+ "primaryKey": false,
1209
+ "notNull": false
1210
+ },
1211
+ "user_agent": {
1212
+ "name": "user_agent",
1213
+ "type": "text",
1214
+ "primaryKey": false,
1215
+ "notNull": false
1216
+ },
1217
+ "user_id": {
1218
+ "name": "user_id",
1219
+ "type": "text",
1220
+ "primaryKey": false,
1221
+ "notNull": true
1222
+ },
1223
+ "active_organization_id": {
1224
+ "name": "active_organization_id",
1225
+ "type": "text",
1226
+ "primaryKey": false,
1227
+ "notNull": false
1228
+ }
1229
+ },
1230
+ "indexes": {},
1231
+ "foreignKeys": {
1232
+ "session_user_id_user_id_fk": {
1233
+ "name": "session_user_id_user_id_fk",
1234
+ "tableFrom": "session",
1235
+ "tableTo": "user",
1236
+ "columnsFrom": ["user_id"],
1237
+ "columnsTo": ["id"],
1238
+ "onDelete": "cascade",
1239
+ "onUpdate": "no action"
1240
+ }
1241
+ },
1242
+ "compositePrimaryKeys": {},
1243
+ "uniqueConstraints": {
1244
+ "session_token_unique": {
1245
+ "name": "session_token_unique",
1246
+ "nullsNotDistinct": false,
1247
+ "columns": ["token"]
1248
+ }
1249
+ },
1250
+ "policies": {},
1251
+ "checkConstraints": {},
1252
+ "isRLSEnabled": false
1253
+ },
1254
+ "public.statement": {
1255
+ "name": "statement",
1256
+ "schema": "",
1257
+ "columns": {
1258
+ "id": {
1259
+ "name": "id",
1260
+ "type": "text",
1261
+ "primaryKey": true,
1262
+ "notNull": true
1263
+ },
1264
+ "user_id": {
1265
+ "name": "user_id",
1266
+ "type": "text",
1267
+ "primaryKey": false,
1268
+ "notNull": false
1269
+ },
1270
+ "organization_id": {
1271
+ "name": "organization_id",
1272
+ "type": "text",
1273
+ "primaryKey": false,
1274
+ "notNull": false
1275
+ },
1276
+ "role_id": {
1277
+ "name": "role_id",
1278
+ "type": "text",
1279
+ "primaryKey": false,
1280
+ "notNull": false
1281
+ },
1282
+ "effect": {
1283
+ "name": "effect",
1284
+ "type": "text",
1285
+ "primaryKey": false,
1286
+ "notNull": true
1287
+ },
1288
+ "action": {
1289
+ "name": "action",
1290
+ "type": "text",
1291
+ "primaryKey": false,
1292
+ "notNull": true
1293
+ },
1294
+ "resource": {
1295
+ "name": "resource",
1296
+ "type": "text",
1297
+ "primaryKey": false,
1298
+ "notNull": true
1299
+ },
1300
+ "condition": {
1301
+ "name": "condition",
1302
+ "type": "text",
1303
+ "primaryKey": false,
1304
+ "notNull": false
1305
+ },
1306
+ "expires_at": {
1307
+ "name": "expires_at",
1308
+ "type": "timestamp",
1309
+ "primaryKey": false,
1310
+ "notNull": false
1311
+ },
1312
+ "created_at": {
1313
+ "name": "created_at",
1314
+ "type": "timestamp",
1315
+ "primaryKey": false,
1316
+ "notNull": true
1317
+ },
1318
+ "updated_at": {
1319
+ "name": "updated_at",
1320
+ "type": "timestamp",
1321
+ "primaryKey": false,
1322
+ "notNull": true
1323
+ }
1324
+ },
1325
+ "indexes": {},
1326
+ "foreignKeys": {
1327
+ "statement_user_id_user_id_fk": {
1328
+ "name": "statement_user_id_user_id_fk",
1329
+ "tableFrom": "statement",
1330
+ "tableTo": "user",
1331
+ "columnsFrom": ["user_id"],
1332
+ "columnsTo": ["id"],
1333
+ "onDelete": "cascade",
1334
+ "onUpdate": "no action"
1335
+ },
1336
+ "statement_organization_id_organization_id_fk": {
1337
+ "name": "statement_organization_id_organization_id_fk",
1338
+ "tableFrom": "statement",
1339
+ "tableTo": "organization",
1340
+ "columnsFrom": ["organization_id"],
1341
+ "columnsTo": ["id"],
1342
+ "onDelete": "cascade",
1343
+ "onUpdate": "no action"
1344
+ }
1345
+ },
1346
+ "compositePrimaryKeys": {},
1347
+ "uniqueConstraints": {},
1348
+ "policies": {},
1349
+ "checkConstraints": {},
1350
+ "isRLSEnabled": false
1351
+ },
1352
+ "public.subscription": {
1353
+ "name": "subscription",
1354
+ "schema": "",
1355
+ "columns": {
1356
+ "id": {
1357
+ "name": "id",
1358
+ "type": "text",
1359
+ "primaryKey": true,
1360
+ "notNull": true
1361
+ },
1362
+ "plan": {
1363
+ "name": "plan",
1364
+ "type": "text",
1365
+ "primaryKey": false,
1366
+ "notNull": true
1367
+ },
1368
+ "reference_id": {
1369
+ "name": "reference_id",
1370
+ "type": "text",
1371
+ "primaryKey": false,
1372
+ "notNull": true
1373
+ },
1374
+ "stripe_customer_id": {
1375
+ "name": "stripe_customer_id",
1376
+ "type": "text",
1377
+ "primaryKey": false,
1378
+ "notNull": false
1379
+ },
1380
+ "stripe_subscription_id": {
1381
+ "name": "stripe_subscription_id",
1382
+ "type": "text",
1383
+ "primaryKey": false,
1384
+ "notNull": false
1385
+ },
1386
+ "status": {
1387
+ "name": "status",
1388
+ "type": "text",
1389
+ "primaryKey": false,
1390
+ "notNull": true
1391
+ },
1392
+ "period_start": {
1393
+ "name": "period_start",
1394
+ "type": "timestamp",
1395
+ "primaryKey": false,
1396
+ "notNull": false
1397
+ },
1398
+ "period_end": {
1399
+ "name": "period_end",
1400
+ "type": "timestamp",
1401
+ "primaryKey": false,
1402
+ "notNull": false
1403
+ },
1404
+ "cancel_at_period_end": {
1405
+ "name": "cancel_at_period_end",
1406
+ "type": "boolean",
1407
+ "primaryKey": false,
1408
+ "notNull": false
1409
+ },
1410
+ "seats": {
1411
+ "name": "seats",
1412
+ "type": "integer",
1413
+ "primaryKey": false,
1414
+ "notNull": false
1415
+ },
1416
+ "trial_start": {
1417
+ "name": "trial_start",
1418
+ "type": "timestamp",
1419
+ "primaryKey": false,
1420
+ "notNull": false
1421
+ },
1422
+ "trial_end": {
1423
+ "name": "trial_end",
1424
+ "type": "timestamp",
1425
+ "primaryKey": false,
1426
+ "notNull": false
1427
+ },
1428
+ "created_at": {
1429
+ "name": "created_at",
1430
+ "type": "timestamp",
1431
+ "primaryKey": false,
1432
+ "notNull": true,
1433
+ "default": "now()"
1434
+ },
1435
+ "updated_at": {
1436
+ "name": "updated_at",
1437
+ "type": "timestamp",
1438
+ "primaryKey": false,
1439
+ "notNull": true,
1440
+ "default": "now()"
1441
+ }
1442
+ },
1443
+ "indexes": {},
1444
+ "foreignKeys": {},
1445
+ "compositePrimaryKeys": {},
1446
+ "uniqueConstraints": {},
1447
+ "policies": {},
1448
+ "checkConstraints": {},
1449
+ "isRLSEnabled": false
1450
+ },
1451
+ "public.two_factor": {
1452
+ "name": "two_factor",
1453
+ "schema": "",
1454
+ "columns": {
1455
+ "id": {
1456
+ "name": "id",
1457
+ "type": "text",
1458
+ "primaryKey": true,
1459
+ "notNull": true
1460
+ },
1461
+ "secret": {
1462
+ "name": "secret",
1463
+ "type": "text",
1464
+ "primaryKey": false,
1465
+ "notNull": true
1466
+ },
1467
+ "backup_codes": {
1468
+ "name": "backup_codes",
1469
+ "type": "text",
1470
+ "primaryKey": false,
1471
+ "notNull": true
1472
+ },
1473
+ "user_id": {
1474
+ "name": "user_id",
1475
+ "type": "text",
1476
+ "primaryKey": false,
1477
+ "notNull": true
1478
+ }
1479
+ },
1480
+ "indexes": {},
1481
+ "foreignKeys": {
1482
+ "two_factor_user_id_user_id_fk": {
1483
+ "name": "two_factor_user_id_user_id_fk",
1484
+ "tableFrom": "two_factor",
1485
+ "tableTo": "user",
1486
+ "columnsFrom": ["user_id"],
1487
+ "columnsTo": ["id"],
1488
+ "onDelete": "cascade",
1489
+ "onUpdate": "no action"
1490
+ }
1491
+ },
1492
+ "compositePrimaryKeys": {},
1493
+ "uniqueConstraints": {},
1494
+ "policies": {},
1495
+ "checkConstraints": {},
1496
+ "isRLSEnabled": false
1497
+ },
1498
+ "public.user": {
1499
+ "name": "user",
1500
+ "schema": "",
1501
+ "columns": {
1502
+ "id": {
1503
+ "name": "id",
1504
+ "type": "text",
1505
+ "primaryKey": true,
1506
+ "notNull": true
1507
+ },
1508
+ "name": {
1509
+ "name": "name",
1510
+ "type": "text",
1511
+ "primaryKey": false,
1512
+ "notNull": true
1513
+ },
1514
+ "email": {
1515
+ "name": "email",
1516
+ "type": "text",
1517
+ "primaryKey": false,
1518
+ "notNull": true
1519
+ },
1520
+ "email_verified": {
1521
+ "name": "email_verified",
1522
+ "type": "boolean",
1523
+ "primaryKey": false,
1524
+ "notNull": true
1525
+ },
1526
+ "image": {
1527
+ "name": "image",
1528
+ "type": "text",
1529
+ "primaryKey": false,
1530
+ "notNull": false
1531
+ },
1532
+ "created_at": {
1533
+ "name": "created_at",
1534
+ "type": "timestamp",
1535
+ "primaryKey": false,
1536
+ "notNull": true
1537
+ },
1538
+ "updated_at": {
1539
+ "name": "updated_at",
1540
+ "type": "timestamp",
1541
+ "primaryKey": false,
1542
+ "notNull": true
1543
+ },
1544
+ "two_factor_enabled": {
1545
+ "name": "two_factor_enabled",
1546
+ "type": "boolean",
1547
+ "primaryKey": false,
1548
+ "notNull": false
1549
+ },
1550
+ "last_login_method": {
1551
+ "name": "last_login_method",
1552
+ "type": "text",
1553
+ "primaryKey": false,
1554
+ "notNull": false
1555
+ },
1556
+ "stripe_customer_id": {
1557
+ "name": "stripe_customer_id",
1558
+ "type": "text",
1559
+ "primaryKey": false,
1560
+ "notNull": false
1561
+ }
1562
+ },
1563
+ "indexes": {},
1564
+ "foreignKeys": {},
1565
+ "compositePrimaryKeys": {},
1566
+ "uniqueConstraints": {
1567
+ "user_email_unique": {
1568
+ "name": "user_email_unique",
1569
+ "nullsNotDistinct": false,
1570
+ "columns": ["email"]
1571
+ }
1572
+ },
1573
+ "policies": {},
1574
+ "checkConstraints": {},
1575
+ "isRLSEnabled": false
1576
+ },
1577
+ "public.verification": {
1578
+ "name": "verification",
1579
+ "schema": "",
1580
+ "columns": {
1581
+ "id": {
1582
+ "name": "id",
1583
+ "type": "text",
1584
+ "primaryKey": true,
1585
+ "notNull": true
1586
+ },
1587
+ "identifier": {
1588
+ "name": "identifier",
1589
+ "type": "text",
1590
+ "primaryKey": false,
1591
+ "notNull": true
1592
+ },
1593
+ "value": {
1594
+ "name": "value",
1595
+ "type": "text",
1596
+ "primaryKey": false,
1597
+ "notNull": true
1598
+ },
1599
+ "expires_at": {
1600
+ "name": "expires_at",
1601
+ "type": "timestamp",
1602
+ "primaryKey": false,
1603
+ "notNull": true
1604
+ },
1605
+ "created_at": {
1606
+ "name": "created_at",
1607
+ "type": "timestamp",
1608
+ "primaryKey": false,
1609
+ "notNull": false
1610
+ },
1611
+ "updated_at": {
1612
+ "name": "updated_at",
1613
+ "type": "timestamp",
1614
+ "primaryKey": false,
1615
+ "notNull": false
1616
+ }
1617
+ },
1618
+ "indexes": {},
1619
+ "foreignKeys": {},
1620
+ "compositePrimaryKeys": {},
1621
+ "uniqueConstraints": {},
1622
+ "policies": {},
1623
+ "checkConstraints": {},
1624
+ "isRLSEnabled": false
1625
+ },
1626
+ "public.contact": {
1627
+ "name": "contact",
1628
+ "schema": "",
1629
+ "columns": {
1630
+ "id": {
1631
+ "name": "id",
1632
+ "type": "text",
1633
+ "primaryKey": true,
1634
+ "notNull": true
1635
+ },
1636
+ "organization_id": {
1637
+ "name": "organization_id",
1638
+ "type": "text",
1639
+ "primaryKey": false,
1640
+ "notNull": true
1641
+ },
1642
+ "email": {
1643
+ "name": "email",
1644
+ "type": "text",
1645
+ "primaryKey": false,
1646
+ "notNull": true
1647
+ },
1648
+ "email_hash": {
1649
+ "name": "email_hash",
1650
+ "type": "text",
1651
+ "primaryKey": false,
1652
+ "notNull": true
1653
+ },
1654
+ "status": {
1655
+ "name": "status",
1656
+ "type": "text",
1657
+ "primaryKey": false,
1658
+ "notNull": true,
1659
+ "default": "'active'"
1660
+ },
1661
+ "properties": {
1662
+ "name": "properties",
1663
+ "type": "json",
1664
+ "primaryKey": false,
1665
+ "notNull": true,
1666
+ "default": "'{}'::json"
1667
+ },
1668
+ "last_activity_at": {
1669
+ "name": "last_activity_at",
1670
+ "type": "timestamp",
1671
+ "primaryKey": false,
1672
+ "notNull": false
1673
+ },
1674
+ "last_email_sent_at": {
1675
+ "name": "last_email_sent_at",
1676
+ "type": "timestamp",
1677
+ "primaryKey": false,
1678
+ "notNull": false
1679
+ },
1680
+ "last_email_opened_at": {
1681
+ "name": "last_email_opened_at",
1682
+ "type": "timestamp",
1683
+ "primaryKey": false,
1684
+ "notNull": false
1685
+ },
1686
+ "last_email_clicked_at": {
1687
+ "name": "last_email_clicked_at",
1688
+ "type": "timestamp",
1689
+ "primaryKey": false,
1690
+ "notNull": false
1691
+ },
1692
+ "emails_sent": {
1693
+ "name": "emails_sent",
1694
+ "type": "integer",
1695
+ "primaryKey": false,
1696
+ "notNull": true,
1697
+ "default": 0
1698
+ },
1699
+ "emails_opened": {
1700
+ "name": "emails_opened",
1701
+ "type": "integer",
1702
+ "primaryKey": false,
1703
+ "notNull": true,
1704
+ "default": 0
1705
+ },
1706
+ "emails_clicked": {
1707
+ "name": "emails_clicked",
1708
+ "type": "integer",
1709
+ "primaryKey": false,
1710
+ "notNull": true,
1711
+ "default": 0
1712
+ },
1713
+ "created_at": {
1714
+ "name": "created_at",
1715
+ "type": "timestamp",
1716
+ "primaryKey": false,
1717
+ "notNull": true,
1718
+ "default": "now()"
1719
+ },
1720
+ "updated_at": {
1721
+ "name": "updated_at",
1722
+ "type": "timestamp",
1723
+ "primaryKey": false,
1724
+ "notNull": true,
1725
+ "default": "now()"
1726
+ },
1727
+ "confirmed_at": {
1728
+ "name": "confirmed_at",
1729
+ "type": "timestamp",
1730
+ "primaryKey": false,
1731
+ "notNull": false
1732
+ },
1733
+ "unsubscribed_at": {
1734
+ "name": "unsubscribed_at",
1735
+ "type": "timestamp",
1736
+ "primaryKey": false,
1737
+ "notNull": false
1738
+ },
1739
+ "bounced_at": {
1740
+ "name": "bounced_at",
1741
+ "type": "timestamp",
1742
+ "primaryKey": false,
1743
+ "notNull": false
1744
+ },
1745
+ "complained_at": {
1746
+ "name": "complained_at",
1747
+ "type": "timestamp",
1748
+ "primaryKey": false,
1749
+ "notNull": false
1750
+ },
1751
+ "created_by": {
1752
+ "name": "created_by",
1753
+ "type": "text",
1754
+ "primaryKey": false,
1755
+ "notNull": false
1756
+ }
1757
+ },
1758
+ "indexes": {
1759
+ "contact_org_idx": {
1760
+ "name": "contact_org_idx",
1761
+ "columns": [
1762
+ {
1763
+ "expression": "organization_id",
1764
+ "isExpression": false,
1765
+ "asc": true,
1766
+ "nulls": "last"
1767
+ }
1768
+ ],
1769
+ "isUnique": false,
1770
+ "concurrently": false,
1771
+ "method": "btree",
1772
+ "with": {}
1773
+ },
1774
+ "contact_email_idx": {
1775
+ "name": "contact_email_idx",
1776
+ "columns": [
1777
+ {
1778
+ "expression": "email",
1779
+ "isExpression": false,
1780
+ "asc": true,
1781
+ "nulls": "last"
1782
+ }
1783
+ ],
1784
+ "isUnique": false,
1785
+ "concurrently": false,
1786
+ "method": "btree",
1787
+ "with": {}
1788
+ },
1789
+ "contact_unique_org_email_idx": {
1790
+ "name": "contact_unique_org_email_idx",
1791
+ "columns": [
1792
+ {
1793
+ "expression": "organization_id",
1794
+ "isExpression": false,
1795
+ "asc": true,
1796
+ "nulls": "last"
1797
+ },
1798
+ {
1799
+ "expression": "email_hash",
1800
+ "isExpression": false,
1801
+ "asc": true,
1802
+ "nulls": "last"
1803
+ }
1804
+ ],
1805
+ "isUnique": true,
1806
+ "concurrently": false,
1807
+ "method": "btree",
1808
+ "with": {}
1809
+ },
1810
+ "contact_status_idx": {
1811
+ "name": "contact_status_idx",
1812
+ "columns": [
1813
+ {
1814
+ "expression": "organization_id",
1815
+ "isExpression": false,
1816
+ "asc": true,
1817
+ "nulls": "last"
1818
+ },
1819
+ {
1820
+ "expression": "status",
1821
+ "isExpression": false,
1822
+ "asc": true,
1823
+ "nulls": "last"
1824
+ }
1825
+ ],
1826
+ "isUnique": false,
1827
+ "concurrently": false,
1828
+ "method": "btree",
1829
+ "with": {}
1830
+ }
1831
+ },
1832
+ "foreignKeys": {
1833
+ "contact_organization_id_organization_id_fk": {
1834
+ "name": "contact_organization_id_organization_id_fk",
1835
+ "tableFrom": "contact",
1836
+ "tableTo": "organization",
1837
+ "columnsFrom": ["organization_id"],
1838
+ "columnsTo": ["id"],
1839
+ "onDelete": "cascade",
1840
+ "onUpdate": "no action"
1841
+ },
1842
+ "contact_created_by_user_id_fk": {
1843
+ "name": "contact_created_by_user_id_fk",
1844
+ "tableFrom": "contact",
1845
+ "tableTo": "user",
1846
+ "columnsFrom": ["created_by"],
1847
+ "columnsTo": ["id"],
1848
+ "onDelete": "no action",
1849
+ "onUpdate": "no action"
1850
+ }
1851
+ },
1852
+ "compositePrimaryKeys": {},
1853
+ "uniqueConstraints": {},
1854
+ "policies": {},
1855
+ "checkConstraints": {},
1856
+ "isRLSEnabled": false
1857
+ },
1858
+ "public.contact_topic": {
1859
+ "name": "contact_topic",
1860
+ "schema": "",
1861
+ "columns": {
1862
+ "contact_id": {
1863
+ "name": "contact_id",
1864
+ "type": "text",
1865
+ "primaryKey": false,
1866
+ "notNull": true
1867
+ },
1868
+ "topic_id": {
1869
+ "name": "topic_id",
1870
+ "type": "text",
1871
+ "primaryKey": false,
1872
+ "notNull": true
1873
+ },
1874
+ "status": {
1875
+ "name": "status",
1876
+ "type": "text",
1877
+ "primaryKey": false,
1878
+ "notNull": true,
1879
+ "default": "'subscribed'"
1880
+ },
1881
+ "subscribed_at": {
1882
+ "name": "subscribed_at",
1883
+ "type": "timestamp",
1884
+ "primaryKey": false,
1885
+ "notNull": false,
1886
+ "default": "now()"
1887
+ },
1888
+ "unsubscribed_at": {
1889
+ "name": "unsubscribed_at",
1890
+ "type": "timestamp",
1891
+ "primaryKey": false,
1892
+ "notNull": false
1893
+ }
1894
+ },
1895
+ "indexes": {
1896
+ "contact_topic_topic_idx": {
1897
+ "name": "contact_topic_topic_idx",
1898
+ "columns": [
1899
+ {
1900
+ "expression": "topic_id",
1901
+ "isExpression": false,
1902
+ "asc": true,
1903
+ "nulls": "last"
1904
+ }
1905
+ ],
1906
+ "isUnique": false,
1907
+ "concurrently": false,
1908
+ "method": "btree",
1909
+ "with": {}
1910
+ },
1911
+ "contact_topic_status_idx": {
1912
+ "name": "contact_topic_status_idx",
1913
+ "columns": [
1914
+ {
1915
+ "expression": "topic_id",
1916
+ "isExpression": false,
1917
+ "asc": true,
1918
+ "nulls": "last"
1919
+ },
1920
+ {
1921
+ "expression": "status",
1922
+ "isExpression": false,
1923
+ "asc": true,
1924
+ "nulls": "last"
1925
+ }
1926
+ ],
1927
+ "isUnique": false,
1928
+ "concurrently": false,
1929
+ "method": "btree",
1930
+ "with": {}
1931
+ }
1932
+ },
1933
+ "foreignKeys": {
1934
+ "contact_topic_contact_id_contact_id_fk": {
1935
+ "name": "contact_topic_contact_id_contact_id_fk",
1936
+ "tableFrom": "contact_topic",
1937
+ "tableTo": "contact",
1938
+ "columnsFrom": ["contact_id"],
1939
+ "columnsTo": ["id"],
1940
+ "onDelete": "cascade",
1941
+ "onUpdate": "no action"
1942
+ },
1943
+ "contact_topic_topic_id_topic_id_fk": {
1944
+ "name": "contact_topic_topic_id_topic_id_fk",
1945
+ "tableFrom": "contact_topic",
1946
+ "tableTo": "topic",
1947
+ "columnsFrom": ["topic_id"],
1948
+ "columnsTo": ["id"],
1949
+ "onDelete": "cascade",
1950
+ "onUpdate": "no action"
1951
+ }
1952
+ },
1953
+ "compositePrimaryKeys": {
1954
+ "contact_topic_contact_id_topic_id_pk": {
1955
+ "name": "contact_topic_contact_id_topic_id_pk",
1956
+ "columns": ["contact_id", "topic_id"]
1957
+ }
1958
+ },
1959
+ "uniqueConstraints": {},
1960
+ "policies": {},
1961
+ "checkConstraints": {},
1962
+ "isRLSEnabled": false
1963
+ },
1964
+ "public.topic": {
1965
+ "name": "topic",
1966
+ "schema": "",
1967
+ "columns": {
1968
+ "id": {
1969
+ "name": "id",
1970
+ "type": "text",
1971
+ "primaryKey": true,
1972
+ "notNull": true
1973
+ },
1974
+ "organization_id": {
1975
+ "name": "organization_id",
1976
+ "type": "text",
1977
+ "primaryKey": false,
1978
+ "notNull": true
1979
+ },
1980
+ "name": {
1981
+ "name": "name",
1982
+ "type": "text",
1983
+ "primaryKey": false,
1984
+ "notNull": true
1985
+ },
1986
+ "slug": {
1987
+ "name": "slug",
1988
+ "type": "text",
1989
+ "primaryKey": false,
1990
+ "notNull": true
1991
+ },
1992
+ "description": {
1993
+ "name": "description",
1994
+ "type": "text",
1995
+ "primaryKey": false,
1996
+ "notNull": false
1997
+ },
1998
+ "public": {
1999
+ "name": "public",
2000
+ "type": "boolean",
2001
+ "primaryKey": false,
2002
+ "notNull": true,
2003
+ "default": true
2004
+ },
2005
+ "double_opt_in": {
2006
+ "name": "double_opt_in",
2007
+ "type": "boolean",
2008
+ "primaryKey": false,
2009
+ "notNull": true,
2010
+ "default": false
2011
+ },
2012
+ "subscriber_count": {
2013
+ "name": "subscriber_count",
2014
+ "type": "integer",
2015
+ "primaryKey": false,
2016
+ "notNull": true,
2017
+ "default": 0
2018
+ },
2019
+ "created_at": {
2020
+ "name": "created_at",
2021
+ "type": "timestamp",
2022
+ "primaryKey": false,
2023
+ "notNull": true,
2024
+ "default": "now()"
2025
+ },
2026
+ "updated_at": {
2027
+ "name": "updated_at",
2028
+ "type": "timestamp",
2029
+ "primaryKey": false,
2030
+ "notNull": true,
2031
+ "default": "now()"
2032
+ },
2033
+ "created_by": {
2034
+ "name": "created_by",
2035
+ "type": "text",
2036
+ "primaryKey": false,
2037
+ "notNull": false
2038
+ }
2039
+ },
2040
+ "indexes": {
2041
+ "topic_org_idx": {
2042
+ "name": "topic_org_idx",
2043
+ "columns": [
2044
+ {
2045
+ "expression": "organization_id",
2046
+ "isExpression": false,
2047
+ "asc": true,
2048
+ "nulls": "last"
2049
+ }
2050
+ ],
2051
+ "isUnique": false,
2052
+ "concurrently": false,
2053
+ "method": "btree",
2054
+ "with": {}
2055
+ },
2056
+ "topic_unique_org_slug_idx": {
2057
+ "name": "topic_unique_org_slug_idx",
2058
+ "columns": [
2059
+ {
2060
+ "expression": "organization_id",
2061
+ "isExpression": false,
2062
+ "asc": true,
2063
+ "nulls": "last"
2064
+ },
2065
+ {
2066
+ "expression": "slug",
2067
+ "isExpression": false,
2068
+ "asc": true,
2069
+ "nulls": "last"
2070
+ }
2071
+ ],
2072
+ "isUnique": true,
2073
+ "concurrently": false,
2074
+ "method": "btree",
2075
+ "with": {}
2076
+ }
2077
+ },
2078
+ "foreignKeys": {
2079
+ "topic_organization_id_organization_id_fk": {
2080
+ "name": "topic_organization_id_organization_id_fk",
2081
+ "tableFrom": "topic",
2082
+ "tableTo": "organization",
2083
+ "columnsFrom": ["organization_id"],
2084
+ "columnsTo": ["id"],
2085
+ "onDelete": "cascade",
2086
+ "onUpdate": "no action"
2087
+ },
2088
+ "topic_created_by_user_id_fk": {
2089
+ "name": "topic_created_by_user_id_fk",
2090
+ "tableFrom": "topic",
2091
+ "tableTo": "user",
2092
+ "columnsFrom": ["created_by"],
2093
+ "columnsTo": ["id"],
2094
+ "onDelete": "no action",
2095
+ "onUpdate": "no action"
2096
+ }
2097
+ },
2098
+ "compositePrimaryKeys": {},
2099
+ "uniqueConstraints": {},
2100
+ "policies": {},
2101
+ "checkConstraints": {},
2102
+ "isRLSEnabled": false
2103
+ },
2104
+ "public.segment": {
2105
+ "name": "segment",
2106
+ "schema": "",
2107
+ "columns": {
2108
+ "id": {
2109
+ "name": "id",
2110
+ "type": "text",
2111
+ "primaryKey": true,
2112
+ "notNull": true
2113
+ },
2114
+ "organization_id": {
2115
+ "name": "organization_id",
2116
+ "type": "text",
2117
+ "primaryKey": false,
2118
+ "notNull": true
2119
+ },
2120
+ "name": {
2121
+ "name": "name",
2122
+ "type": "text",
2123
+ "primaryKey": false,
2124
+ "notNull": true
2125
+ },
2126
+ "description": {
2127
+ "name": "description",
2128
+ "type": "text",
2129
+ "primaryKey": false,
2130
+ "notNull": false
2131
+ },
2132
+ "condition": {
2133
+ "name": "condition",
2134
+ "type": "json",
2135
+ "primaryKey": false,
2136
+ "notNull": true
2137
+ },
2138
+ "track_membership": {
2139
+ "name": "track_membership",
2140
+ "type": "boolean",
2141
+ "primaryKey": false,
2142
+ "notNull": true,
2143
+ "default": false
2144
+ },
2145
+ "member_count": {
2146
+ "name": "member_count",
2147
+ "type": "integer",
2148
+ "primaryKey": false,
2149
+ "notNull": true,
2150
+ "default": 0
2151
+ },
2152
+ "last_computed_at": {
2153
+ "name": "last_computed_at",
2154
+ "type": "timestamp",
2155
+ "primaryKey": false,
2156
+ "notNull": false
2157
+ },
2158
+ "created_by": {
2159
+ "name": "created_by",
2160
+ "type": "text",
2161
+ "primaryKey": false,
2162
+ "notNull": false
2163
+ },
2164
+ "created_at": {
2165
+ "name": "created_at",
2166
+ "type": "timestamp",
2167
+ "primaryKey": false,
2168
+ "notNull": true,
2169
+ "default": "now()"
2170
+ },
2171
+ "updated_at": {
2172
+ "name": "updated_at",
2173
+ "type": "timestamp",
2174
+ "primaryKey": false,
2175
+ "notNull": true,
2176
+ "default": "now()"
2177
+ }
2178
+ },
2179
+ "indexes": {
2180
+ "segment_org_idx": {
2181
+ "name": "segment_org_idx",
2182
+ "columns": [
2183
+ {
2184
+ "expression": "organization_id",
2185
+ "isExpression": false,
2186
+ "asc": true,
2187
+ "nulls": "last"
2188
+ }
2189
+ ],
2190
+ "isUnique": false,
2191
+ "concurrently": false,
2192
+ "method": "btree",
2193
+ "with": {}
2194
+ },
2195
+ "segment_name_idx": {
2196
+ "name": "segment_name_idx",
2197
+ "columns": [
2198
+ {
2199
+ "expression": "organization_id",
2200
+ "isExpression": false,
2201
+ "asc": true,
2202
+ "nulls": "last"
2203
+ },
2204
+ {
2205
+ "expression": "name",
2206
+ "isExpression": false,
2207
+ "asc": true,
2208
+ "nulls": "last"
2209
+ }
2210
+ ],
2211
+ "isUnique": false,
2212
+ "concurrently": false,
2213
+ "method": "btree",
2214
+ "with": {}
2215
+ }
2216
+ },
2217
+ "foreignKeys": {
2218
+ "segment_organization_id_organization_id_fk": {
2219
+ "name": "segment_organization_id_organization_id_fk",
2220
+ "tableFrom": "segment",
2221
+ "tableTo": "organization",
2222
+ "columnsFrom": ["organization_id"],
2223
+ "columnsTo": ["id"],
2224
+ "onDelete": "cascade",
2225
+ "onUpdate": "no action"
2226
+ },
2227
+ "segment_created_by_user_id_fk": {
2228
+ "name": "segment_created_by_user_id_fk",
2229
+ "tableFrom": "segment",
2230
+ "tableTo": "user",
2231
+ "columnsFrom": ["created_by"],
2232
+ "columnsTo": ["id"],
2233
+ "onDelete": "no action",
2234
+ "onUpdate": "no action"
2235
+ }
2236
+ },
2237
+ "compositePrimaryKeys": {},
2238
+ "uniqueConstraints": {},
2239
+ "policies": {},
2240
+ "checkConstraints": {},
2241
+ "isRLSEnabled": false
2242
+ },
2243
+ "public.ai_conversation": {
2244
+ "name": "ai_conversation",
2245
+ "schema": "",
2246
+ "columns": {
2247
+ "id": {
2248
+ "name": "id",
2249
+ "type": "text",
2250
+ "primaryKey": true,
2251
+ "notNull": true
2252
+ },
2253
+ "organization_id": {
2254
+ "name": "organization_id",
2255
+ "type": "text",
2256
+ "primaryKey": false,
2257
+ "notNull": true
2258
+ },
2259
+ "template_id": {
2260
+ "name": "template_id",
2261
+ "type": "text",
2262
+ "primaryKey": false,
2263
+ "notNull": false
2264
+ },
2265
+ "messages": {
2266
+ "name": "messages",
2267
+ "type": "jsonb",
2268
+ "primaryKey": false,
2269
+ "notNull": false,
2270
+ "default": "'[]'::jsonb"
2271
+ },
2272
+ "total_tokens": {
2273
+ "name": "total_tokens",
2274
+ "type": "integer",
2275
+ "primaryKey": false,
2276
+ "notNull": true,
2277
+ "default": 0
2278
+ },
2279
+ "created_at": {
2280
+ "name": "created_at",
2281
+ "type": "timestamp",
2282
+ "primaryKey": false,
2283
+ "notNull": true,
2284
+ "default": "now()"
2285
+ },
2286
+ "updated_at": {
2287
+ "name": "updated_at",
2288
+ "type": "timestamp",
2289
+ "primaryKey": false,
2290
+ "notNull": true,
2291
+ "default": "now()"
2292
+ },
2293
+ "created_by": {
2294
+ "name": "created_by",
2295
+ "type": "text",
2296
+ "primaryKey": false,
2297
+ "notNull": true
2298
+ }
2299
+ },
2300
+ "indexes": {
2301
+ "ai_conversation_org_idx": {
2302
+ "name": "ai_conversation_org_idx",
2303
+ "columns": [
2304
+ {
2305
+ "expression": "organization_id",
2306
+ "isExpression": false,
2307
+ "asc": true,
2308
+ "nulls": "last"
2309
+ }
2310
+ ],
2311
+ "isUnique": false,
2312
+ "concurrently": false,
2313
+ "method": "btree",
2314
+ "with": {}
2315
+ },
2316
+ "ai_conversation_template_idx": {
2317
+ "name": "ai_conversation_template_idx",
2318
+ "columns": [
2319
+ {
2320
+ "expression": "template_id",
2321
+ "isExpression": false,
2322
+ "asc": true,
2323
+ "nulls": "last"
2324
+ }
2325
+ ],
2326
+ "isUnique": false,
2327
+ "concurrently": false,
2328
+ "method": "btree",
2329
+ "with": {}
2330
+ }
2331
+ },
2332
+ "foreignKeys": {
2333
+ "ai_conversation_organization_id_organization_id_fk": {
2334
+ "name": "ai_conversation_organization_id_organization_id_fk",
2335
+ "tableFrom": "ai_conversation",
2336
+ "tableTo": "organization",
2337
+ "columnsFrom": ["organization_id"],
2338
+ "columnsTo": ["id"],
2339
+ "onDelete": "cascade",
2340
+ "onUpdate": "no action"
2341
+ },
2342
+ "ai_conversation_template_id_template_id_fk": {
2343
+ "name": "ai_conversation_template_id_template_id_fk",
2344
+ "tableFrom": "ai_conversation",
2345
+ "tableTo": "template",
2346
+ "columnsFrom": ["template_id"],
2347
+ "columnsTo": ["id"],
2348
+ "onDelete": "cascade",
2349
+ "onUpdate": "no action"
2350
+ },
2351
+ "ai_conversation_created_by_user_id_fk": {
2352
+ "name": "ai_conversation_created_by_user_id_fk",
2353
+ "tableFrom": "ai_conversation",
2354
+ "tableTo": "user",
2355
+ "columnsFrom": ["created_by"],
2356
+ "columnsTo": ["id"],
2357
+ "onDelete": "set null",
2358
+ "onUpdate": "no action"
2359
+ }
2360
+ },
2361
+ "compositePrimaryKeys": {},
2362
+ "uniqueConstraints": {},
2363
+ "policies": {},
2364
+ "checkConstraints": {},
2365
+ "isRLSEnabled": false
2366
+ },
2367
+ "public.brand_kit": {
2368
+ "name": "brand_kit",
2369
+ "schema": "",
2370
+ "columns": {
2371
+ "id": {
2372
+ "name": "id",
2373
+ "type": "text",
2374
+ "primaryKey": true,
2375
+ "notNull": true
2376
+ },
2377
+ "organization_id": {
2378
+ "name": "organization_id",
2379
+ "type": "text",
2380
+ "primaryKey": false,
2381
+ "notNull": true
2382
+ },
2383
+ "name": {
2384
+ "name": "name",
2385
+ "type": "text",
2386
+ "primaryKey": false,
2387
+ "notNull": true,
2388
+ "default": "'Default'"
2389
+ },
2390
+ "logo_url": {
2391
+ "name": "logo_url",
2392
+ "type": "text",
2393
+ "primaryKey": false,
2394
+ "notNull": false
2395
+ },
2396
+ "primary_color": {
2397
+ "name": "primary_color",
2398
+ "type": "text",
2399
+ "primaryKey": false,
2400
+ "notNull": true,
2401
+ "default": "'#5046e5'"
2402
+ },
2403
+ "secondary_color": {
2404
+ "name": "secondary_color",
2405
+ "type": "text",
2406
+ "primaryKey": false,
2407
+ "notNull": true,
2408
+ "default": "'#6366f1'"
2409
+ },
2410
+ "background_color": {
2411
+ "name": "background_color",
2412
+ "type": "text",
2413
+ "primaryKey": false,
2414
+ "notNull": true,
2415
+ "default": "'#ffffff'"
2416
+ },
2417
+ "text_color": {
2418
+ "name": "text_color",
2419
+ "type": "text",
2420
+ "primaryKey": false,
2421
+ "notNull": true,
2422
+ "default": "'#1f2937'"
2423
+ },
2424
+ "font_family": {
2425
+ "name": "font_family",
2426
+ "type": "text",
2427
+ "primaryKey": false,
2428
+ "notNull": true,
2429
+ "default": "'system-ui, sans-serif'"
2430
+ },
2431
+ "heading_font_family": {
2432
+ "name": "heading_font_family",
2433
+ "type": "text",
2434
+ "primaryKey": false,
2435
+ "notNull": false
2436
+ },
2437
+ "button_style": {
2438
+ "name": "button_style",
2439
+ "type": "text",
2440
+ "primaryKey": false,
2441
+ "notNull": true,
2442
+ "default": "'rounded'"
2443
+ },
2444
+ "button_radius": {
2445
+ "name": "button_radius",
2446
+ "type": "text",
2447
+ "primaryKey": false,
2448
+ "notNull": true,
2449
+ "default": "'4px'"
2450
+ },
2451
+ "company_name": {
2452
+ "name": "company_name",
2453
+ "type": "text",
2454
+ "primaryKey": false,
2455
+ "notNull": false
2456
+ },
2457
+ "company_address": {
2458
+ "name": "company_address",
2459
+ "type": "text",
2460
+ "primaryKey": false,
2461
+ "notNull": false
2462
+ },
2463
+ "social_links": {
2464
+ "name": "social_links",
2465
+ "type": "jsonb",
2466
+ "primaryKey": false,
2467
+ "notNull": false,
2468
+ "default": "'[]'::jsonb"
2469
+ },
2470
+ "source_domain": {
2471
+ "name": "source_domain",
2472
+ "type": "text",
2473
+ "primaryKey": false,
2474
+ "notNull": false
2475
+ },
2476
+ "auto_extracted": {
2477
+ "name": "auto_extracted",
2478
+ "type": "boolean",
2479
+ "primaryKey": false,
2480
+ "notNull": true,
2481
+ "default": false
2482
+ },
2483
+ "is_default": {
2484
+ "name": "is_default",
2485
+ "type": "boolean",
2486
+ "primaryKey": false,
2487
+ "notNull": true,
2488
+ "default": false
2489
+ },
2490
+ "created_at": {
2491
+ "name": "created_at",
2492
+ "type": "timestamp",
2493
+ "primaryKey": false,
2494
+ "notNull": true,
2495
+ "default": "now()"
2496
+ },
2497
+ "updated_at": {
2498
+ "name": "updated_at",
2499
+ "type": "timestamp",
2500
+ "primaryKey": false,
2501
+ "notNull": true,
2502
+ "default": "now()"
2503
+ }
2504
+ },
2505
+ "indexes": {
2506
+ "brand_kit_org_idx": {
2507
+ "name": "brand_kit_org_idx",
2508
+ "columns": [
2509
+ {
2510
+ "expression": "organization_id",
2511
+ "isExpression": false,
2512
+ "asc": true,
2513
+ "nulls": "last"
2514
+ }
2515
+ ],
2516
+ "isUnique": false,
2517
+ "concurrently": false,
2518
+ "method": "btree",
2519
+ "with": {}
2520
+ },
2521
+ "brand_kit_default_idx": {
2522
+ "name": "brand_kit_default_idx",
2523
+ "columns": [
2524
+ {
2525
+ "expression": "organization_id",
2526
+ "isExpression": false,
2527
+ "asc": true,
2528
+ "nulls": "last"
2529
+ },
2530
+ {
2531
+ "expression": "is_default",
2532
+ "isExpression": false,
2533
+ "asc": true,
2534
+ "nulls": "last"
2535
+ }
2536
+ ],
2537
+ "isUnique": false,
2538
+ "concurrently": false,
2539
+ "method": "btree",
2540
+ "with": {}
2541
+ }
2542
+ },
2543
+ "foreignKeys": {
2544
+ "brand_kit_organization_id_organization_id_fk": {
2545
+ "name": "brand_kit_organization_id_organization_id_fk",
2546
+ "tableFrom": "brand_kit",
2547
+ "tableTo": "organization",
2548
+ "columnsFrom": ["organization_id"],
2549
+ "columnsTo": ["id"],
2550
+ "onDelete": "cascade",
2551
+ "onUpdate": "no action"
2552
+ }
2553
+ },
2554
+ "compositePrimaryKeys": {},
2555
+ "uniqueConstraints": {},
2556
+ "policies": {},
2557
+ "checkConstraints": {},
2558
+ "isRLSEnabled": false
2559
+ },
2560
+ "public.reusable_block": {
2561
+ "name": "reusable_block",
2562
+ "schema": "",
2563
+ "columns": {
2564
+ "id": {
2565
+ "name": "id",
2566
+ "type": "text",
2567
+ "primaryKey": true,
2568
+ "notNull": true
2569
+ },
2570
+ "organization_id": {
2571
+ "name": "organization_id",
2572
+ "type": "text",
2573
+ "primaryKey": false,
2574
+ "notNull": true
2575
+ },
2576
+ "name": {
2577
+ "name": "name",
2578
+ "type": "text",
2579
+ "primaryKey": false,
2580
+ "notNull": true
2581
+ },
2582
+ "description": {
2583
+ "name": "description",
2584
+ "type": "text",
2585
+ "primaryKey": false,
2586
+ "notNull": false
2587
+ },
2588
+ "category": {
2589
+ "name": "category",
2590
+ "type": "text",
2591
+ "primaryKey": false,
2592
+ "notNull": true,
2593
+ "default": "'custom'"
2594
+ },
2595
+ "content": {
2596
+ "name": "content",
2597
+ "type": "jsonb",
2598
+ "primaryKey": false,
2599
+ "notNull": true
2600
+ },
2601
+ "thumbnail": {
2602
+ "name": "thumbnail",
2603
+ "type": "text",
2604
+ "primaryKey": false,
2605
+ "notNull": false
2606
+ },
2607
+ "is_public": {
2608
+ "name": "is_public",
2609
+ "type": "boolean",
2610
+ "primaryKey": false,
2611
+ "notNull": true,
2612
+ "default": false
2613
+ },
2614
+ "usage_count": {
2615
+ "name": "usage_count",
2616
+ "type": "integer",
2617
+ "primaryKey": false,
2618
+ "notNull": true,
2619
+ "default": 0
2620
+ },
2621
+ "created_at": {
2622
+ "name": "created_at",
2623
+ "type": "timestamp",
2624
+ "primaryKey": false,
2625
+ "notNull": true,
2626
+ "default": "now()"
2627
+ },
2628
+ "updated_at": {
2629
+ "name": "updated_at",
2630
+ "type": "timestamp",
2631
+ "primaryKey": false,
2632
+ "notNull": true,
2633
+ "default": "now()"
2634
+ },
2635
+ "created_by": {
2636
+ "name": "created_by",
2637
+ "type": "text",
2638
+ "primaryKey": false,
2639
+ "notNull": true
2640
+ }
2641
+ },
2642
+ "indexes": {
2643
+ "reusable_block_org_idx": {
2644
+ "name": "reusable_block_org_idx",
2645
+ "columns": [
2646
+ {
2647
+ "expression": "organization_id",
2648
+ "isExpression": false,
2649
+ "asc": true,
2650
+ "nulls": "last"
2651
+ }
2652
+ ],
2653
+ "isUnique": false,
2654
+ "concurrently": false,
2655
+ "method": "btree",
2656
+ "with": {}
2657
+ },
2658
+ "reusable_block_created_by_category_idx": {
2659
+ "name": "reusable_block_created_by_category_idx",
2660
+ "columns": [
2661
+ {
2662
+ "expression": "created_by",
2663
+ "isExpression": false,
2664
+ "asc": true,
2665
+ "nulls": "last"
2666
+ },
2667
+ {
2668
+ "expression": "category",
2669
+ "isExpression": false,
2670
+ "asc": true,
2671
+ "nulls": "last"
2672
+ }
2673
+ ],
2674
+ "isUnique": false,
2675
+ "concurrently": false,
2676
+ "method": "btree",
2677
+ "with": {}
2678
+ },
2679
+ "reusable_block_public_category_idx": {
2680
+ "name": "reusable_block_public_category_idx",
2681
+ "columns": [
2682
+ {
2683
+ "expression": "is_public",
2684
+ "isExpression": false,
2685
+ "asc": true,
2686
+ "nulls": "last"
2687
+ },
2688
+ {
2689
+ "expression": "category",
2690
+ "isExpression": false,
2691
+ "asc": true,
2692
+ "nulls": "last"
2693
+ }
2694
+ ],
2695
+ "isUnique": false,
2696
+ "concurrently": false,
2697
+ "method": "btree",
2698
+ "with": {}
2699
+ }
2700
+ },
2701
+ "foreignKeys": {
2702
+ "reusable_block_organization_id_organization_id_fk": {
2703
+ "name": "reusable_block_organization_id_organization_id_fk",
2704
+ "tableFrom": "reusable_block",
2705
+ "tableTo": "organization",
2706
+ "columnsFrom": ["organization_id"],
2707
+ "columnsTo": ["id"],
2708
+ "onDelete": "cascade",
2709
+ "onUpdate": "no action"
2710
+ },
2711
+ "reusable_block_created_by_user_id_fk": {
2712
+ "name": "reusable_block_created_by_user_id_fk",
2713
+ "tableFrom": "reusable_block",
2714
+ "tableTo": "user",
2715
+ "columnsFrom": ["created_by"],
2716
+ "columnsTo": ["id"],
2717
+ "onDelete": "set null",
2718
+ "onUpdate": "no action"
2719
+ }
2720
+ },
2721
+ "compositePrimaryKeys": {},
2722
+ "uniqueConstraints": {},
2723
+ "policies": {},
2724
+ "checkConstraints": {},
2725
+ "isRLSEnabled": false
2726
+ },
2727
+ "public.template": {
2728
+ "name": "template",
2729
+ "schema": "",
2730
+ "columns": {
2731
+ "id": {
2732
+ "name": "id",
2733
+ "type": "text",
2734
+ "primaryKey": true,
2735
+ "notNull": true
2736
+ },
2737
+ "organization_id": {
2738
+ "name": "organization_id",
2739
+ "type": "text",
2740
+ "primaryKey": false,
2741
+ "notNull": true
2742
+ },
2743
+ "name": {
2744
+ "name": "name",
2745
+ "type": "text",
2746
+ "primaryKey": false,
2747
+ "notNull": true
2748
+ },
2749
+ "description": {
2750
+ "name": "description",
2751
+ "type": "text",
2752
+ "primaryKey": false,
2753
+ "notNull": false
2754
+ },
2755
+ "subject": {
2756
+ "name": "subject",
2757
+ "type": "text",
2758
+ "primaryKey": false,
2759
+ "notNull": false
2760
+ },
2761
+ "content": {
2762
+ "name": "content",
2763
+ "type": "jsonb",
2764
+ "primaryKey": false,
2765
+ "notNull": true
2766
+ },
2767
+ "compiled_html": {
2768
+ "name": "compiled_html",
2769
+ "type": "text",
2770
+ "primaryKey": false,
2771
+ "notNull": false
2772
+ },
2773
+ "compiled_text": {
2774
+ "name": "compiled_text",
2775
+ "type": "text",
2776
+ "primaryKey": false,
2777
+ "notNull": false
2778
+ },
2779
+ "variables": {
2780
+ "name": "variables",
2781
+ "type": "jsonb",
2782
+ "primaryKey": false,
2783
+ "notNull": false,
2784
+ "default": "'[]'::jsonb"
2785
+ },
2786
+ "test_data": {
2787
+ "name": "test_data",
2788
+ "type": "jsonb",
2789
+ "primaryKey": false,
2790
+ "notNull": false,
2791
+ "default": "'{}'::jsonb"
2792
+ },
2793
+ "room_id": {
2794
+ "name": "room_id",
2795
+ "type": "text",
2796
+ "primaryKey": false,
2797
+ "notNull": false
2798
+ },
2799
+ "is_collaborative": {
2800
+ "name": "is_collaborative",
2801
+ "type": "boolean",
2802
+ "primaryKey": false,
2803
+ "notNull": true,
2804
+ "default": false
2805
+ },
2806
+ "ai_generated": {
2807
+ "name": "ai_generated",
2808
+ "type": "boolean",
2809
+ "primaryKey": false,
2810
+ "notNull": true,
2811
+ "default": false
2812
+ },
2813
+ "ai_conversation_id": {
2814
+ "name": "ai_conversation_id",
2815
+ "type": "text",
2816
+ "primaryKey": false,
2817
+ "notNull": false
2818
+ },
2819
+ "ses_template_name": {
2820
+ "name": "ses_template_name",
2821
+ "type": "text",
2822
+ "primaryKey": false,
2823
+ "notNull": false
2824
+ },
2825
+ "published_at": {
2826
+ "name": "published_at",
2827
+ "type": "timestamp",
2828
+ "primaryKey": false,
2829
+ "notNull": false
2830
+ },
2831
+ "status": {
2832
+ "name": "status",
2833
+ "type": "template_status",
2834
+ "typeSchema": "public",
2835
+ "primaryKey": false,
2836
+ "notNull": true,
2837
+ "default": "'DRAFT'"
2838
+ },
2839
+ "created_at": {
2840
+ "name": "created_at",
2841
+ "type": "timestamp",
2842
+ "primaryKey": false,
2843
+ "notNull": true,
2844
+ "default": "now()"
2845
+ },
2846
+ "updated_at": {
2847
+ "name": "updated_at",
2848
+ "type": "timestamp",
2849
+ "primaryKey": false,
2850
+ "notNull": true,
2851
+ "default": "now()"
2852
+ },
2853
+ "created_by": {
2854
+ "name": "created_by",
2855
+ "type": "text",
2856
+ "primaryKey": false,
2857
+ "notNull": true
2858
+ },
2859
+ "last_edited_by": {
2860
+ "name": "last_edited_by",
2861
+ "type": "text",
2862
+ "primaryKey": false,
2863
+ "notNull": false
2864
+ }
2865
+ },
2866
+ "indexes": {
2867
+ "template_org_idx": {
2868
+ "name": "template_org_idx",
2869
+ "columns": [
2870
+ {
2871
+ "expression": "organization_id",
2872
+ "isExpression": false,
2873
+ "asc": true,
2874
+ "nulls": "last"
2875
+ }
2876
+ ],
2877
+ "isUnique": false,
2878
+ "concurrently": false,
2879
+ "method": "btree",
2880
+ "with": {}
2881
+ },
2882
+ "template_status_updated_at_idx": {
2883
+ "name": "template_status_updated_at_idx",
2884
+ "columns": [
2885
+ {
2886
+ "expression": "status",
2887
+ "isExpression": false,
2888
+ "asc": true,
2889
+ "nulls": "last"
2890
+ },
2891
+ {
2892
+ "expression": "updated_at",
2893
+ "isExpression": false,
2894
+ "asc": true,
2895
+ "nulls": "last"
2896
+ }
2897
+ ],
2898
+ "isUnique": false,
2899
+ "concurrently": false,
2900
+ "method": "btree",
2901
+ "with": {}
2902
+ },
2903
+ "template_created_by_idx": {
2904
+ "name": "template_created_by_idx",
2905
+ "columns": [
2906
+ {
2907
+ "expression": "created_by",
2908
+ "isExpression": false,
2909
+ "asc": true,
2910
+ "nulls": "last"
2911
+ }
2912
+ ],
2913
+ "isUnique": false,
2914
+ "concurrently": false,
2915
+ "method": "btree",
2916
+ "with": {}
2917
+ },
2918
+ "template_room_id_idx": {
2919
+ "name": "template_room_id_idx",
2920
+ "columns": [
2921
+ {
2922
+ "expression": "room_id",
2923
+ "isExpression": false,
2924
+ "asc": true,
2925
+ "nulls": "last"
2926
+ }
2927
+ ],
2928
+ "isUnique": true,
2929
+ "concurrently": false,
2930
+ "method": "btree",
2931
+ "with": {}
2932
+ }
2933
+ },
2934
+ "foreignKeys": {
2935
+ "template_organization_id_organization_id_fk": {
2936
+ "name": "template_organization_id_organization_id_fk",
2937
+ "tableFrom": "template",
2938
+ "tableTo": "organization",
2939
+ "columnsFrom": ["organization_id"],
2940
+ "columnsTo": ["id"],
2941
+ "onDelete": "cascade",
2942
+ "onUpdate": "no action"
2943
+ },
2944
+ "template_created_by_user_id_fk": {
2945
+ "name": "template_created_by_user_id_fk",
2946
+ "tableFrom": "template",
2947
+ "tableTo": "user",
2948
+ "columnsFrom": ["created_by"],
2949
+ "columnsTo": ["id"],
2950
+ "onDelete": "set null",
2951
+ "onUpdate": "no action"
2952
+ },
2953
+ "template_last_edited_by_user_id_fk": {
2954
+ "name": "template_last_edited_by_user_id_fk",
2955
+ "tableFrom": "template",
2956
+ "tableTo": "user",
2957
+ "columnsFrom": ["last_edited_by"],
2958
+ "columnsTo": ["id"],
2959
+ "onDelete": "set null",
2960
+ "onUpdate": "no action"
2961
+ }
2962
+ },
2963
+ "compositePrimaryKeys": {},
2964
+ "uniqueConstraints": {},
2965
+ "policies": {},
2966
+ "checkConstraints": {},
2967
+ "isRLSEnabled": false
2968
+ },
2969
+ "public.template_variable": {
2970
+ "name": "template_variable",
2971
+ "schema": "",
2972
+ "columns": {
2973
+ "id": {
2974
+ "name": "id",
2975
+ "type": "text",
2976
+ "primaryKey": true,
2977
+ "notNull": true
2978
+ },
2979
+ "organization_id": {
2980
+ "name": "organization_id",
2981
+ "type": "text",
2982
+ "primaryKey": false,
2983
+ "notNull": true
2984
+ },
2985
+ "name": {
2986
+ "name": "name",
2987
+ "type": "text",
2988
+ "primaryKey": false,
2989
+ "notNull": true
2990
+ },
2991
+ "label": {
2992
+ "name": "label",
2993
+ "type": "text",
2994
+ "primaryKey": false,
2995
+ "notNull": true
2996
+ },
2997
+ "type": {
2998
+ "name": "type",
2999
+ "type": "variable_type",
3000
+ "typeSchema": "public",
3001
+ "primaryKey": false,
3002
+ "notNull": true
3003
+ },
3004
+ "required": {
3005
+ "name": "required",
3006
+ "type": "boolean",
3007
+ "primaryKey": false,
3008
+ "notNull": true,
3009
+ "default": false
3010
+ },
3011
+ "fallback": {
3012
+ "name": "fallback",
3013
+ "type": "text",
3014
+ "primaryKey": false,
3015
+ "notNull": false
3016
+ },
3017
+ "validation": {
3018
+ "name": "validation",
3019
+ "type": "jsonb",
3020
+ "primaryKey": false,
3021
+ "notNull": false
3022
+ },
3023
+ "created_at": {
3024
+ "name": "created_at",
3025
+ "type": "timestamp",
3026
+ "primaryKey": false,
3027
+ "notNull": true,
3028
+ "default": "now()"
3029
+ },
3030
+ "updated_at": {
3031
+ "name": "updated_at",
3032
+ "type": "timestamp",
3033
+ "primaryKey": false,
3034
+ "notNull": true,
3035
+ "default": "now()"
3036
+ }
3037
+ },
3038
+ "indexes": {
3039
+ "template_variable_org_name_idx": {
3040
+ "name": "template_variable_org_name_idx",
3041
+ "columns": [
3042
+ {
3043
+ "expression": "organization_id",
3044
+ "isExpression": false,
3045
+ "asc": true,
3046
+ "nulls": "last"
3047
+ },
3048
+ {
3049
+ "expression": "name",
3050
+ "isExpression": false,
3051
+ "asc": true,
3052
+ "nulls": "last"
3053
+ }
3054
+ ],
3055
+ "isUnique": true,
3056
+ "concurrently": false,
3057
+ "method": "btree",
3058
+ "with": {}
3059
+ }
3060
+ },
3061
+ "foreignKeys": {
3062
+ "template_variable_organization_id_organization_id_fk": {
3063
+ "name": "template_variable_organization_id_organization_id_fk",
3064
+ "tableFrom": "template_variable",
3065
+ "tableTo": "organization",
3066
+ "columnsFrom": ["organization_id"],
3067
+ "columnsTo": ["id"],
3068
+ "onDelete": "cascade",
3069
+ "onUpdate": "no action"
3070
+ }
3071
+ },
3072
+ "compositePrimaryKeys": {},
3073
+ "uniqueConstraints": {},
3074
+ "policies": {},
3075
+ "checkConstraints": {},
3076
+ "isRLSEnabled": false
3077
+ },
3078
+ "public.template_version": {
3079
+ "name": "template_version",
3080
+ "schema": "",
3081
+ "columns": {
3082
+ "id": {
3083
+ "name": "id",
3084
+ "type": "text",
3085
+ "primaryKey": true,
3086
+ "notNull": true
3087
+ },
3088
+ "template_id": {
3089
+ "name": "template_id",
3090
+ "type": "text",
3091
+ "primaryKey": false,
3092
+ "notNull": true
3093
+ },
3094
+ "content": {
3095
+ "name": "content",
3096
+ "type": "jsonb",
3097
+ "primaryKey": false,
3098
+ "notNull": true
3099
+ },
3100
+ "version": {
3101
+ "name": "version",
3102
+ "type": "integer",
3103
+ "primaryKey": false,
3104
+ "notNull": true
3105
+ },
3106
+ "created_at": {
3107
+ "name": "created_at",
3108
+ "type": "timestamp",
3109
+ "primaryKey": false,
3110
+ "notNull": true,
3111
+ "default": "now()"
3112
+ },
3113
+ "created_by": {
3114
+ "name": "created_by",
3115
+ "type": "text",
3116
+ "primaryKey": false,
3117
+ "notNull": true
3118
+ },
3119
+ "change_note": {
3120
+ "name": "change_note",
3121
+ "type": "text",
3122
+ "primaryKey": false,
3123
+ "notNull": false
3124
+ }
3125
+ },
3126
+ "indexes": {
3127
+ "template_version_template_version_idx": {
3128
+ "name": "template_version_template_version_idx",
3129
+ "columns": [
3130
+ {
3131
+ "expression": "template_id",
3132
+ "isExpression": false,
3133
+ "asc": true,
3134
+ "nulls": "last"
3135
+ },
3136
+ {
3137
+ "expression": "version",
3138
+ "isExpression": false,
3139
+ "asc": true,
3140
+ "nulls": "last"
3141
+ }
3142
+ ],
3143
+ "isUnique": true,
3144
+ "concurrently": false,
3145
+ "method": "btree",
3146
+ "with": {}
3147
+ },
3148
+ "template_version_template_created_at_idx": {
3149
+ "name": "template_version_template_created_at_idx",
3150
+ "columns": [
3151
+ {
3152
+ "expression": "template_id",
3153
+ "isExpression": false,
3154
+ "asc": true,
3155
+ "nulls": "last"
3156
+ },
3157
+ {
3158
+ "expression": "created_at",
3159
+ "isExpression": false,
3160
+ "asc": true,
3161
+ "nulls": "last"
3162
+ }
3163
+ ],
3164
+ "isUnique": false,
3165
+ "concurrently": false,
3166
+ "method": "btree",
3167
+ "with": {}
3168
+ }
3169
+ },
3170
+ "foreignKeys": {
3171
+ "template_version_template_id_template_id_fk": {
3172
+ "name": "template_version_template_id_template_id_fk",
3173
+ "tableFrom": "template_version",
3174
+ "tableTo": "template",
3175
+ "columnsFrom": ["template_id"],
3176
+ "columnsTo": ["id"],
3177
+ "onDelete": "cascade",
3178
+ "onUpdate": "no action"
3179
+ },
3180
+ "template_version_created_by_user_id_fk": {
3181
+ "name": "template_version_created_by_user_id_fk",
3182
+ "tableFrom": "template_version",
3183
+ "tableTo": "user",
3184
+ "columnsFrom": ["created_by"],
3185
+ "columnsTo": ["id"],
3186
+ "onDelete": "set null",
3187
+ "onUpdate": "no action"
3188
+ }
3189
+ },
3190
+ "compositePrimaryKeys": {},
3191
+ "uniqueConstraints": {},
3192
+ "policies": {},
3193
+ "checkConstraints": {},
3194
+ "isRLSEnabled": false
3195
+ },
3196
+ "public.ai_usage_log": {
3197
+ "name": "ai_usage_log",
3198
+ "schema": "",
3199
+ "columns": {
3200
+ "id": {
3201
+ "name": "id",
3202
+ "type": "text",
3203
+ "primaryKey": true,
3204
+ "notNull": true
3205
+ },
3206
+ "organization_id": {
3207
+ "name": "organization_id",
3208
+ "type": "text",
3209
+ "primaryKey": false,
3210
+ "notNull": true
3211
+ },
3212
+ "user_id": {
3213
+ "name": "user_id",
3214
+ "type": "text",
3215
+ "primaryKey": false,
3216
+ "notNull": false
3217
+ },
3218
+ "period_key": {
3219
+ "name": "period_key",
3220
+ "type": "text",
3221
+ "primaryKey": false,
3222
+ "notNull": true
3223
+ },
3224
+ "feature_type": {
3225
+ "name": "feature_type",
3226
+ "type": "text",
3227
+ "primaryKey": false,
3228
+ "notNull": true,
3229
+ "default": "'ai_chat'"
3230
+ },
3231
+ "template_id": {
3232
+ "name": "template_id",
3233
+ "type": "text",
3234
+ "primaryKey": false,
3235
+ "notNull": false
3236
+ },
3237
+ "input_tokens": {
3238
+ "name": "input_tokens",
3239
+ "type": "integer",
3240
+ "primaryKey": false,
3241
+ "notNull": false
3242
+ },
3243
+ "output_tokens": {
3244
+ "name": "output_tokens",
3245
+ "type": "integer",
3246
+ "primaryKey": false,
3247
+ "notNull": false
3248
+ },
3249
+ "total_tokens": {
3250
+ "name": "total_tokens",
3251
+ "type": "integer",
3252
+ "primaryKey": false,
3253
+ "notNull": false
3254
+ },
3255
+ "model": {
3256
+ "name": "model",
3257
+ "type": "text",
3258
+ "primaryKey": false,
3259
+ "notNull": false
3260
+ },
3261
+ "duration_ms": {
3262
+ "name": "duration_ms",
3263
+ "type": "integer",
3264
+ "primaryKey": false,
3265
+ "notNull": false
3266
+ },
3267
+ "created_at": {
3268
+ "name": "created_at",
3269
+ "type": "timestamp",
3270
+ "primaryKey": false,
3271
+ "notNull": true,
3272
+ "default": "now()"
3273
+ }
3274
+ },
3275
+ "indexes": {
3276
+ "ai_usage_log_org_idx": {
3277
+ "name": "ai_usage_log_org_idx",
3278
+ "columns": [
3279
+ {
3280
+ "expression": "organization_id",
3281
+ "isExpression": false,
3282
+ "asc": true,
3283
+ "nulls": "last"
3284
+ }
3285
+ ],
3286
+ "isUnique": false,
3287
+ "concurrently": false,
3288
+ "method": "btree",
3289
+ "with": {}
3290
+ },
3291
+ "ai_usage_log_period_idx": {
3292
+ "name": "ai_usage_log_period_idx",
3293
+ "columns": [
3294
+ {
3295
+ "expression": "period_key",
3296
+ "isExpression": false,
3297
+ "asc": true,
3298
+ "nulls": "last"
3299
+ }
3300
+ ],
3301
+ "isUnique": false,
3302
+ "concurrently": false,
3303
+ "method": "btree",
3304
+ "with": {}
3305
+ },
3306
+ "ai_usage_log_org_period_idx": {
3307
+ "name": "ai_usage_log_org_period_idx",
3308
+ "columns": [
3309
+ {
3310
+ "expression": "organization_id",
3311
+ "isExpression": false,
3312
+ "asc": true,
3313
+ "nulls": "last"
3314
+ },
3315
+ {
3316
+ "expression": "period_key",
3317
+ "isExpression": false,
3318
+ "asc": true,
3319
+ "nulls": "last"
3320
+ }
3321
+ ],
3322
+ "isUnique": false,
3323
+ "concurrently": false,
3324
+ "method": "btree",
3325
+ "with": {}
3326
+ },
3327
+ "ai_usage_log_user_idx": {
3328
+ "name": "ai_usage_log_user_idx",
3329
+ "columns": [
3330
+ {
3331
+ "expression": "user_id",
3332
+ "isExpression": false,
3333
+ "asc": true,
3334
+ "nulls": "last"
3335
+ }
3336
+ ],
3337
+ "isUnique": false,
3338
+ "concurrently": false,
3339
+ "method": "btree",
3340
+ "with": {}
3341
+ },
3342
+ "ai_usage_log_created_idx": {
3343
+ "name": "ai_usage_log_created_idx",
3344
+ "columns": [
3345
+ {
3346
+ "expression": "created_at",
3347
+ "isExpression": false,
3348
+ "asc": true,
3349
+ "nulls": "last"
3350
+ }
3351
+ ],
3352
+ "isUnique": false,
3353
+ "concurrently": false,
3354
+ "method": "btree",
3355
+ "with": {}
3356
+ }
3357
+ },
3358
+ "foreignKeys": {
3359
+ "ai_usage_log_organization_id_organization_id_fk": {
3360
+ "name": "ai_usage_log_organization_id_organization_id_fk",
3361
+ "tableFrom": "ai_usage_log",
3362
+ "tableTo": "organization",
3363
+ "columnsFrom": ["organization_id"],
3364
+ "columnsTo": ["id"],
3365
+ "onDelete": "cascade",
3366
+ "onUpdate": "no action"
3367
+ },
3368
+ "ai_usage_log_user_id_user_id_fk": {
3369
+ "name": "ai_usage_log_user_id_user_id_fk",
3370
+ "tableFrom": "ai_usage_log",
3371
+ "tableTo": "user",
3372
+ "columnsFrom": ["user_id"],
3373
+ "columnsTo": ["id"],
3374
+ "onDelete": "set null",
3375
+ "onUpdate": "no action"
3376
+ }
3377
+ },
3378
+ "compositePrimaryKeys": {},
3379
+ "uniqueConstraints": {},
3380
+ "policies": {},
3381
+ "checkConstraints": {},
3382
+ "isRLSEnabled": false
3383
+ },
3384
+ "public.ai_usage_monthly": {
3385
+ "name": "ai_usage_monthly",
3386
+ "schema": "",
3387
+ "columns": {
3388
+ "id": {
3389
+ "name": "id",
3390
+ "type": "text",
3391
+ "primaryKey": true,
3392
+ "notNull": true
3393
+ },
3394
+ "organization_id": {
3395
+ "name": "organization_id",
3396
+ "type": "text",
3397
+ "primaryKey": false,
3398
+ "notNull": true
3399
+ },
3400
+ "period_key": {
3401
+ "name": "period_key",
3402
+ "type": "text",
3403
+ "primaryKey": false,
3404
+ "notNull": true
3405
+ },
3406
+ "message_count": {
3407
+ "name": "message_count",
3408
+ "type": "integer",
3409
+ "primaryKey": false,
3410
+ "notNull": true,
3411
+ "default": 0
3412
+ },
3413
+ "updated_at": {
3414
+ "name": "updated_at",
3415
+ "type": "timestamp",
3416
+ "primaryKey": false,
3417
+ "notNull": true,
3418
+ "default": "now()"
3419
+ }
3420
+ },
3421
+ "indexes": {
3422
+ "ai_usage_monthly_org_period_idx": {
3423
+ "name": "ai_usage_monthly_org_period_idx",
3424
+ "columns": [
3425
+ {
3426
+ "expression": "organization_id",
3427
+ "isExpression": false,
3428
+ "asc": true,
3429
+ "nulls": "last"
3430
+ },
3431
+ {
3432
+ "expression": "period_key",
3433
+ "isExpression": false,
3434
+ "asc": true,
3435
+ "nulls": "last"
3436
+ }
3437
+ ],
3438
+ "isUnique": true,
3439
+ "concurrently": false,
3440
+ "method": "btree",
3441
+ "with": {}
3442
+ },
3443
+ "ai_usage_monthly_period_idx": {
3444
+ "name": "ai_usage_monthly_period_idx",
3445
+ "columns": [
3446
+ {
3447
+ "expression": "period_key",
3448
+ "isExpression": false,
3449
+ "asc": true,
3450
+ "nulls": "last"
3451
+ }
3452
+ ],
3453
+ "isUnique": false,
3454
+ "concurrently": false,
3455
+ "method": "btree",
3456
+ "with": {}
3457
+ }
3458
+ },
3459
+ "foreignKeys": {
3460
+ "ai_usage_monthly_organization_id_organization_id_fk": {
3461
+ "name": "ai_usage_monthly_organization_id_organization_id_fk",
3462
+ "tableFrom": "ai_usage_monthly",
3463
+ "tableTo": "organization",
3464
+ "columnsFrom": ["organization_id"],
3465
+ "columnsTo": ["id"],
3466
+ "onDelete": "cascade",
3467
+ "onUpdate": "no action"
3468
+ }
3469
+ },
3470
+ "compositePrimaryKeys": {},
3471
+ "uniqueConstraints": {},
3472
+ "policies": {},
3473
+ "checkConstraints": {},
3474
+ "isRLSEnabled": false
3475
+ },
3476
+ "public.waitlist": {
3477
+ "name": "waitlist",
3478
+ "schema": "",
3479
+ "columns": {
3480
+ "id": {
3481
+ "name": "id",
3482
+ "type": "text",
3483
+ "primaryKey": true,
3484
+ "notNull": true
3485
+ },
3486
+ "email": {
3487
+ "name": "email",
3488
+ "type": "text",
3489
+ "primaryKey": false,
3490
+ "notNull": true
3491
+ },
3492
+ "email_hash": {
3493
+ "name": "email_hash",
3494
+ "type": "text",
3495
+ "primaryKey": false,
3496
+ "notNull": true
3497
+ },
3498
+ "product": {
3499
+ "name": "product",
3500
+ "type": "text",
3501
+ "primaryKey": false,
3502
+ "notNull": true
3503
+ },
3504
+ "source": {
3505
+ "name": "source",
3506
+ "type": "text",
3507
+ "primaryKey": false,
3508
+ "notNull": false
3509
+ },
3510
+ "referrer": {
3511
+ "name": "referrer",
3512
+ "type": "text",
3513
+ "primaryKey": false,
3514
+ "notNull": false
3515
+ },
3516
+ "created_at": {
3517
+ "name": "created_at",
3518
+ "type": "timestamp",
3519
+ "primaryKey": false,
3520
+ "notNull": true,
3521
+ "default": "now()"
3522
+ }
3523
+ },
3524
+ "indexes": {
3525
+ "waitlist_email_product_idx": {
3526
+ "name": "waitlist_email_product_idx",
3527
+ "columns": [
3528
+ {
3529
+ "expression": "email_hash",
3530
+ "isExpression": false,
3531
+ "asc": true,
3532
+ "nulls": "last"
3533
+ },
3534
+ {
3535
+ "expression": "product",
3536
+ "isExpression": false,
3537
+ "asc": true,
3538
+ "nulls": "last"
3539
+ }
3540
+ ],
3541
+ "isUnique": true,
3542
+ "concurrently": false,
3543
+ "method": "btree",
3544
+ "with": {}
3545
+ },
3546
+ "waitlist_product_idx": {
3547
+ "name": "waitlist_product_idx",
3548
+ "columns": [
3549
+ {
3550
+ "expression": "product",
3551
+ "isExpression": false,
3552
+ "asc": true,
3553
+ "nulls": "last"
3554
+ }
3555
+ ],
3556
+ "isUnique": false,
3557
+ "concurrently": false,
3558
+ "method": "btree",
3559
+ "with": {}
3560
+ },
3561
+ "waitlist_created_at_idx": {
3562
+ "name": "waitlist_created_at_idx",
3563
+ "columns": [
3564
+ {
3565
+ "expression": "created_at",
3566
+ "isExpression": false,
3567
+ "asc": true,
3568
+ "nulls": "last"
3569
+ }
3570
+ ],
3571
+ "isUnique": false,
3572
+ "concurrently": false,
3573
+ "method": "btree",
3574
+ "with": {}
3575
+ }
3576
+ },
3577
+ "foreignKeys": {},
3578
+ "compositePrimaryKeys": {},
3579
+ "uniqueConstraints": {},
3580
+ "policies": {},
3581
+ "checkConstraints": {},
3582
+ "isRLSEnabled": false
3583
+ }
3584
+ },
3585
+ "enums": {
3586
+ "public.template_status": {
3587
+ "name": "template_status",
3588
+ "schema": "public",
3589
+ "values": ["DRAFT", "PUBLISHED", "ARCHIVED"]
3590
+ },
3591
+ "public.variable_type": {
3592
+ "name": "variable_type",
3593
+ "schema": "public",
3594
+ "values": ["TEXT", "NUMBER", "BOOLEAN", "DATE", "URL", "EMAIL"]
3595
+ }
3596
+ },
3597
+ "schemas": {},
3598
+ "sequences": {},
3599
+ "roles": {},
3600
+ "policies": {},
3601
+ "views": {},
3602
+ "_meta": {
3603
+ "columns": {},
3604
+ "schemas": {},
3605
+ "tables": {}
3606
+ }
3607
+ }