@wraps.dev/cli 2.21.10 → 2.21.12

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