@wraps.dev/cli 2.21.6 → 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 (123) hide show
  1. package/dist/api-lambda.zip +0 -0
  2. package/dist/cli.js +40 -59
  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/0000_absent_rogue.sql +203 -0
  8. package/dist/selfhost-migrations/0001_polite_maverick.sql +17 -0
  9. package/dist/selfhost-migrations/0002_perpetual_scorpion.sql +1 -0
  10. package/dist/selfhost-migrations/0003_wealthy_absorbing_man.sql +1 -0
  11. package/dist/selfhost-migrations/0004_opposite_blur.sql +1 -0
  12. package/dist/selfhost-migrations/0005_clear_terror.sql +4 -0
  13. package/dist/selfhost-migrations/0006_soft_black_widow.sql +20 -0
  14. package/dist/selfhost-migrations/0007_dazzling_saracen.sql +124 -0
  15. package/dist/selfhost-migrations/0008_broad_hannibal_king.sql +33 -0
  16. package/dist/selfhost-migrations/0009_bouncy_mystique.sql +73 -0
  17. package/dist/selfhost-migrations/0010_cheerful_valeria_richards.sql +18 -0
  18. package/dist/selfhost-migrations/0011_absent_thunderbolts.sql +2 -0
  19. package/dist/selfhost-migrations/0012_demonic_donald_blake.sql +1 -0
  20. package/dist/selfhost-migrations/0013_nifty_preak.sql +143 -0
  21. package/dist/selfhost-migrations/0014_hesitant_beast.sql +2 -0
  22. package/dist/selfhost-migrations/0015_blue_giant_girl.sql +1 -0
  23. package/dist/selfhost-migrations/0016_cooing_overlord.sql +1 -0
  24. package/dist/selfhost-migrations/0017_tranquil_ender_wiggin.sql +11 -0
  25. package/dist/selfhost-migrations/0018_talented_groot.sql +8 -0
  26. package/dist/selfhost-migrations/0019_ambitious_devos.sql +3 -0
  27. package/dist/selfhost-migrations/0020_misty_master_mold.sql +95 -0
  28. package/dist/selfhost-migrations/0021_regular_harrier.sql +14 -0
  29. package/dist/selfhost-migrations/0022_sour_blizzard.sql +10 -0
  30. package/dist/selfhost-migrations/0023_flawless_psynapse.sql +1 -0
  31. package/dist/selfhost-migrations/0024_premium_blindfold.sql +1 -0
  32. package/dist/selfhost-migrations/0025_unusual_santa_claus.sql +1 -0
  33. package/dist/selfhost-migrations/0026_volatile_pandemic.sql +2 -0
  34. package/dist/selfhost-migrations/0027_workable_logan.sql +4 -0
  35. package/dist/selfhost-migrations/0028_familiar_prodigy.sql +1 -0
  36. package/dist/selfhost-migrations/0029_cute_maddog.sql +13 -0
  37. package/dist/selfhost-migrations/0030_adorable_scarecrow.sql +1 -0
  38. package/dist/selfhost-migrations/0031_material_slapstick.sql +10 -0
  39. package/dist/selfhost-migrations/0032_hot_dust.sql +11 -0
  40. package/dist/selfhost-migrations/0033_slow_deathbird.sql +1 -0
  41. package/dist/selfhost-migrations/0034_lush_rafael_vega.sql +12 -0
  42. package/dist/selfhost-migrations/0035_normal_red_hulk.sql +8 -0
  43. package/dist/selfhost-migrations/0036_marvelous_ezekiel.sql +1 -0
  44. package/dist/selfhost-migrations/0037_swift_talisman.sql +8 -0
  45. package/dist/selfhost-migrations/0038_first_mandroid.sql +1 -0
  46. package/dist/selfhost-migrations/0039_fixed_stryfe.sql +1 -0
  47. package/dist/selfhost-migrations/0040_add_channel_check_constraints.sql +2 -0
  48. package/dist/selfhost-migrations/0041_black_spencer_smythe.sql +1 -0
  49. package/dist/selfhost-migrations/0042_plain_marvel_zombies.sql +2 -0
  50. package/dist/selfhost-migrations/0043_curved_champions.sql +1 -0
  51. package/dist/selfhost-migrations/0044_clean_iceman.sql +1 -0
  52. package/dist/selfhost-migrations/0045_condemned_steel_serpent.sql +1 -0
  53. package/dist/selfhost-migrations/0046_steep_ultimo.sql +2 -0
  54. package/dist/selfhost-migrations/0047_empty_sleepwalker.sql +2 -0
  55. package/dist/selfhost-migrations/0048_cheerful_multiple_man.sql +1 -0
  56. package/dist/selfhost-migrations/0049_nostalgic_loki.sql +3 -0
  57. package/dist/selfhost-migrations/0050_add_engagement_metadata.sql +4 -0
  58. package/dist/selfhost-migrations/0051_odd_marrow.sql +2 -0
  59. package/dist/selfhost-migrations/0052_redundant_siren.sql +5 -0
  60. package/dist/selfhost-migrations/0053_soft_carnage.sql +31 -0
  61. package/dist/selfhost-migrations/0054_blushing_vin_gonzales.sql +1 -0
  62. package/dist/selfhost-migrations/0055_broadcast_resume_columns.sql +12 -0
  63. package/dist/selfhost-migrations/0056_broadcast_resume_dedup_cleanup.sql +31 -0
  64. package/dist/selfhost-migrations/0057_audit_log_actoremail_jsonb.sql +5 -0
  65. package/dist/selfhost-migrations/meta/0000_snapshot.json +1311 -0
  66. package/dist/selfhost-migrations/meta/0001_snapshot.json +1454 -0
  67. package/dist/selfhost-migrations/meta/0002_snapshot.json +1460 -0
  68. package/dist/selfhost-migrations/meta/0003_snapshot.json +1467 -0
  69. package/dist/selfhost-migrations/meta/0004_snapshot.json +1473 -0
  70. package/dist/selfhost-migrations/meta/0005_snapshot.json +1499 -0
  71. package/dist/selfhost-migrations/meta/0006_snapshot.json +1617 -0
  72. package/dist/selfhost-migrations/meta/0007_snapshot.json +2581 -0
  73. package/dist/selfhost-migrations/meta/0008_snapshot.json +2861 -0
  74. package/dist/selfhost-migrations/meta/0009_snapshot.json +3447 -0
  75. package/dist/selfhost-migrations/meta/0010_snapshot.json +3586 -0
  76. package/dist/selfhost-migrations/meta/0011_snapshot.json +3600 -0
  77. package/dist/selfhost-migrations/meta/0012_snapshot.json +3607 -0
  78. package/dist/selfhost-migrations/meta/0013_snapshot.json +4697 -0
  79. package/dist/selfhost-migrations/meta/0014_snapshot.json +4704 -0
  80. package/dist/selfhost-migrations/meta/0015_snapshot.json +4697 -0
  81. package/dist/selfhost-migrations/meta/0016_snapshot.json +4703 -0
  82. package/dist/selfhost-migrations/meta/0017_snapshot.json +4769 -0
  83. package/dist/selfhost-migrations/meta/0018_snapshot.json +4821 -0
  84. package/dist/selfhost-migrations/meta/0019_snapshot.json +4840 -0
  85. package/dist/selfhost-migrations/meta/0020_snapshot.json +5602 -0
  86. package/dist/selfhost-migrations/meta/0021_snapshot.json +5729 -0
  87. package/dist/selfhost-migrations/meta/0022_snapshot.json +5792 -0
  88. package/dist/selfhost-migrations/meta/0023_snapshot.json +5799 -0
  89. package/dist/selfhost-migrations/meta/0024_snapshot.json +5821 -0
  90. package/dist/selfhost-migrations/meta/0025_snapshot.json +5831 -0
  91. package/dist/selfhost-migrations/meta/0026_snapshot.json +5844 -0
  92. package/dist/selfhost-migrations/meta/0027_snapshot.json +5864 -0
  93. package/dist/selfhost-migrations/meta/0028_snapshot.json +5871 -0
  94. package/dist/selfhost-migrations/meta/0029_snapshot.json +5984 -0
  95. package/dist/selfhost-migrations/meta/0030_snapshot.json +5990 -0
  96. package/dist/selfhost-migrations/meta/0031_snapshot.json +5950 -0
  97. package/dist/selfhost-migrations/meta/0032_snapshot.json +6042 -0
  98. package/dist/selfhost-migrations/meta/0033_snapshot.json +6057 -0
  99. package/dist/selfhost-migrations/meta/0034_snapshot.json +6130 -0
  100. package/dist/selfhost-migrations/meta/0035_snapshot.json +6195 -0
  101. package/dist/selfhost-migrations/meta/0036_snapshot.json +6201 -0
  102. package/dist/selfhost-migrations/meta/0037_snapshot.json +6265 -0
  103. package/dist/selfhost-migrations/meta/0038_snapshot.json +6271 -0
  104. package/dist/selfhost-migrations/meta/0039_snapshot.json +6278 -0
  105. package/dist/selfhost-migrations/meta/0041_snapshot.json +6284 -0
  106. package/dist/selfhost-migrations/meta/0042_snapshot.json +6297 -0
  107. package/dist/selfhost-migrations/meta/0043_snapshot.json +6297 -0
  108. package/dist/selfhost-migrations/meta/0044_snapshot.json +6297 -0
  109. package/dist/selfhost-migrations/meta/0045_snapshot.json +6303 -0
  110. package/dist/selfhost-migrations/meta/0046_snapshot.json +6315 -0
  111. package/dist/selfhost-migrations/meta/0047_snapshot.json +6330 -0
  112. package/dist/selfhost-migrations/meta/0048_snapshot.json +6336 -0
  113. package/dist/selfhost-migrations/meta/0049_snapshot.json +6366 -0
  114. package/dist/selfhost-migrations/meta/0050_snapshot.json +6390 -0
  115. package/dist/selfhost-migrations/meta/0051_snapshot.json +6403 -0
  116. package/dist/selfhost-migrations/meta/0052_snapshot.json +6470 -0
  117. package/dist/selfhost-migrations/meta/0053_snapshot.json +6470 -0
  118. package/dist/selfhost-migrations/meta/0054_snapshot.json +6646 -0
  119. package/dist/selfhost-migrations/meta/0055_snapshot.json +6677 -0
  120. package/dist/selfhost-migrations/meta/0056_snapshot.json +6677 -0
  121. package/dist/selfhost-migrations/meta/0057_snapshot.json +6674 -0
  122. package/dist/selfhost-migrations/meta/_journal.json +412 -0
  123. package/package.json +7 -4
@@ -0,0 +1,4769 @@
1
+ {
2
+ "id": "946a250d-f7bf-49d8-9def-9a2064faa185",
3
+ "prevId": "77f83414-0f02-4edc-a077-c675cec6b57a",
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
+ "webhook_secret": {
303
+ "name": "webhook_secret",
304
+ "type": "text",
305
+ "primaryKey": false,
306
+ "notNull": false
307
+ },
308
+ "is_verified": {
309
+ "name": "is_verified",
310
+ "type": "boolean",
311
+ "primaryKey": false,
312
+ "notNull": true,
313
+ "default": false
314
+ },
315
+ "last_verified_at": {
316
+ "name": "last_verified_at",
317
+ "type": "timestamp",
318
+ "primaryKey": false,
319
+ "notNull": false
320
+ },
321
+ "archiving_enabled": {
322
+ "name": "archiving_enabled",
323
+ "type": "boolean",
324
+ "primaryKey": false,
325
+ "notNull": true,
326
+ "default": false
327
+ },
328
+ "archive_arn": {
329
+ "name": "archive_arn",
330
+ "type": "text",
331
+ "primaryKey": false,
332
+ "notNull": false
333
+ },
334
+ "event_history_enabled": {
335
+ "name": "event_history_enabled",
336
+ "type": "boolean",
337
+ "primaryKey": false,
338
+ "notNull": true,
339
+ "default": false
340
+ },
341
+ "event_tracking_enabled": {
342
+ "name": "event_tracking_enabled",
343
+ "type": "boolean",
344
+ "primaryKey": false,
345
+ "notNull": true,
346
+ "default": false
347
+ },
348
+ "config_set_name": {
349
+ "name": "config_set_name",
350
+ "type": "text",
351
+ "primaryKey": false,
352
+ "notNull": false
353
+ },
354
+ "custom_tracking_domain": {
355
+ "name": "custom_tracking_domain",
356
+ "type": "text",
357
+ "primaryKey": false,
358
+ "notNull": false
359
+ },
360
+ "sms_enabled": {
361
+ "name": "sms_enabled",
362
+ "type": "boolean",
363
+ "primaryKey": false,
364
+ "notNull": true,
365
+ "default": false
366
+ },
367
+ "sms_phone_number_count": {
368
+ "name": "sms_phone_number_count",
369
+ "type": "integer",
370
+ "primaryKey": false,
371
+ "notNull": true,
372
+ "default": 0
373
+ },
374
+ "sms_event_history_enabled": {
375
+ "name": "sms_event_history_enabled",
376
+ "type": "boolean",
377
+ "primaryKey": false,
378
+ "notNull": true,
379
+ "default": false
380
+ },
381
+ "created_by": {
382
+ "name": "created_by",
383
+ "type": "text",
384
+ "primaryKey": false,
385
+ "notNull": false
386
+ },
387
+ "created_at": {
388
+ "name": "created_at",
389
+ "type": "timestamp",
390
+ "primaryKey": false,
391
+ "notNull": true,
392
+ "default": "now()"
393
+ },
394
+ "updated_at": {
395
+ "name": "updated_at",
396
+ "type": "timestamp",
397
+ "primaryKey": false,
398
+ "notNull": true,
399
+ "default": "now()"
400
+ }
401
+ },
402
+ "indexes": {
403
+ "aws_account_org_idx": {
404
+ "name": "aws_account_org_idx",
405
+ "columns": [
406
+ {
407
+ "expression": "organization_id",
408
+ "isExpression": false,
409
+ "asc": true,
410
+ "nulls": "last"
411
+ }
412
+ ],
413
+ "isUnique": false,
414
+ "concurrently": false,
415
+ "method": "btree",
416
+ "with": {}
417
+ },
418
+ "aws_account_external_id_idx": {
419
+ "name": "aws_account_external_id_idx",
420
+ "columns": [
421
+ {
422
+ "expression": "external_id",
423
+ "isExpression": false,
424
+ "asc": true,
425
+ "nulls": "last"
426
+ }
427
+ ],
428
+ "isUnique": false,
429
+ "concurrently": false,
430
+ "method": "btree",
431
+ "with": {}
432
+ }
433
+ },
434
+ "foreignKeys": {
435
+ "aws_account_organization_id_organization_id_fk": {
436
+ "name": "aws_account_organization_id_organization_id_fk",
437
+ "tableFrom": "aws_account",
438
+ "tableTo": "organization",
439
+ "columnsFrom": ["organization_id"],
440
+ "columnsTo": ["id"],
441
+ "onDelete": "cascade",
442
+ "onUpdate": "no action"
443
+ },
444
+ "aws_account_created_by_user_id_fk": {
445
+ "name": "aws_account_created_by_user_id_fk",
446
+ "tableFrom": "aws_account",
447
+ "tableTo": "user",
448
+ "columnsFrom": ["created_by"],
449
+ "columnsTo": ["id"],
450
+ "onDelete": "no action",
451
+ "onUpdate": "no action"
452
+ }
453
+ },
454
+ "compositePrimaryKeys": {},
455
+ "uniqueConstraints": {
456
+ "aws_account_external_id_unique": {
457
+ "name": "aws_account_external_id_unique",
458
+ "nullsNotDistinct": false,
459
+ "columns": ["external_id"]
460
+ }
461
+ },
462
+ "policies": {},
463
+ "checkConstraints": {},
464
+ "isRLSEnabled": false
465
+ },
466
+ "public.aws_account_permission": {
467
+ "name": "aws_account_permission",
468
+ "schema": "",
469
+ "columns": {
470
+ "id": {
471
+ "name": "id",
472
+ "type": "text",
473
+ "primaryKey": true,
474
+ "notNull": true
475
+ },
476
+ "user_id": {
477
+ "name": "user_id",
478
+ "type": "text",
479
+ "primaryKey": false,
480
+ "notNull": true
481
+ },
482
+ "aws_account_id": {
483
+ "name": "aws_account_id",
484
+ "type": "text",
485
+ "primaryKey": false,
486
+ "notNull": true
487
+ },
488
+ "permissions": {
489
+ "name": "permissions",
490
+ "type": "json",
491
+ "primaryKey": false,
492
+ "notNull": true
493
+ },
494
+ "granted_by": {
495
+ "name": "granted_by",
496
+ "type": "text",
497
+ "primaryKey": false,
498
+ "notNull": true
499
+ },
500
+ "expires_at": {
501
+ "name": "expires_at",
502
+ "type": "timestamp",
503
+ "primaryKey": false,
504
+ "notNull": false
505
+ },
506
+ "created_at": {
507
+ "name": "created_at",
508
+ "type": "timestamp",
509
+ "primaryKey": false,
510
+ "notNull": true,
511
+ "default": "now()"
512
+ },
513
+ "updated_at": {
514
+ "name": "updated_at",
515
+ "type": "timestamp",
516
+ "primaryKey": false,
517
+ "notNull": true,
518
+ "default": "now()"
519
+ }
520
+ },
521
+ "indexes": {
522
+ "aws_account_permission_user_idx": {
523
+ "name": "aws_account_permission_user_idx",
524
+ "columns": [
525
+ {
526
+ "expression": "user_id",
527
+ "isExpression": false,
528
+ "asc": true,
529
+ "nulls": "last"
530
+ }
531
+ ],
532
+ "isUnique": false,
533
+ "concurrently": false,
534
+ "method": "btree",
535
+ "with": {}
536
+ },
537
+ "aws_account_permission_account_idx": {
538
+ "name": "aws_account_permission_account_idx",
539
+ "columns": [
540
+ {
541
+ "expression": "aws_account_id",
542
+ "isExpression": false,
543
+ "asc": true,
544
+ "nulls": "last"
545
+ }
546
+ ],
547
+ "isUnique": false,
548
+ "concurrently": false,
549
+ "method": "btree",
550
+ "with": {}
551
+ },
552
+ "aws_account_permission_unique_idx": {
553
+ "name": "aws_account_permission_unique_idx",
554
+ "columns": [
555
+ {
556
+ "expression": "user_id",
557
+ "isExpression": false,
558
+ "asc": true,
559
+ "nulls": "last"
560
+ },
561
+ {
562
+ "expression": "aws_account_id",
563
+ "isExpression": false,
564
+ "asc": true,
565
+ "nulls": "last"
566
+ }
567
+ ],
568
+ "isUnique": false,
569
+ "concurrently": false,
570
+ "method": "btree",
571
+ "with": {}
572
+ }
573
+ },
574
+ "foreignKeys": {
575
+ "aws_account_permission_user_id_user_id_fk": {
576
+ "name": "aws_account_permission_user_id_user_id_fk",
577
+ "tableFrom": "aws_account_permission",
578
+ "tableTo": "user",
579
+ "columnsFrom": ["user_id"],
580
+ "columnsTo": ["id"],
581
+ "onDelete": "cascade",
582
+ "onUpdate": "no action"
583
+ },
584
+ "aws_account_permission_aws_account_id_aws_account_id_fk": {
585
+ "name": "aws_account_permission_aws_account_id_aws_account_id_fk",
586
+ "tableFrom": "aws_account_permission",
587
+ "tableTo": "aws_account",
588
+ "columnsFrom": ["aws_account_id"],
589
+ "columnsTo": ["id"],
590
+ "onDelete": "cascade",
591
+ "onUpdate": "no action"
592
+ },
593
+ "aws_account_permission_granted_by_user_id_fk": {
594
+ "name": "aws_account_permission_granted_by_user_id_fk",
595
+ "tableFrom": "aws_account_permission",
596
+ "tableTo": "user",
597
+ "columnsFrom": ["granted_by"],
598
+ "columnsTo": ["id"],
599
+ "onDelete": "no action",
600
+ "onUpdate": "no action"
601
+ }
602
+ },
603
+ "compositePrimaryKeys": {},
604
+ "uniqueConstraints": {},
605
+ "policies": {},
606
+ "checkConstraints": {},
607
+ "isRLSEnabled": false
608
+ },
609
+ "public.email_template": {
610
+ "name": "email_template",
611
+ "schema": "",
612
+ "columns": {
613
+ "id": {
614
+ "name": "id",
615
+ "type": "text",
616
+ "primaryKey": true,
617
+ "notNull": true
618
+ },
619
+ "organization_id": {
620
+ "name": "organization_id",
621
+ "type": "text",
622
+ "primaryKey": false,
623
+ "notNull": true
624
+ },
625
+ "name": {
626
+ "name": "name",
627
+ "type": "text",
628
+ "primaryKey": false,
629
+ "notNull": true
630
+ },
631
+ "subject": {
632
+ "name": "subject",
633
+ "type": "text",
634
+ "primaryKey": false,
635
+ "notNull": false
636
+ },
637
+ "html": {
638
+ "name": "html",
639
+ "type": "text",
640
+ "primaryKey": false,
641
+ "notNull": false
642
+ },
643
+ "variables": {
644
+ "name": "variables",
645
+ "type": "json",
646
+ "primaryKey": false,
647
+ "notNull": false,
648
+ "default": "'[]'::json"
649
+ },
650
+ "created_by": {
651
+ "name": "created_by",
652
+ "type": "text",
653
+ "primaryKey": false,
654
+ "notNull": false
655
+ },
656
+ "created_at": {
657
+ "name": "created_at",
658
+ "type": "timestamp",
659
+ "primaryKey": false,
660
+ "notNull": true,
661
+ "default": "now()"
662
+ },
663
+ "updated_at": {
664
+ "name": "updated_at",
665
+ "type": "timestamp",
666
+ "primaryKey": false,
667
+ "notNull": true,
668
+ "default": "now()"
669
+ }
670
+ },
671
+ "indexes": {
672
+ "email_template_org_idx": {
673
+ "name": "email_template_org_idx",
674
+ "columns": [
675
+ {
676
+ "expression": "organization_id",
677
+ "isExpression": false,
678
+ "asc": true,
679
+ "nulls": "last"
680
+ }
681
+ ],
682
+ "isUnique": false,
683
+ "concurrently": false,
684
+ "method": "btree",
685
+ "with": {}
686
+ }
687
+ },
688
+ "foreignKeys": {
689
+ "email_template_organization_id_organization_id_fk": {
690
+ "name": "email_template_organization_id_organization_id_fk",
691
+ "tableFrom": "email_template",
692
+ "tableTo": "organization",
693
+ "columnsFrom": ["organization_id"],
694
+ "columnsTo": ["id"],
695
+ "onDelete": "cascade",
696
+ "onUpdate": "no action"
697
+ },
698
+ "email_template_created_by_user_id_fk": {
699
+ "name": "email_template_created_by_user_id_fk",
700
+ "tableFrom": "email_template",
701
+ "tableTo": "user",
702
+ "columnsFrom": ["created_by"],
703
+ "columnsTo": ["id"],
704
+ "onDelete": "no action",
705
+ "onUpdate": "no action"
706
+ }
707
+ },
708
+ "compositePrimaryKeys": {},
709
+ "uniqueConstraints": {},
710
+ "policies": {},
711
+ "checkConstraints": {},
712
+ "isRLSEnabled": false
713
+ },
714
+ "public.organization_extension": {
715
+ "name": "organization_extension",
716
+ "schema": "",
717
+ "columns": {
718
+ "organization_id": {
719
+ "name": "organization_id",
720
+ "type": "text",
721
+ "primaryKey": true,
722
+ "notNull": true
723
+ },
724
+ "aws_account_count": {
725
+ "name": "aws_account_count",
726
+ "type": "integer",
727
+ "primaryKey": false,
728
+ "notNull": true,
729
+ "default": 0
730
+ },
731
+ "member_count": {
732
+ "name": "member_count",
733
+ "type": "integer",
734
+ "primaryKey": false,
735
+ "notNull": true,
736
+ "default": 1
737
+ },
738
+ "onboarding_completed": {
739
+ "name": "onboarding_completed",
740
+ "type": "boolean",
741
+ "primaryKey": false,
742
+ "notNull": true,
743
+ "default": false
744
+ },
745
+ "onboarding_completed_at": {
746
+ "name": "onboarding_completed_at",
747
+ "type": "timestamp",
748
+ "primaryKey": false,
749
+ "notNull": false
750
+ },
751
+ "updated_at": {
752
+ "name": "updated_at",
753
+ "type": "timestamp",
754
+ "primaryKey": false,
755
+ "notNull": true,
756
+ "default": "now()"
757
+ }
758
+ },
759
+ "indexes": {},
760
+ "foreignKeys": {
761
+ "organization_extension_organization_id_organization_id_fk": {
762
+ "name": "organization_extension_organization_id_organization_id_fk",
763
+ "tableFrom": "organization_extension",
764
+ "tableTo": "organization",
765
+ "columnsFrom": ["organization_id"],
766
+ "columnsTo": ["id"],
767
+ "onDelete": "cascade",
768
+ "onUpdate": "no action"
769
+ }
770
+ },
771
+ "compositePrimaryKeys": {},
772
+ "uniqueConstraints": {},
773
+ "policies": {},
774
+ "checkConstraints": {},
775
+ "isRLSEnabled": false
776
+ },
777
+ "public.account": {
778
+ "name": "account",
779
+ "schema": "",
780
+ "columns": {
781
+ "id": {
782
+ "name": "id",
783
+ "type": "text",
784
+ "primaryKey": true,
785
+ "notNull": true
786
+ },
787
+ "account_id": {
788
+ "name": "account_id",
789
+ "type": "text",
790
+ "primaryKey": false,
791
+ "notNull": true
792
+ },
793
+ "provider_id": {
794
+ "name": "provider_id",
795
+ "type": "text",
796
+ "primaryKey": false,
797
+ "notNull": true
798
+ },
799
+ "user_id": {
800
+ "name": "user_id",
801
+ "type": "text",
802
+ "primaryKey": false,
803
+ "notNull": true
804
+ },
805
+ "access_token": {
806
+ "name": "access_token",
807
+ "type": "text",
808
+ "primaryKey": false,
809
+ "notNull": false
810
+ },
811
+ "refresh_token": {
812
+ "name": "refresh_token",
813
+ "type": "text",
814
+ "primaryKey": false,
815
+ "notNull": false
816
+ },
817
+ "id_token": {
818
+ "name": "id_token",
819
+ "type": "text",
820
+ "primaryKey": false,
821
+ "notNull": false
822
+ },
823
+ "access_token_expires_at": {
824
+ "name": "access_token_expires_at",
825
+ "type": "timestamp",
826
+ "primaryKey": false,
827
+ "notNull": false
828
+ },
829
+ "refresh_token_expires_at": {
830
+ "name": "refresh_token_expires_at",
831
+ "type": "timestamp",
832
+ "primaryKey": false,
833
+ "notNull": false
834
+ },
835
+ "scope": {
836
+ "name": "scope",
837
+ "type": "text",
838
+ "primaryKey": false,
839
+ "notNull": false
840
+ },
841
+ "password": {
842
+ "name": "password",
843
+ "type": "text",
844
+ "primaryKey": false,
845
+ "notNull": false
846
+ },
847
+ "created_at": {
848
+ "name": "created_at",
849
+ "type": "timestamp",
850
+ "primaryKey": false,
851
+ "notNull": true
852
+ },
853
+ "updated_at": {
854
+ "name": "updated_at",
855
+ "type": "timestamp",
856
+ "primaryKey": false,
857
+ "notNull": true
858
+ }
859
+ },
860
+ "indexes": {},
861
+ "foreignKeys": {
862
+ "account_user_id_user_id_fk": {
863
+ "name": "account_user_id_user_id_fk",
864
+ "tableFrom": "account",
865
+ "tableTo": "user",
866
+ "columnsFrom": ["user_id"],
867
+ "columnsTo": ["id"],
868
+ "onDelete": "cascade",
869
+ "onUpdate": "no action"
870
+ }
871
+ },
872
+ "compositePrimaryKeys": {},
873
+ "uniqueConstraints": {},
874
+ "policies": {},
875
+ "checkConstraints": {},
876
+ "isRLSEnabled": false
877
+ },
878
+ "public.invitation": {
879
+ "name": "invitation",
880
+ "schema": "",
881
+ "columns": {
882
+ "id": {
883
+ "name": "id",
884
+ "type": "text",
885
+ "primaryKey": true,
886
+ "notNull": true
887
+ },
888
+ "organization_id": {
889
+ "name": "organization_id",
890
+ "type": "text",
891
+ "primaryKey": false,
892
+ "notNull": true
893
+ },
894
+ "email": {
895
+ "name": "email",
896
+ "type": "text",
897
+ "primaryKey": false,
898
+ "notNull": true
899
+ },
900
+ "role": {
901
+ "name": "role",
902
+ "type": "text",
903
+ "primaryKey": false,
904
+ "notNull": false
905
+ },
906
+ "status": {
907
+ "name": "status",
908
+ "type": "text",
909
+ "primaryKey": false,
910
+ "notNull": true
911
+ },
912
+ "expires_at": {
913
+ "name": "expires_at",
914
+ "type": "timestamp",
915
+ "primaryKey": false,
916
+ "notNull": true
917
+ },
918
+ "inviter_id": {
919
+ "name": "inviter_id",
920
+ "type": "text",
921
+ "primaryKey": false,
922
+ "notNull": true
923
+ }
924
+ },
925
+ "indexes": {},
926
+ "foreignKeys": {
927
+ "invitation_organization_id_organization_id_fk": {
928
+ "name": "invitation_organization_id_organization_id_fk",
929
+ "tableFrom": "invitation",
930
+ "tableTo": "organization",
931
+ "columnsFrom": ["organization_id"],
932
+ "columnsTo": ["id"],
933
+ "onDelete": "cascade",
934
+ "onUpdate": "no action"
935
+ },
936
+ "invitation_inviter_id_user_id_fk": {
937
+ "name": "invitation_inviter_id_user_id_fk",
938
+ "tableFrom": "invitation",
939
+ "tableTo": "user",
940
+ "columnsFrom": ["inviter_id"],
941
+ "columnsTo": ["id"],
942
+ "onDelete": "cascade",
943
+ "onUpdate": "no action"
944
+ }
945
+ },
946
+ "compositePrimaryKeys": {},
947
+ "uniqueConstraints": {},
948
+ "policies": {},
949
+ "checkConstraints": {},
950
+ "isRLSEnabled": false
951
+ },
952
+ "public.member": {
953
+ "name": "member",
954
+ "schema": "",
955
+ "columns": {
956
+ "id": {
957
+ "name": "id",
958
+ "type": "text",
959
+ "primaryKey": true,
960
+ "notNull": true
961
+ },
962
+ "organization_id": {
963
+ "name": "organization_id",
964
+ "type": "text",
965
+ "primaryKey": false,
966
+ "notNull": true
967
+ },
968
+ "user_id": {
969
+ "name": "user_id",
970
+ "type": "text",
971
+ "primaryKey": false,
972
+ "notNull": true
973
+ },
974
+ "role": {
975
+ "name": "role",
976
+ "type": "text",
977
+ "primaryKey": false,
978
+ "notNull": true
979
+ },
980
+ "created_at": {
981
+ "name": "created_at",
982
+ "type": "timestamp",
983
+ "primaryKey": false,
984
+ "notNull": true
985
+ }
986
+ },
987
+ "indexes": {},
988
+ "foreignKeys": {
989
+ "member_organization_id_organization_id_fk": {
990
+ "name": "member_organization_id_organization_id_fk",
991
+ "tableFrom": "member",
992
+ "tableTo": "organization",
993
+ "columnsFrom": ["organization_id"],
994
+ "columnsTo": ["id"],
995
+ "onDelete": "cascade",
996
+ "onUpdate": "no action"
997
+ },
998
+ "member_user_id_user_id_fk": {
999
+ "name": "member_user_id_user_id_fk",
1000
+ "tableFrom": "member",
1001
+ "tableTo": "user",
1002
+ "columnsFrom": ["user_id"],
1003
+ "columnsTo": ["id"],
1004
+ "onDelete": "cascade",
1005
+ "onUpdate": "no action"
1006
+ }
1007
+ },
1008
+ "compositePrimaryKeys": {},
1009
+ "uniqueConstraints": {},
1010
+ "policies": {},
1011
+ "checkConstraints": {},
1012
+ "isRLSEnabled": false
1013
+ },
1014
+ "public.organization": {
1015
+ "name": "organization",
1016
+ "schema": "",
1017
+ "columns": {
1018
+ "id": {
1019
+ "name": "id",
1020
+ "type": "text",
1021
+ "primaryKey": true,
1022
+ "notNull": true
1023
+ },
1024
+ "name": {
1025
+ "name": "name",
1026
+ "type": "text",
1027
+ "primaryKey": false,
1028
+ "notNull": true
1029
+ },
1030
+ "slug": {
1031
+ "name": "slug",
1032
+ "type": "text",
1033
+ "primaryKey": false,
1034
+ "notNull": false
1035
+ },
1036
+ "logo": {
1037
+ "name": "logo",
1038
+ "type": "text",
1039
+ "primaryKey": false,
1040
+ "notNull": false
1041
+ },
1042
+ "brand_color": {
1043
+ "name": "brand_color",
1044
+ "type": "text",
1045
+ "primaryKey": false,
1046
+ "notNull": false
1047
+ },
1048
+ "metadata": {
1049
+ "name": "metadata",
1050
+ "type": "text",
1051
+ "primaryKey": false,
1052
+ "notNull": false
1053
+ },
1054
+ "created_at": {
1055
+ "name": "created_at",
1056
+ "type": "timestamp",
1057
+ "primaryKey": false,
1058
+ "notNull": true
1059
+ }
1060
+ },
1061
+ "indexes": {},
1062
+ "foreignKeys": {},
1063
+ "compositePrimaryKeys": {},
1064
+ "uniqueConstraints": {
1065
+ "organization_slug_unique": {
1066
+ "name": "organization_slug_unique",
1067
+ "nullsNotDistinct": false,
1068
+ "columns": ["slug"]
1069
+ }
1070
+ },
1071
+ "policies": {},
1072
+ "checkConstraints": {},
1073
+ "isRLSEnabled": false
1074
+ },
1075
+ "public.passkey": {
1076
+ "name": "passkey",
1077
+ "schema": "",
1078
+ "columns": {
1079
+ "id": {
1080
+ "name": "id",
1081
+ "type": "text",
1082
+ "primaryKey": true,
1083
+ "notNull": true
1084
+ },
1085
+ "name": {
1086
+ "name": "name",
1087
+ "type": "text",
1088
+ "primaryKey": false,
1089
+ "notNull": false
1090
+ },
1091
+ "public_key": {
1092
+ "name": "public_key",
1093
+ "type": "text",
1094
+ "primaryKey": false,
1095
+ "notNull": true
1096
+ },
1097
+ "user_id": {
1098
+ "name": "user_id",
1099
+ "type": "text",
1100
+ "primaryKey": false,
1101
+ "notNull": true
1102
+ },
1103
+ "credential_id": {
1104
+ "name": "credential_id",
1105
+ "type": "text",
1106
+ "primaryKey": false,
1107
+ "notNull": true
1108
+ },
1109
+ "counter": {
1110
+ "name": "counter",
1111
+ "type": "integer",
1112
+ "primaryKey": false,
1113
+ "notNull": true
1114
+ },
1115
+ "device_type": {
1116
+ "name": "device_type",
1117
+ "type": "text",
1118
+ "primaryKey": false,
1119
+ "notNull": true
1120
+ },
1121
+ "backed_up": {
1122
+ "name": "backed_up",
1123
+ "type": "boolean",
1124
+ "primaryKey": false,
1125
+ "notNull": true
1126
+ },
1127
+ "transports": {
1128
+ "name": "transports",
1129
+ "type": "text",
1130
+ "primaryKey": false,
1131
+ "notNull": false
1132
+ },
1133
+ "created_at": {
1134
+ "name": "created_at",
1135
+ "type": "timestamp",
1136
+ "primaryKey": false,
1137
+ "notNull": true
1138
+ },
1139
+ "aaguid": {
1140
+ "name": "aaguid",
1141
+ "type": "text",
1142
+ "primaryKey": false,
1143
+ "notNull": false
1144
+ }
1145
+ },
1146
+ "indexes": {},
1147
+ "foreignKeys": {
1148
+ "passkey_user_id_user_id_fk": {
1149
+ "name": "passkey_user_id_user_id_fk",
1150
+ "tableFrom": "passkey",
1151
+ "tableTo": "user",
1152
+ "columnsFrom": ["user_id"],
1153
+ "columnsTo": ["id"],
1154
+ "onDelete": "cascade",
1155
+ "onUpdate": "no action"
1156
+ }
1157
+ },
1158
+ "compositePrimaryKeys": {},
1159
+ "uniqueConstraints": {},
1160
+ "policies": {},
1161
+ "checkConstraints": {},
1162
+ "isRLSEnabled": false
1163
+ },
1164
+ "public.session": {
1165
+ "name": "session",
1166
+ "schema": "",
1167
+ "columns": {
1168
+ "id": {
1169
+ "name": "id",
1170
+ "type": "text",
1171
+ "primaryKey": true,
1172
+ "notNull": true
1173
+ },
1174
+ "expires_at": {
1175
+ "name": "expires_at",
1176
+ "type": "timestamp",
1177
+ "primaryKey": false,
1178
+ "notNull": true
1179
+ },
1180
+ "token": {
1181
+ "name": "token",
1182
+ "type": "text",
1183
+ "primaryKey": false,
1184
+ "notNull": true
1185
+ },
1186
+ "created_at": {
1187
+ "name": "created_at",
1188
+ "type": "timestamp",
1189
+ "primaryKey": false,
1190
+ "notNull": true
1191
+ },
1192
+ "updated_at": {
1193
+ "name": "updated_at",
1194
+ "type": "timestamp",
1195
+ "primaryKey": false,
1196
+ "notNull": true
1197
+ },
1198
+ "ip_address": {
1199
+ "name": "ip_address",
1200
+ "type": "text",
1201
+ "primaryKey": false,
1202
+ "notNull": false
1203
+ },
1204
+ "user_agent": {
1205
+ "name": "user_agent",
1206
+ "type": "text",
1207
+ "primaryKey": false,
1208
+ "notNull": false
1209
+ },
1210
+ "user_id": {
1211
+ "name": "user_id",
1212
+ "type": "text",
1213
+ "primaryKey": false,
1214
+ "notNull": true
1215
+ },
1216
+ "active_organization_id": {
1217
+ "name": "active_organization_id",
1218
+ "type": "text",
1219
+ "primaryKey": false,
1220
+ "notNull": false
1221
+ }
1222
+ },
1223
+ "indexes": {},
1224
+ "foreignKeys": {
1225
+ "session_user_id_user_id_fk": {
1226
+ "name": "session_user_id_user_id_fk",
1227
+ "tableFrom": "session",
1228
+ "tableTo": "user",
1229
+ "columnsFrom": ["user_id"],
1230
+ "columnsTo": ["id"],
1231
+ "onDelete": "cascade",
1232
+ "onUpdate": "no action"
1233
+ }
1234
+ },
1235
+ "compositePrimaryKeys": {},
1236
+ "uniqueConstraints": {
1237
+ "session_token_unique": {
1238
+ "name": "session_token_unique",
1239
+ "nullsNotDistinct": false,
1240
+ "columns": ["token"]
1241
+ }
1242
+ },
1243
+ "policies": {},
1244
+ "checkConstraints": {},
1245
+ "isRLSEnabled": false
1246
+ },
1247
+ "public.statement": {
1248
+ "name": "statement",
1249
+ "schema": "",
1250
+ "columns": {
1251
+ "id": {
1252
+ "name": "id",
1253
+ "type": "text",
1254
+ "primaryKey": true,
1255
+ "notNull": true
1256
+ },
1257
+ "user_id": {
1258
+ "name": "user_id",
1259
+ "type": "text",
1260
+ "primaryKey": false,
1261
+ "notNull": false
1262
+ },
1263
+ "organization_id": {
1264
+ "name": "organization_id",
1265
+ "type": "text",
1266
+ "primaryKey": false,
1267
+ "notNull": false
1268
+ },
1269
+ "role_id": {
1270
+ "name": "role_id",
1271
+ "type": "text",
1272
+ "primaryKey": false,
1273
+ "notNull": false
1274
+ },
1275
+ "effect": {
1276
+ "name": "effect",
1277
+ "type": "text",
1278
+ "primaryKey": false,
1279
+ "notNull": true
1280
+ },
1281
+ "action": {
1282
+ "name": "action",
1283
+ "type": "text",
1284
+ "primaryKey": false,
1285
+ "notNull": true
1286
+ },
1287
+ "resource": {
1288
+ "name": "resource",
1289
+ "type": "text",
1290
+ "primaryKey": false,
1291
+ "notNull": true
1292
+ },
1293
+ "condition": {
1294
+ "name": "condition",
1295
+ "type": "text",
1296
+ "primaryKey": false,
1297
+ "notNull": false
1298
+ },
1299
+ "expires_at": {
1300
+ "name": "expires_at",
1301
+ "type": "timestamp",
1302
+ "primaryKey": false,
1303
+ "notNull": false
1304
+ },
1305
+ "created_at": {
1306
+ "name": "created_at",
1307
+ "type": "timestamp",
1308
+ "primaryKey": false,
1309
+ "notNull": true
1310
+ },
1311
+ "updated_at": {
1312
+ "name": "updated_at",
1313
+ "type": "timestamp",
1314
+ "primaryKey": false,
1315
+ "notNull": true
1316
+ }
1317
+ },
1318
+ "indexes": {},
1319
+ "foreignKeys": {
1320
+ "statement_user_id_user_id_fk": {
1321
+ "name": "statement_user_id_user_id_fk",
1322
+ "tableFrom": "statement",
1323
+ "tableTo": "user",
1324
+ "columnsFrom": ["user_id"],
1325
+ "columnsTo": ["id"],
1326
+ "onDelete": "cascade",
1327
+ "onUpdate": "no action"
1328
+ },
1329
+ "statement_organization_id_organization_id_fk": {
1330
+ "name": "statement_organization_id_organization_id_fk",
1331
+ "tableFrom": "statement",
1332
+ "tableTo": "organization",
1333
+ "columnsFrom": ["organization_id"],
1334
+ "columnsTo": ["id"],
1335
+ "onDelete": "cascade",
1336
+ "onUpdate": "no action"
1337
+ }
1338
+ },
1339
+ "compositePrimaryKeys": {},
1340
+ "uniqueConstraints": {},
1341
+ "policies": {},
1342
+ "checkConstraints": {},
1343
+ "isRLSEnabled": false
1344
+ },
1345
+ "public.subscription": {
1346
+ "name": "subscription",
1347
+ "schema": "",
1348
+ "columns": {
1349
+ "id": {
1350
+ "name": "id",
1351
+ "type": "text",
1352
+ "primaryKey": true,
1353
+ "notNull": true
1354
+ },
1355
+ "plan": {
1356
+ "name": "plan",
1357
+ "type": "text",
1358
+ "primaryKey": false,
1359
+ "notNull": true
1360
+ },
1361
+ "reference_id": {
1362
+ "name": "reference_id",
1363
+ "type": "text",
1364
+ "primaryKey": false,
1365
+ "notNull": true
1366
+ },
1367
+ "stripe_customer_id": {
1368
+ "name": "stripe_customer_id",
1369
+ "type": "text",
1370
+ "primaryKey": false,
1371
+ "notNull": false
1372
+ },
1373
+ "stripe_subscription_id": {
1374
+ "name": "stripe_subscription_id",
1375
+ "type": "text",
1376
+ "primaryKey": false,
1377
+ "notNull": false
1378
+ },
1379
+ "status": {
1380
+ "name": "status",
1381
+ "type": "text",
1382
+ "primaryKey": false,
1383
+ "notNull": true
1384
+ },
1385
+ "period_start": {
1386
+ "name": "period_start",
1387
+ "type": "timestamp",
1388
+ "primaryKey": false,
1389
+ "notNull": false
1390
+ },
1391
+ "period_end": {
1392
+ "name": "period_end",
1393
+ "type": "timestamp",
1394
+ "primaryKey": false,
1395
+ "notNull": false
1396
+ },
1397
+ "cancel_at_period_end": {
1398
+ "name": "cancel_at_period_end",
1399
+ "type": "boolean",
1400
+ "primaryKey": false,
1401
+ "notNull": false
1402
+ },
1403
+ "seats": {
1404
+ "name": "seats",
1405
+ "type": "integer",
1406
+ "primaryKey": false,
1407
+ "notNull": false
1408
+ },
1409
+ "trial_start": {
1410
+ "name": "trial_start",
1411
+ "type": "timestamp",
1412
+ "primaryKey": false,
1413
+ "notNull": false
1414
+ },
1415
+ "trial_end": {
1416
+ "name": "trial_end",
1417
+ "type": "timestamp",
1418
+ "primaryKey": false,
1419
+ "notNull": false
1420
+ },
1421
+ "created_at": {
1422
+ "name": "created_at",
1423
+ "type": "timestamp",
1424
+ "primaryKey": false,
1425
+ "notNull": true,
1426
+ "default": "now()"
1427
+ },
1428
+ "updated_at": {
1429
+ "name": "updated_at",
1430
+ "type": "timestamp",
1431
+ "primaryKey": false,
1432
+ "notNull": true,
1433
+ "default": "now()"
1434
+ }
1435
+ },
1436
+ "indexes": {},
1437
+ "foreignKeys": {},
1438
+ "compositePrimaryKeys": {},
1439
+ "uniqueConstraints": {},
1440
+ "policies": {},
1441
+ "checkConstraints": {},
1442
+ "isRLSEnabled": false
1443
+ },
1444
+ "public.two_factor": {
1445
+ "name": "two_factor",
1446
+ "schema": "",
1447
+ "columns": {
1448
+ "id": {
1449
+ "name": "id",
1450
+ "type": "text",
1451
+ "primaryKey": true,
1452
+ "notNull": true
1453
+ },
1454
+ "secret": {
1455
+ "name": "secret",
1456
+ "type": "text",
1457
+ "primaryKey": false,
1458
+ "notNull": true
1459
+ },
1460
+ "backup_codes": {
1461
+ "name": "backup_codes",
1462
+ "type": "text",
1463
+ "primaryKey": false,
1464
+ "notNull": true
1465
+ },
1466
+ "user_id": {
1467
+ "name": "user_id",
1468
+ "type": "text",
1469
+ "primaryKey": false,
1470
+ "notNull": true
1471
+ }
1472
+ },
1473
+ "indexes": {},
1474
+ "foreignKeys": {
1475
+ "two_factor_user_id_user_id_fk": {
1476
+ "name": "two_factor_user_id_user_id_fk",
1477
+ "tableFrom": "two_factor",
1478
+ "tableTo": "user",
1479
+ "columnsFrom": ["user_id"],
1480
+ "columnsTo": ["id"],
1481
+ "onDelete": "cascade",
1482
+ "onUpdate": "no action"
1483
+ }
1484
+ },
1485
+ "compositePrimaryKeys": {},
1486
+ "uniqueConstraints": {},
1487
+ "policies": {},
1488
+ "checkConstraints": {},
1489
+ "isRLSEnabled": false
1490
+ },
1491
+ "public.user": {
1492
+ "name": "user",
1493
+ "schema": "",
1494
+ "columns": {
1495
+ "id": {
1496
+ "name": "id",
1497
+ "type": "text",
1498
+ "primaryKey": true,
1499
+ "notNull": true
1500
+ },
1501
+ "name": {
1502
+ "name": "name",
1503
+ "type": "text",
1504
+ "primaryKey": false,
1505
+ "notNull": true
1506
+ },
1507
+ "email": {
1508
+ "name": "email",
1509
+ "type": "text",
1510
+ "primaryKey": false,
1511
+ "notNull": true
1512
+ },
1513
+ "email_verified": {
1514
+ "name": "email_verified",
1515
+ "type": "boolean",
1516
+ "primaryKey": false,
1517
+ "notNull": true
1518
+ },
1519
+ "image": {
1520
+ "name": "image",
1521
+ "type": "text",
1522
+ "primaryKey": false,
1523
+ "notNull": false
1524
+ },
1525
+ "created_at": {
1526
+ "name": "created_at",
1527
+ "type": "timestamp",
1528
+ "primaryKey": false,
1529
+ "notNull": true
1530
+ },
1531
+ "updated_at": {
1532
+ "name": "updated_at",
1533
+ "type": "timestamp",
1534
+ "primaryKey": false,
1535
+ "notNull": true
1536
+ },
1537
+ "two_factor_enabled": {
1538
+ "name": "two_factor_enabled",
1539
+ "type": "boolean",
1540
+ "primaryKey": false,
1541
+ "notNull": false
1542
+ },
1543
+ "last_login_method": {
1544
+ "name": "last_login_method",
1545
+ "type": "text",
1546
+ "primaryKey": false,
1547
+ "notNull": false
1548
+ },
1549
+ "stripe_customer_id": {
1550
+ "name": "stripe_customer_id",
1551
+ "type": "text",
1552
+ "primaryKey": false,
1553
+ "notNull": false
1554
+ }
1555
+ },
1556
+ "indexes": {},
1557
+ "foreignKeys": {},
1558
+ "compositePrimaryKeys": {},
1559
+ "uniqueConstraints": {
1560
+ "user_email_unique": {
1561
+ "name": "user_email_unique",
1562
+ "nullsNotDistinct": false,
1563
+ "columns": ["email"]
1564
+ }
1565
+ },
1566
+ "policies": {},
1567
+ "checkConstraints": {},
1568
+ "isRLSEnabled": false
1569
+ },
1570
+ "public.verification": {
1571
+ "name": "verification",
1572
+ "schema": "",
1573
+ "columns": {
1574
+ "id": {
1575
+ "name": "id",
1576
+ "type": "text",
1577
+ "primaryKey": true,
1578
+ "notNull": true
1579
+ },
1580
+ "identifier": {
1581
+ "name": "identifier",
1582
+ "type": "text",
1583
+ "primaryKey": false,
1584
+ "notNull": true
1585
+ },
1586
+ "value": {
1587
+ "name": "value",
1588
+ "type": "text",
1589
+ "primaryKey": false,
1590
+ "notNull": true
1591
+ },
1592
+ "expires_at": {
1593
+ "name": "expires_at",
1594
+ "type": "timestamp",
1595
+ "primaryKey": false,
1596
+ "notNull": true
1597
+ },
1598
+ "created_at": {
1599
+ "name": "created_at",
1600
+ "type": "timestamp",
1601
+ "primaryKey": false,
1602
+ "notNull": false
1603
+ },
1604
+ "updated_at": {
1605
+ "name": "updated_at",
1606
+ "type": "timestamp",
1607
+ "primaryKey": false,
1608
+ "notNull": false
1609
+ }
1610
+ },
1611
+ "indexes": {},
1612
+ "foreignKeys": {},
1613
+ "compositePrimaryKeys": {},
1614
+ "uniqueConstraints": {},
1615
+ "policies": {},
1616
+ "checkConstraints": {},
1617
+ "isRLSEnabled": false
1618
+ },
1619
+ "public.batch_send": {
1620
+ "name": "batch_send",
1621
+ "schema": "",
1622
+ "columns": {
1623
+ "id": {
1624
+ "name": "id",
1625
+ "type": "text",
1626
+ "primaryKey": true,
1627
+ "notNull": true
1628
+ },
1629
+ "organization_id": {
1630
+ "name": "organization_id",
1631
+ "type": "text",
1632
+ "primaryKey": false,
1633
+ "notNull": true
1634
+ },
1635
+ "aws_account_id": {
1636
+ "name": "aws_account_id",
1637
+ "type": "text",
1638
+ "primaryKey": false,
1639
+ "notNull": false
1640
+ },
1641
+ "name": {
1642
+ "name": "name",
1643
+ "type": "text",
1644
+ "primaryKey": false,
1645
+ "notNull": false
1646
+ },
1647
+ "channel": {
1648
+ "name": "channel",
1649
+ "type": "text",
1650
+ "primaryKey": false,
1651
+ "notNull": true,
1652
+ "default": "'email'"
1653
+ },
1654
+ "subject": {
1655
+ "name": "subject",
1656
+ "type": "text",
1657
+ "primaryKey": false,
1658
+ "notNull": false
1659
+ },
1660
+ "preview_text": {
1661
+ "name": "preview_text",
1662
+ "type": "text",
1663
+ "primaryKey": false,
1664
+ "notNull": false
1665
+ },
1666
+ "from": {
1667
+ "name": "from",
1668
+ "type": "text",
1669
+ "primaryKey": false,
1670
+ "notNull": false
1671
+ },
1672
+ "from_name": {
1673
+ "name": "from_name",
1674
+ "type": "text",
1675
+ "primaryKey": false,
1676
+ "notNull": false
1677
+ },
1678
+ "reply_to": {
1679
+ "name": "reply_to",
1680
+ "type": "text",
1681
+ "primaryKey": false,
1682
+ "notNull": false
1683
+ },
1684
+ "email_template_id": {
1685
+ "name": "email_template_id",
1686
+ "type": "text",
1687
+ "primaryKey": false,
1688
+ "notNull": false
1689
+ },
1690
+ "html_content": {
1691
+ "name": "html_content",
1692
+ "type": "text",
1693
+ "primaryKey": false,
1694
+ "notNull": false
1695
+ },
1696
+ "text_content": {
1697
+ "name": "text_content",
1698
+ "type": "text",
1699
+ "primaryKey": false,
1700
+ "notNull": false
1701
+ },
1702
+ "body": {
1703
+ "name": "body",
1704
+ "type": "text",
1705
+ "primaryKey": false,
1706
+ "notNull": false
1707
+ },
1708
+ "sender_id": {
1709
+ "name": "sender_id",
1710
+ "type": "text",
1711
+ "primaryKey": false,
1712
+ "notNull": false
1713
+ },
1714
+ "status": {
1715
+ "name": "status",
1716
+ "type": "batch_send_status",
1717
+ "typeSchema": "public",
1718
+ "primaryKey": false,
1719
+ "notNull": true,
1720
+ "default": "'draft'"
1721
+ },
1722
+ "total_recipients": {
1723
+ "name": "total_recipients",
1724
+ "type": "integer",
1725
+ "primaryKey": false,
1726
+ "notNull": true,
1727
+ "default": 0
1728
+ },
1729
+ "processed_recipients": {
1730
+ "name": "processed_recipients",
1731
+ "type": "integer",
1732
+ "primaryKey": false,
1733
+ "notNull": true,
1734
+ "default": 0
1735
+ },
1736
+ "sent": {
1737
+ "name": "sent",
1738
+ "type": "integer",
1739
+ "primaryKey": false,
1740
+ "notNull": true,
1741
+ "default": 0
1742
+ },
1743
+ "delivered": {
1744
+ "name": "delivered",
1745
+ "type": "integer",
1746
+ "primaryKey": false,
1747
+ "notNull": true,
1748
+ "default": 0
1749
+ },
1750
+ "failed": {
1751
+ "name": "failed",
1752
+ "type": "integer",
1753
+ "primaryKey": false,
1754
+ "notNull": true,
1755
+ "default": 0
1756
+ },
1757
+ "opened": {
1758
+ "name": "opened",
1759
+ "type": "integer",
1760
+ "primaryKey": false,
1761
+ "notNull": true,
1762
+ "default": 0
1763
+ },
1764
+ "clicked": {
1765
+ "name": "clicked",
1766
+ "type": "integer",
1767
+ "primaryKey": false,
1768
+ "notNull": true,
1769
+ "default": 0
1770
+ },
1771
+ "bounced": {
1772
+ "name": "bounced",
1773
+ "type": "integer",
1774
+ "primaryKey": false,
1775
+ "notNull": true,
1776
+ "default": 0
1777
+ },
1778
+ "complained": {
1779
+ "name": "complained",
1780
+ "type": "integer",
1781
+ "primaryKey": false,
1782
+ "notNull": true,
1783
+ "default": 0
1784
+ },
1785
+ "sms_segments": {
1786
+ "name": "sms_segments",
1787
+ "type": "integer",
1788
+ "primaryKey": false,
1789
+ "notNull": true,
1790
+ "default": 0
1791
+ },
1792
+ "sms_opted_out": {
1793
+ "name": "sms_opted_out",
1794
+ "type": "integer",
1795
+ "primaryKey": false,
1796
+ "notNull": true,
1797
+ "default": 0
1798
+ },
1799
+ "error_message": {
1800
+ "name": "error_message",
1801
+ "type": "text",
1802
+ "primaryKey": false,
1803
+ "notNull": false
1804
+ },
1805
+ "error_details": {
1806
+ "name": "error_details",
1807
+ "type": "json",
1808
+ "primaryKey": false,
1809
+ "notNull": false
1810
+ },
1811
+ "scheduled_for": {
1812
+ "name": "scheduled_for",
1813
+ "type": "timestamp",
1814
+ "primaryKey": false,
1815
+ "notNull": false
1816
+ },
1817
+ "started_at": {
1818
+ "name": "started_at",
1819
+ "type": "timestamp",
1820
+ "primaryKey": false,
1821
+ "notNull": false
1822
+ },
1823
+ "completed_at": {
1824
+ "name": "completed_at",
1825
+ "type": "timestamp",
1826
+ "primaryKey": false,
1827
+ "notNull": false
1828
+ },
1829
+ "created_by": {
1830
+ "name": "created_by",
1831
+ "type": "text",
1832
+ "primaryKey": false,
1833
+ "notNull": false
1834
+ },
1835
+ "created_at": {
1836
+ "name": "created_at",
1837
+ "type": "timestamp",
1838
+ "primaryKey": false,
1839
+ "notNull": true,
1840
+ "default": "now()"
1841
+ },
1842
+ "updated_at": {
1843
+ "name": "updated_at",
1844
+ "type": "timestamp",
1845
+ "primaryKey": false,
1846
+ "notNull": true,
1847
+ "default": "now()"
1848
+ }
1849
+ },
1850
+ "indexes": {
1851
+ "batch_send_org_idx": {
1852
+ "name": "batch_send_org_idx",
1853
+ "columns": [
1854
+ {
1855
+ "expression": "organization_id",
1856
+ "isExpression": false,
1857
+ "asc": true,
1858
+ "nulls": "last"
1859
+ }
1860
+ ],
1861
+ "isUnique": false,
1862
+ "concurrently": false,
1863
+ "method": "btree",
1864
+ "with": {}
1865
+ },
1866
+ "batch_send_channel_idx": {
1867
+ "name": "batch_send_channel_idx",
1868
+ "columns": [
1869
+ {
1870
+ "expression": "channel",
1871
+ "isExpression": false,
1872
+ "asc": true,
1873
+ "nulls": "last"
1874
+ }
1875
+ ],
1876
+ "isUnique": false,
1877
+ "concurrently": false,
1878
+ "method": "btree",
1879
+ "with": {}
1880
+ },
1881
+ "batch_send_status_idx": {
1882
+ "name": "batch_send_status_idx",
1883
+ "columns": [
1884
+ {
1885
+ "expression": "organization_id",
1886
+ "isExpression": false,
1887
+ "asc": true,
1888
+ "nulls": "last"
1889
+ },
1890
+ {
1891
+ "expression": "status",
1892
+ "isExpression": false,
1893
+ "asc": true,
1894
+ "nulls": "last"
1895
+ }
1896
+ ],
1897
+ "isUnique": false,
1898
+ "concurrently": false,
1899
+ "method": "btree",
1900
+ "with": {}
1901
+ },
1902
+ "batch_send_created_at_idx": {
1903
+ "name": "batch_send_created_at_idx",
1904
+ "columns": [
1905
+ {
1906
+ "expression": "organization_id",
1907
+ "isExpression": false,
1908
+ "asc": true,
1909
+ "nulls": "last"
1910
+ },
1911
+ {
1912
+ "expression": "created_at",
1913
+ "isExpression": false,
1914
+ "asc": true,
1915
+ "nulls": "last"
1916
+ }
1917
+ ],
1918
+ "isUnique": false,
1919
+ "concurrently": false,
1920
+ "method": "btree",
1921
+ "with": {}
1922
+ }
1923
+ },
1924
+ "foreignKeys": {
1925
+ "batch_send_organization_id_organization_id_fk": {
1926
+ "name": "batch_send_organization_id_organization_id_fk",
1927
+ "tableFrom": "batch_send",
1928
+ "tableTo": "organization",
1929
+ "columnsFrom": ["organization_id"],
1930
+ "columnsTo": ["id"],
1931
+ "onDelete": "cascade",
1932
+ "onUpdate": "no action"
1933
+ },
1934
+ "batch_send_aws_account_id_aws_account_id_fk": {
1935
+ "name": "batch_send_aws_account_id_aws_account_id_fk",
1936
+ "tableFrom": "batch_send",
1937
+ "tableTo": "aws_account",
1938
+ "columnsFrom": ["aws_account_id"],
1939
+ "columnsTo": ["id"],
1940
+ "onDelete": "set null",
1941
+ "onUpdate": "no action"
1942
+ },
1943
+ "batch_send_email_template_id_template_id_fk": {
1944
+ "name": "batch_send_email_template_id_template_id_fk",
1945
+ "tableFrom": "batch_send",
1946
+ "tableTo": "template",
1947
+ "columnsFrom": ["email_template_id"],
1948
+ "columnsTo": ["id"],
1949
+ "onDelete": "set null",
1950
+ "onUpdate": "no action"
1951
+ },
1952
+ "batch_send_created_by_user_id_fk": {
1953
+ "name": "batch_send_created_by_user_id_fk",
1954
+ "tableFrom": "batch_send",
1955
+ "tableTo": "user",
1956
+ "columnsFrom": ["created_by"],
1957
+ "columnsTo": ["id"],
1958
+ "onDelete": "set null",
1959
+ "onUpdate": "no action"
1960
+ }
1961
+ },
1962
+ "compositePrimaryKeys": {},
1963
+ "uniqueConstraints": {},
1964
+ "policies": {},
1965
+ "checkConstraints": {},
1966
+ "isRLSEnabled": false
1967
+ },
1968
+ "public.message_send": {
1969
+ "name": "message_send",
1970
+ "schema": "",
1971
+ "columns": {
1972
+ "id": {
1973
+ "name": "id",
1974
+ "type": "text",
1975
+ "primaryKey": true,
1976
+ "notNull": true
1977
+ },
1978
+ "organization_id": {
1979
+ "name": "organization_id",
1980
+ "type": "text",
1981
+ "primaryKey": false,
1982
+ "notNull": true
1983
+ },
1984
+ "contact_id": {
1985
+ "name": "contact_id",
1986
+ "type": "text",
1987
+ "primaryKey": false,
1988
+ "notNull": false
1989
+ },
1990
+ "aws_account_id": {
1991
+ "name": "aws_account_id",
1992
+ "type": "text",
1993
+ "primaryKey": false,
1994
+ "notNull": true
1995
+ },
1996
+ "channel": {
1997
+ "name": "channel",
1998
+ "type": "text",
1999
+ "primaryKey": false,
2000
+ "notNull": true,
2001
+ "default": "'email'"
2002
+ },
2003
+ "source_type": {
2004
+ "name": "source_type",
2005
+ "type": "message_source_type",
2006
+ "typeSchema": "public",
2007
+ "primaryKey": false,
2008
+ "notNull": true
2009
+ },
2010
+ "batch_send_id": {
2011
+ "name": "batch_send_id",
2012
+ "type": "text",
2013
+ "primaryKey": false,
2014
+ "notNull": false
2015
+ },
2016
+ "recipient": {
2017
+ "name": "recipient",
2018
+ "type": "text",
2019
+ "primaryKey": false,
2020
+ "notNull": true
2021
+ },
2022
+ "subject": {
2023
+ "name": "subject",
2024
+ "type": "text",
2025
+ "primaryKey": false,
2026
+ "notNull": false
2027
+ },
2028
+ "from": {
2029
+ "name": "from",
2030
+ "type": "text",
2031
+ "primaryKey": false,
2032
+ "notNull": false
2033
+ },
2034
+ "from_name": {
2035
+ "name": "from_name",
2036
+ "type": "text",
2037
+ "primaryKey": false,
2038
+ "notNull": false
2039
+ },
2040
+ "email_template_id": {
2041
+ "name": "email_template_id",
2042
+ "type": "text",
2043
+ "primaryKey": false,
2044
+ "notNull": false
2045
+ },
2046
+ "body": {
2047
+ "name": "body",
2048
+ "type": "text",
2049
+ "primaryKey": false,
2050
+ "notNull": false
2051
+ },
2052
+ "sender_id": {
2053
+ "name": "sender_id",
2054
+ "type": "text",
2055
+ "primaryKey": false,
2056
+ "notNull": false
2057
+ },
2058
+ "sms_segment_count": {
2059
+ "name": "sms_segment_count",
2060
+ "type": "integer",
2061
+ "primaryKey": false,
2062
+ "notNull": false
2063
+ },
2064
+ "variables": {
2065
+ "name": "variables",
2066
+ "type": "json",
2067
+ "primaryKey": false,
2068
+ "notNull": false,
2069
+ "default": "'{}'::json"
2070
+ },
2071
+ "message_id": {
2072
+ "name": "message_id",
2073
+ "type": "text",
2074
+ "primaryKey": false,
2075
+ "notNull": false
2076
+ },
2077
+ "status": {
2078
+ "name": "status",
2079
+ "type": "message_send_status",
2080
+ "typeSchema": "public",
2081
+ "primaryKey": false,
2082
+ "notNull": true,
2083
+ "default": "'pending'"
2084
+ },
2085
+ "sent_at": {
2086
+ "name": "sent_at",
2087
+ "type": "timestamp",
2088
+ "primaryKey": false,
2089
+ "notNull": false
2090
+ },
2091
+ "delivered_at": {
2092
+ "name": "delivered_at",
2093
+ "type": "timestamp",
2094
+ "primaryKey": false,
2095
+ "notNull": false
2096
+ },
2097
+ "opened_at": {
2098
+ "name": "opened_at",
2099
+ "type": "timestamp",
2100
+ "primaryKey": false,
2101
+ "notNull": false
2102
+ },
2103
+ "clicked_at": {
2104
+ "name": "clicked_at",
2105
+ "type": "timestamp",
2106
+ "primaryKey": false,
2107
+ "notNull": false
2108
+ },
2109
+ "bounced_at": {
2110
+ "name": "bounced_at",
2111
+ "type": "timestamp",
2112
+ "primaryKey": false,
2113
+ "notNull": false
2114
+ },
2115
+ "complained_at": {
2116
+ "name": "complained_at",
2117
+ "type": "timestamp",
2118
+ "primaryKey": false,
2119
+ "notNull": false
2120
+ },
2121
+ "opted_out_at": {
2122
+ "name": "opted_out_at",
2123
+ "type": "timestamp",
2124
+ "primaryKey": false,
2125
+ "notNull": false
2126
+ },
2127
+ "error": {
2128
+ "name": "error",
2129
+ "type": "text",
2130
+ "primaryKey": false,
2131
+ "notNull": false
2132
+ },
2133
+ "bounce_type": {
2134
+ "name": "bounce_type",
2135
+ "type": "text",
2136
+ "primaryKey": false,
2137
+ "notNull": false
2138
+ },
2139
+ "bounce_sub_type": {
2140
+ "name": "bounce_sub_type",
2141
+ "type": "text",
2142
+ "primaryKey": false,
2143
+ "notNull": false
2144
+ },
2145
+ "created_at": {
2146
+ "name": "created_at",
2147
+ "type": "timestamp",
2148
+ "primaryKey": false,
2149
+ "notNull": true,
2150
+ "default": "now()"
2151
+ }
2152
+ },
2153
+ "indexes": {
2154
+ "message_send_org_idx": {
2155
+ "name": "message_send_org_idx",
2156
+ "columns": [
2157
+ {
2158
+ "expression": "organization_id",
2159
+ "isExpression": false,
2160
+ "asc": true,
2161
+ "nulls": "last"
2162
+ }
2163
+ ],
2164
+ "isUnique": false,
2165
+ "concurrently": false,
2166
+ "method": "btree",
2167
+ "with": {}
2168
+ },
2169
+ "message_send_contact_idx": {
2170
+ "name": "message_send_contact_idx",
2171
+ "columns": [
2172
+ {
2173
+ "expression": "contact_id",
2174
+ "isExpression": false,
2175
+ "asc": true,
2176
+ "nulls": "last"
2177
+ }
2178
+ ],
2179
+ "isUnique": false,
2180
+ "concurrently": false,
2181
+ "method": "btree",
2182
+ "with": {}
2183
+ },
2184
+ "message_send_channel_idx": {
2185
+ "name": "message_send_channel_idx",
2186
+ "columns": [
2187
+ {
2188
+ "expression": "channel",
2189
+ "isExpression": false,
2190
+ "asc": true,
2191
+ "nulls": "last"
2192
+ }
2193
+ ],
2194
+ "isUnique": false,
2195
+ "concurrently": false,
2196
+ "method": "btree",
2197
+ "with": {}
2198
+ },
2199
+ "message_send_batch_idx": {
2200
+ "name": "message_send_batch_idx",
2201
+ "columns": [
2202
+ {
2203
+ "expression": "batch_send_id",
2204
+ "isExpression": false,
2205
+ "asc": true,
2206
+ "nulls": "last"
2207
+ }
2208
+ ],
2209
+ "isUnique": false,
2210
+ "concurrently": false,
2211
+ "method": "btree",
2212
+ "with": {}
2213
+ },
2214
+ "message_send_status_idx": {
2215
+ "name": "message_send_status_idx",
2216
+ "columns": [
2217
+ {
2218
+ "expression": "batch_send_id",
2219
+ "isExpression": false,
2220
+ "asc": true,
2221
+ "nulls": "last"
2222
+ },
2223
+ {
2224
+ "expression": "status",
2225
+ "isExpression": false,
2226
+ "asc": true,
2227
+ "nulls": "last"
2228
+ }
2229
+ ],
2230
+ "isUnique": false,
2231
+ "concurrently": false,
2232
+ "method": "btree",
2233
+ "with": {}
2234
+ },
2235
+ "message_send_message_id_idx": {
2236
+ "name": "message_send_message_id_idx",
2237
+ "columns": [
2238
+ {
2239
+ "expression": "message_id",
2240
+ "isExpression": false,
2241
+ "asc": true,
2242
+ "nulls": "last"
2243
+ }
2244
+ ],
2245
+ "isUnique": true,
2246
+ "concurrently": false,
2247
+ "method": "btree",
2248
+ "with": {}
2249
+ },
2250
+ "message_send_source_type_idx": {
2251
+ "name": "message_send_source_type_idx",
2252
+ "columns": [
2253
+ {
2254
+ "expression": "source_type",
2255
+ "isExpression": false,
2256
+ "asc": true,
2257
+ "nulls": "last"
2258
+ }
2259
+ ],
2260
+ "isUnique": false,
2261
+ "concurrently": false,
2262
+ "method": "btree",
2263
+ "with": {}
2264
+ },
2265
+ "message_send_created_at_idx": {
2266
+ "name": "message_send_created_at_idx",
2267
+ "columns": [
2268
+ {
2269
+ "expression": "created_at",
2270
+ "isExpression": false,
2271
+ "asc": true,
2272
+ "nulls": "last"
2273
+ }
2274
+ ],
2275
+ "isUnique": false,
2276
+ "concurrently": false,
2277
+ "method": "btree",
2278
+ "with": {}
2279
+ }
2280
+ },
2281
+ "foreignKeys": {
2282
+ "message_send_organization_id_organization_id_fk": {
2283
+ "name": "message_send_organization_id_organization_id_fk",
2284
+ "tableFrom": "message_send",
2285
+ "tableTo": "organization",
2286
+ "columnsFrom": ["organization_id"],
2287
+ "columnsTo": ["id"],
2288
+ "onDelete": "cascade",
2289
+ "onUpdate": "no action"
2290
+ },
2291
+ "message_send_contact_id_contact_id_fk": {
2292
+ "name": "message_send_contact_id_contact_id_fk",
2293
+ "tableFrom": "message_send",
2294
+ "tableTo": "contact",
2295
+ "columnsFrom": ["contact_id"],
2296
+ "columnsTo": ["id"],
2297
+ "onDelete": "set null",
2298
+ "onUpdate": "no action"
2299
+ },
2300
+ "message_send_aws_account_id_aws_account_id_fk": {
2301
+ "name": "message_send_aws_account_id_aws_account_id_fk",
2302
+ "tableFrom": "message_send",
2303
+ "tableTo": "aws_account",
2304
+ "columnsFrom": ["aws_account_id"],
2305
+ "columnsTo": ["id"],
2306
+ "onDelete": "set null",
2307
+ "onUpdate": "no action"
2308
+ },
2309
+ "message_send_batch_send_id_batch_send_id_fk": {
2310
+ "name": "message_send_batch_send_id_batch_send_id_fk",
2311
+ "tableFrom": "message_send",
2312
+ "tableTo": "batch_send",
2313
+ "columnsFrom": ["batch_send_id"],
2314
+ "columnsTo": ["id"],
2315
+ "onDelete": "set null",
2316
+ "onUpdate": "no action"
2317
+ },
2318
+ "message_send_email_template_id_template_id_fk": {
2319
+ "name": "message_send_email_template_id_template_id_fk",
2320
+ "tableFrom": "message_send",
2321
+ "tableTo": "template",
2322
+ "columnsFrom": ["email_template_id"],
2323
+ "columnsTo": ["id"],
2324
+ "onDelete": "set null",
2325
+ "onUpdate": "no action"
2326
+ }
2327
+ },
2328
+ "compositePrimaryKeys": {},
2329
+ "uniqueConstraints": {},
2330
+ "policies": {},
2331
+ "checkConstraints": {},
2332
+ "isRLSEnabled": false
2333
+ },
2334
+ "public.contact": {
2335
+ "name": "contact",
2336
+ "schema": "",
2337
+ "columns": {
2338
+ "id": {
2339
+ "name": "id",
2340
+ "type": "text",
2341
+ "primaryKey": true,
2342
+ "notNull": true
2343
+ },
2344
+ "organization_id": {
2345
+ "name": "organization_id",
2346
+ "type": "text",
2347
+ "primaryKey": false,
2348
+ "notNull": true
2349
+ },
2350
+ "email": {
2351
+ "name": "email",
2352
+ "type": "text",
2353
+ "primaryKey": false,
2354
+ "notNull": false
2355
+ },
2356
+ "email_hash": {
2357
+ "name": "email_hash",
2358
+ "type": "text",
2359
+ "primaryKey": false,
2360
+ "notNull": false
2361
+ },
2362
+ "email_status": {
2363
+ "name": "email_status",
2364
+ "type": "text",
2365
+ "primaryKey": false,
2366
+ "notNull": false
2367
+ },
2368
+ "email_verified_at": {
2369
+ "name": "email_verified_at",
2370
+ "type": "timestamp",
2371
+ "primaryKey": false,
2372
+ "notNull": false
2373
+ },
2374
+ "email_unsubscribed_at": {
2375
+ "name": "email_unsubscribed_at",
2376
+ "type": "timestamp",
2377
+ "primaryKey": false,
2378
+ "notNull": false
2379
+ },
2380
+ "email_bounced_at": {
2381
+ "name": "email_bounced_at",
2382
+ "type": "timestamp",
2383
+ "primaryKey": false,
2384
+ "notNull": false
2385
+ },
2386
+ "email_complained_at": {
2387
+ "name": "email_complained_at",
2388
+ "type": "timestamp",
2389
+ "primaryKey": false,
2390
+ "notNull": false
2391
+ },
2392
+ "last_email_sent_at": {
2393
+ "name": "last_email_sent_at",
2394
+ "type": "timestamp",
2395
+ "primaryKey": false,
2396
+ "notNull": false
2397
+ },
2398
+ "last_email_opened_at": {
2399
+ "name": "last_email_opened_at",
2400
+ "type": "timestamp",
2401
+ "primaryKey": false,
2402
+ "notNull": false
2403
+ },
2404
+ "last_email_clicked_at": {
2405
+ "name": "last_email_clicked_at",
2406
+ "type": "timestamp",
2407
+ "primaryKey": false,
2408
+ "notNull": false
2409
+ },
2410
+ "emails_sent": {
2411
+ "name": "emails_sent",
2412
+ "type": "integer",
2413
+ "primaryKey": false,
2414
+ "notNull": true,
2415
+ "default": 0
2416
+ },
2417
+ "emails_opened": {
2418
+ "name": "emails_opened",
2419
+ "type": "integer",
2420
+ "primaryKey": false,
2421
+ "notNull": true,
2422
+ "default": 0
2423
+ },
2424
+ "emails_clicked": {
2425
+ "name": "emails_clicked",
2426
+ "type": "integer",
2427
+ "primaryKey": false,
2428
+ "notNull": true,
2429
+ "default": 0
2430
+ },
2431
+ "phone": {
2432
+ "name": "phone",
2433
+ "type": "text",
2434
+ "primaryKey": false,
2435
+ "notNull": false
2436
+ },
2437
+ "phone_hash": {
2438
+ "name": "phone_hash",
2439
+ "type": "text",
2440
+ "primaryKey": false,
2441
+ "notNull": false
2442
+ },
2443
+ "sms_status": {
2444
+ "name": "sms_status",
2445
+ "type": "text",
2446
+ "primaryKey": false,
2447
+ "notNull": false
2448
+ },
2449
+ "sms_consented_at": {
2450
+ "name": "sms_consented_at",
2451
+ "type": "timestamp",
2452
+ "primaryKey": false,
2453
+ "notNull": false
2454
+ },
2455
+ "sms_opted_out_at": {
2456
+ "name": "sms_opted_out_at",
2457
+ "type": "timestamp",
2458
+ "primaryKey": false,
2459
+ "notNull": false
2460
+ },
2461
+ "sms_invalid_at": {
2462
+ "name": "sms_invalid_at",
2463
+ "type": "timestamp",
2464
+ "primaryKey": false,
2465
+ "notNull": false
2466
+ },
2467
+ "last_sms_sent_at": {
2468
+ "name": "last_sms_sent_at",
2469
+ "type": "timestamp",
2470
+ "primaryKey": false,
2471
+ "notNull": false
2472
+ },
2473
+ "last_sms_clicked_at": {
2474
+ "name": "last_sms_clicked_at",
2475
+ "type": "timestamp",
2476
+ "primaryKey": false,
2477
+ "notNull": false
2478
+ },
2479
+ "sms_sent": {
2480
+ "name": "sms_sent",
2481
+ "type": "integer",
2482
+ "primaryKey": false,
2483
+ "notNull": true,
2484
+ "default": 0
2485
+ },
2486
+ "sms_clicked": {
2487
+ "name": "sms_clicked",
2488
+ "type": "integer",
2489
+ "primaryKey": false,
2490
+ "notNull": true,
2491
+ "default": 0
2492
+ },
2493
+ "properties": {
2494
+ "name": "properties",
2495
+ "type": "json",
2496
+ "primaryKey": false,
2497
+ "notNull": true,
2498
+ "default": "'{}'::json"
2499
+ },
2500
+ "last_activity_at": {
2501
+ "name": "last_activity_at",
2502
+ "type": "timestamp",
2503
+ "primaryKey": false,
2504
+ "notNull": false
2505
+ },
2506
+ "created_at": {
2507
+ "name": "created_at",
2508
+ "type": "timestamp",
2509
+ "primaryKey": false,
2510
+ "notNull": true,
2511
+ "default": "now()"
2512
+ },
2513
+ "updated_at": {
2514
+ "name": "updated_at",
2515
+ "type": "timestamp",
2516
+ "primaryKey": false,
2517
+ "notNull": true,
2518
+ "default": "now()"
2519
+ },
2520
+ "created_by": {
2521
+ "name": "created_by",
2522
+ "type": "text",
2523
+ "primaryKey": false,
2524
+ "notNull": false
2525
+ },
2526
+ "status": {
2527
+ "name": "status",
2528
+ "type": "text",
2529
+ "primaryKey": false,
2530
+ "notNull": true,
2531
+ "default": "'active'"
2532
+ },
2533
+ "confirmed_at": {
2534
+ "name": "confirmed_at",
2535
+ "type": "timestamp",
2536
+ "primaryKey": false,
2537
+ "notNull": false
2538
+ },
2539
+ "unsubscribed_at": {
2540
+ "name": "unsubscribed_at",
2541
+ "type": "timestamp",
2542
+ "primaryKey": false,
2543
+ "notNull": false
2544
+ },
2545
+ "bounced_at": {
2546
+ "name": "bounced_at",
2547
+ "type": "timestamp",
2548
+ "primaryKey": false,
2549
+ "notNull": false
2550
+ },
2551
+ "complained_at": {
2552
+ "name": "complained_at",
2553
+ "type": "timestamp",
2554
+ "primaryKey": false,
2555
+ "notNull": false
2556
+ }
2557
+ },
2558
+ "indexes": {
2559
+ "contact_org_idx": {
2560
+ "name": "contact_org_idx",
2561
+ "columns": [
2562
+ {
2563
+ "expression": "organization_id",
2564
+ "isExpression": false,
2565
+ "asc": true,
2566
+ "nulls": "last"
2567
+ }
2568
+ ],
2569
+ "isUnique": false,
2570
+ "concurrently": false,
2571
+ "method": "btree",
2572
+ "with": {}
2573
+ },
2574
+ "contact_email_idx": {
2575
+ "name": "contact_email_idx",
2576
+ "columns": [
2577
+ {
2578
+ "expression": "email",
2579
+ "isExpression": false,
2580
+ "asc": true,
2581
+ "nulls": "last"
2582
+ }
2583
+ ],
2584
+ "isUnique": false,
2585
+ "concurrently": false,
2586
+ "method": "btree",
2587
+ "with": {}
2588
+ },
2589
+ "contact_unique_org_email_idx": {
2590
+ "name": "contact_unique_org_email_idx",
2591
+ "columns": [
2592
+ {
2593
+ "expression": "organization_id",
2594
+ "isExpression": false,
2595
+ "asc": true,
2596
+ "nulls": "last"
2597
+ },
2598
+ {
2599
+ "expression": "email_hash",
2600
+ "isExpression": false,
2601
+ "asc": true,
2602
+ "nulls": "last"
2603
+ }
2604
+ ],
2605
+ "isUnique": true,
2606
+ "where": "email_hash IS NOT NULL",
2607
+ "concurrently": false,
2608
+ "method": "btree",
2609
+ "with": {}
2610
+ },
2611
+ "contact_email_status_idx": {
2612
+ "name": "contact_email_status_idx",
2613
+ "columns": [
2614
+ {
2615
+ "expression": "organization_id",
2616
+ "isExpression": false,
2617
+ "asc": true,
2618
+ "nulls": "last"
2619
+ },
2620
+ {
2621
+ "expression": "email_status",
2622
+ "isExpression": false,
2623
+ "asc": true,
2624
+ "nulls": "last"
2625
+ }
2626
+ ],
2627
+ "isUnique": false,
2628
+ "concurrently": false,
2629
+ "method": "btree",
2630
+ "with": {}
2631
+ },
2632
+ "contact_phone_idx": {
2633
+ "name": "contact_phone_idx",
2634
+ "columns": [
2635
+ {
2636
+ "expression": "phone",
2637
+ "isExpression": false,
2638
+ "asc": true,
2639
+ "nulls": "last"
2640
+ }
2641
+ ],
2642
+ "isUnique": false,
2643
+ "concurrently": false,
2644
+ "method": "btree",
2645
+ "with": {}
2646
+ },
2647
+ "contact_unique_org_phone_idx": {
2648
+ "name": "contact_unique_org_phone_idx",
2649
+ "columns": [
2650
+ {
2651
+ "expression": "organization_id",
2652
+ "isExpression": false,
2653
+ "asc": true,
2654
+ "nulls": "last"
2655
+ },
2656
+ {
2657
+ "expression": "phone_hash",
2658
+ "isExpression": false,
2659
+ "asc": true,
2660
+ "nulls": "last"
2661
+ }
2662
+ ],
2663
+ "isUnique": true,
2664
+ "where": "phone_hash IS NOT NULL",
2665
+ "concurrently": false,
2666
+ "method": "btree",
2667
+ "with": {}
2668
+ },
2669
+ "contact_sms_status_idx": {
2670
+ "name": "contact_sms_status_idx",
2671
+ "columns": [
2672
+ {
2673
+ "expression": "organization_id",
2674
+ "isExpression": false,
2675
+ "asc": true,
2676
+ "nulls": "last"
2677
+ },
2678
+ {
2679
+ "expression": "sms_status",
2680
+ "isExpression": false,
2681
+ "asc": true,
2682
+ "nulls": "last"
2683
+ }
2684
+ ],
2685
+ "isUnique": false,
2686
+ "concurrently": false,
2687
+ "method": "btree",
2688
+ "with": {}
2689
+ },
2690
+ "contact_status_idx": {
2691
+ "name": "contact_status_idx",
2692
+ "columns": [
2693
+ {
2694
+ "expression": "organization_id",
2695
+ "isExpression": false,
2696
+ "asc": true,
2697
+ "nulls": "last"
2698
+ },
2699
+ {
2700
+ "expression": "status",
2701
+ "isExpression": false,
2702
+ "asc": true,
2703
+ "nulls": "last"
2704
+ }
2705
+ ],
2706
+ "isUnique": false,
2707
+ "concurrently": false,
2708
+ "method": "btree",
2709
+ "with": {}
2710
+ }
2711
+ },
2712
+ "foreignKeys": {
2713
+ "contact_organization_id_organization_id_fk": {
2714
+ "name": "contact_organization_id_organization_id_fk",
2715
+ "tableFrom": "contact",
2716
+ "tableTo": "organization",
2717
+ "columnsFrom": ["organization_id"],
2718
+ "columnsTo": ["id"],
2719
+ "onDelete": "cascade",
2720
+ "onUpdate": "no action"
2721
+ },
2722
+ "contact_created_by_user_id_fk": {
2723
+ "name": "contact_created_by_user_id_fk",
2724
+ "tableFrom": "contact",
2725
+ "tableTo": "user",
2726
+ "columnsFrom": ["created_by"],
2727
+ "columnsTo": ["id"],
2728
+ "onDelete": "no action",
2729
+ "onUpdate": "no action"
2730
+ }
2731
+ },
2732
+ "compositePrimaryKeys": {},
2733
+ "uniqueConstraints": {},
2734
+ "policies": {},
2735
+ "checkConstraints": {},
2736
+ "isRLSEnabled": false
2737
+ },
2738
+ "public.contact_topic": {
2739
+ "name": "contact_topic",
2740
+ "schema": "",
2741
+ "columns": {
2742
+ "contact_id": {
2743
+ "name": "contact_id",
2744
+ "type": "text",
2745
+ "primaryKey": false,
2746
+ "notNull": true
2747
+ },
2748
+ "topic_id": {
2749
+ "name": "topic_id",
2750
+ "type": "text",
2751
+ "primaryKey": false,
2752
+ "notNull": true
2753
+ },
2754
+ "status": {
2755
+ "name": "status",
2756
+ "type": "text",
2757
+ "primaryKey": false,
2758
+ "notNull": true,
2759
+ "default": "'subscribed'"
2760
+ },
2761
+ "subscribed_at": {
2762
+ "name": "subscribed_at",
2763
+ "type": "timestamp",
2764
+ "primaryKey": false,
2765
+ "notNull": false,
2766
+ "default": "now()"
2767
+ },
2768
+ "unsubscribed_at": {
2769
+ "name": "unsubscribed_at",
2770
+ "type": "timestamp",
2771
+ "primaryKey": false,
2772
+ "notNull": false
2773
+ },
2774
+ "confirmed_at": {
2775
+ "name": "confirmed_at",
2776
+ "type": "timestamp",
2777
+ "primaryKey": false,
2778
+ "notNull": false
2779
+ }
2780
+ },
2781
+ "indexes": {
2782
+ "contact_topic_topic_idx": {
2783
+ "name": "contact_topic_topic_idx",
2784
+ "columns": [
2785
+ {
2786
+ "expression": "topic_id",
2787
+ "isExpression": false,
2788
+ "asc": true,
2789
+ "nulls": "last"
2790
+ }
2791
+ ],
2792
+ "isUnique": false,
2793
+ "concurrently": false,
2794
+ "method": "btree",
2795
+ "with": {}
2796
+ },
2797
+ "contact_topic_status_idx": {
2798
+ "name": "contact_topic_status_idx",
2799
+ "columns": [
2800
+ {
2801
+ "expression": "topic_id",
2802
+ "isExpression": false,
2803
+ "asc": true,
2804
+ "nulls": "last"
2805
+ },
2806
+ {
2807
+ "expression": "status",
2808
+ "isExpression": false,
2809
+ "asc": true,
2810
+ "nulls": "last"
2811
+ }
2812
+ ],
2813
+ "isUnique": false,
2814
+ "concurrently": false,
2815
+ "method": "btree",
2816
+ "with": {}
2817
+ }
2818
+ },
2819
+ "foreignKeys": {
2820
+ "contact_topic_contact_id_contact_id_fk": {
2821
+ "name": "contact_topic_contact_id_contact_id_fk",
2822
+ "tableFrom": "contact_topic",
2823
+ "tableTo": "contact",
2824
+ "columnsFrom": ["contact_id"],
2825
+ "columnsTo": ["id"],
2826
+ "onDelete": "cascade",
2827
+ "onUpdate": "no action"
2828
+ },
2829
+ "contact_topic_topic_id_topic_id_fk": {
2830
+ "name": "contact_topic_topic_id_topic_id_fk",
2831
+ "tableFrom": "contact_topic",
2832
+ "tableTo": "topic",
2833
+ "columnsFrom": ["topic_id"],
2834
+ "columnsTo": ["id"],
2835
+ "onDelete": "cascade",
2836
+ "onUpdate": "no action"
2837
+ }
2838
+ },
2839
+ "compositePrimaryKeys": {
2840
+ "contact_topic_contact_id_topic_id_pk": {
2841
+ "name": "contact_topic_contact_id_topic_id_pk",
2842
+ "columns": ["contact_id", "topic_id"]
2843
+ }
2844
+ },
2845
+ "uniqueConstraints": {},
2846
+ "policies": {},
2847
+ "checkConstraints": {},
2848
+ "isRLSEnabled": false
2849
+ },
2850
+ "public.topic": {
2851
+ "name": "topic",
2852
+ "schema": "",
2853
+ "columns": {
2854
+ "id": {
2855
+ "name": "id",
2856
+ "type": "text",
2857
+ "primaryKey": true,
2858
+ "notNull": true
2859
+ },
2860
+ "organization_id": {
2861
+ "name": "organization_id",
2862
+ "type": "text",
2863
+ "primaryKey": false,
2864
+ "notNull": true
2865
+ },
2866
+ "name": {
2867
+ "name": "name",
2868
+ "type": "text",
2869
+ "primaryKey": false,
2870
+ "notNull": true
2871
+ },
2872
+ "slug": {
2873
+ "name": "slug",
2874
+ "type": "text",
2875
+ "primaryKey": false,
2876
+ "notNull": true
2877
+ },
2878
+ "description": {
2879
+ "name": "description",
2880
+ "type": "text",
2881
+ "primaryKey": false,
2882
+ "notNull": false
2883
+ },
2884
+ "public": {
2885
+ "name": "public",
2886
+ "type": "boolean",
2887
+ "primaryKey": false,
2888
+ "notNull": true,
2889
+ "default": true
2890
+ },
2891
+ "double_opt_in": {
2892
+ "name": "double_opt_in",
2893
+ "type": "boolean",
2894
+ "primaryKey": false,
2895
+ "notNull": true,
2896
+ "default": false
2897
+ },
2898
+ "created_at": {
2899
+ "name": "created_at",
2900
+ "type": "timestamp",
2901
+ "primaryKey": false,
2902
+ "notNull": true,
2903
+ "default": "now()"
2904
+ },
2905
+ "updated_at": {
2906
+ "name": "updated_at",
2907
+ "type": "timestamp",
2908
+ "primaryKey": false,
2909
+ "notNull": true,
2910
+ "default": "now()"
2911
+ },
2912
+ "created_by": {
2913
+ "name": "created_by",
2914
+ "type": "text",
2915
+ "primaryKey": false,
2916
+ "notNull": false
2917
+ }
2918
+ },
2919
+ "indexes": {
2920
+ "topic_org_idx": {
2921
+ "name": "topic_org_idx",
2922
+ "columns": [
2923
+ {
2924
+ "expression": "organization_id",
2925
+ "isExpression": false,
2926
+ "asc": true,
2927
+ "nulls": "last"
2928
+ }
2929
+ ],
2930
+ "isUnique": false,
2931
+ "concurrently": false,
2932
+ "method": "btree",
2933
+ "with": {}
2934
+ },
2935
+ "topic_unique_org_slug_idx": {
2936
+ "name": "topic_unique_org_slug_idx",
2937
+ "columns": [
2938
+ {
2939
+ "expression": "organization_id",
2940
+ "isExpression": false,
2941
+ "asc": true,
2942
+ "nulls": "last"
2943
+ },
2944
+ {
2945
+ "expression": "slug",
2946
+ "isExpression": false,
2947
+ "asc": true,
2948
+ "nulls": "last"
2949
+ }
2950
+ ],
2951
+ "isUnique": true,
2952
+ "concurrently": false,
2953
+ "method": "btree",
2954
+ "with": {}
2955
+ }
2956
+ },
2957
+ "foreignKeys": {
2958
+ "topic_organization_id_organization_id_fk": {
2959
+ "name": "topic_organization_id_organization_id_fk",
2960
+ "tableFrom": "topic",
2961
+ "tableTo": "organization",
2962
+ "columnsFrom": ["organization_id"],
2963
+ "columnsTo": ["id"],
2964
+ "onDelete": "cascade",
2965
+ "onUpdate": "no action"
2966
+ },
2967
+ "topic_created_by_user_id_fk": {
2968
+ "name": "topic_created_by_user_id_fk",
2969
+ "tableFrom": "topic",
2970
+ "tableTo": "user",
2971
+ "columnsFrom": ["created_by"],
2972
+ "columnsTo": ["id"],
2973
+ "onDelete": "no action",
2974
+ "onUpdate": "no action"
2975
+ }
2976
+ },
2977
+ "compositePrimaryKeys": {},
2978
+ "uniqueConstraints": {},
2979
+ "policies": {},
2980
+ "checkConstraints": {},
2981
+ "isRLSEnabled": false
2982
+ },
2983
+ "public.topic_settings": {
2984
+ "name": "topic_settings",
2985
+ "schema": "",
2986
+ "columns": {
2987
+ "organization_id": {
2988
+ "name": "organization_id",
2989
+ "type": "text",
2990
+ "primaryKey": true,
2991
+ "notNull": true
2992
+ },
2993
+ "confirmation_from_name": {
2994
+ "name": "confirmation_from_name",
2995
+ "type": "text",
2996
+ "primaryKey": false,
2997
+ "notNull": false
2998
+ },
2999
+ "confirmation_from_email": {
3000
+ "name": "confirmation_from_email",
3001
+ "type": "text",
3002
+ "primaryKey": false,
3003
+ "notNull": false
3004
+ },
3005
+ "confirmation_reply_to_email": {
3006
+ "name": "confirmation_reply_to_email",
3007
+ "type": "text",
3008
+ "primaryKey": false,
3009
+ "notNull": false
3010
+ },
3011
+ "preference_center_title": {
3012
+ "name": "preference_center_title",
3013
+ "type": "text",
3014
+ "primaryKey": false,
3015
+ "notNull": false
3016
+ },
3017
+ "preference_center_description": {
3018
+ "name": "preference_center_description",
3019
+ "type": "text",
3020
+ "primaryKey": false,
3021
+ "notNull": false
3022
+ },
3023
+ "updated_at": {
3024
+ "name": "updated_at",
3025
+ "type": "timestamp",
3026
+ "primaryKey": false,
3027
+ "notNull": true,
3028
+ "default": "now()"
3029
+ }
3030
+ },
3031
+ "indexes": {},
3032
+ "foreignKeys": {
3033
+ "topic_settings_organization_id_organization_id_fk": {
3034
+ "name": "topic_settings_organization_id_organization_id_fk",
3035
+ "tableFrom": "topic_settings",
3036
+ "tableTo": "organization",
3037
+ "columnsFrom": ["organization_id"],
3038
+ "columnsTo": ["id"],
3039
+ "onDelete": "cascade",
3040
+ "onUpdate": "no action"
3041
+ }
3042
+ },
3043
+ "compositePrimaryKeys": {},
3044
+ "uniqueConstraints": {},
3045
+ "policies": {},
3046
+ "checkConstraints": {},
3047
+ "isRLSEnabled": false
3048
+ },
3049
+ "public.segment": {
3050
+ "name": "segment",
3051
+ "schema": "",
3052
+ "columns": {
3053
+ "id": {
3054
+ "name": "id",
3055
+ "type": "text",
3056
+ "primaryKey": true,
3057
+ "notNull": true
3058
+ },
3059
+ "organization_id": {
3060
+ "name": "organization_id",
3061
+ "type": "text",
3062
+ "primaryKey": false,
3063
+ "notNull": true
3064
+ },
3065
+ "name": {
3066
+ "name": "name",
3067
+ "type": "text",
3068
+ "primaryKey": false,
3069
+ "notNull": true
3070
+ },
3071
+ "description": {
3072
+ "name": "description",
3073
+ "type": "text",
3074
+ "primaryKey": false,
3075
+ "notNull": false
3076
+ },
3077
+ "condition": {
3078
+ "name": "condition",
3079
+ "type": "json",
3080
+ "primaryKey": false,
3081
+ "notNull": true
3082
+ },
3083
+ "track_membership": {
3084
+ "name": "track_membership",
3085
+ "type": "boolean",
3086
+ "primaryKey": false,
3087
+ "notNull": true,
3088
+ "default": false
3089
+ },
3090
+ "member_count": {
3091
+ "name": "member_count",
3092
+ "type": "integer",
3093
+ "primaryKey": false,
3094
+ "notNull": true,
3095
+ "default": 0
3096
+ },
3097
+ "last_computed_at": {
3098
+ "name": "last_computed_at",
3099
+ "type": "timestamp",
3100
+ "primaryKey": false,
3101
+ "notNull": false
3102
+ },
3103
+ "created_by": {
3104
+ "name": "created_by",
3105
+ "type": "text",
3106
+ "primaryKey": false,
3107
+ "notNull": false
3108
+ },
3109
+ "created_at": {
3110
+ "name": "created_at",
3111
+ "type": "timestamp",
3112
+ "primaryKey": false,
3113
+ "notNull": true,
3114
+ "default": "now()"
3115
+ },
3116
+ "updated_at": {
3117
+ "name": "updated_at",
3118
+ "type": "timestamp",
3119
+ "primaryKey": false,
3120
+ "notNull": true,
3121
+ "default": "now()"
3122
+ }
3123
+ },
3124
+ "indexes": {
3125
+ "segment_org_idx": {
3126
+ "name": "segment_org_idx",
3127
+ "columns": [
3128
+ {
3129
+ "expression": "organization_id",
3130
+ "isExpression": false,
3131
+ "asc": true,
3132
+ "nulls": "last"
3133
+ }
3134
+ ],
3135
+ "isUnique": false,
3136
+ "concurrently": false,
3137
+ "method": "btree",
3138
+ "with": {}
3139
+ },
3140
+ "segment_name_idx": {
3141
+ "name": "segment_name_idx",
3142
+ "columns": [
3143
+ {
3144
+ "expression": "organization_id",
3145
+ "isExpression": false,
3146
+ "asc": true,
3147
+ "nulls": "last"
3148
+ },
3149
+ {
3150
+ "expression": "name",
3151
+ "isExpression": false,
3152
+ "asc": true,
3153
+ "nulls": "last"
3154
+ }
3155
+ ],
3156
+ "isUnique": false,
3157
+ "concurrently": false,
3158
+ "method": "btree",
3159
+ "with": {}
3160
+ }
3161
+ },
3162
+ "foreignKeys": {
3163
+ "segment_organization_id_organization_id_fk": {
3164
+ "name": "segment_organization_id_organization_id_fk",
3165
+ "tableFrom": "segment",
3166
+ "tableTo": "organization",
3167
+ "columnsFrom": ["organization_id"],
3168
+ "columnsTo": ["id"],
3169
+ "onDelete": "cascade",
3170
+ "onUpdate": "no action"
3171
+ },
3172
+ "segment_created_by_user_id_fk": {
3173
+ "name": "segment_created_by_user_id_fk",
3174
+ "tableFrom": "segment",
3175
+ "tableTo": "user",
3176
+ "columnsFrom": ["created_by"],
3177
+ "columnsTo": ["id"],
3178
+ "onDelete": "no action",
3179
+ "onUpdate": "no action"
3180
+ }
3181
+ },
3182
+ "compositePrimaryKeys": {},
3183
+ "uniqueConstraints": {},
3184
+ "policies": {},
3185
+ "checkConstraints": {},
3186
+ "isRLSEnabled": false
3187
+ },
3188
+ "public.ai_conversation": {
3189
+ "name": "ai_conversation",
3190
+ "schema": "",
3191
+ "columns": {
3192
+ "id": {
3193
+ "name": "id",
3194
+ "type": "text",
3195
+ "primaryKey": true,
3196
+ "notNull": true
3197
+ },
3198
+ "organization_id": {
3199
+ "name": "organization_id",
3200
+ "type": "text",
3201
+ "primaryKey": false,
3202
+ "notNull": true
3203
+ },
3204
+ "template_id": {
3205
+ "name": "template_id",
3206
+ "type": "text",
3207
+ "primaryKey": false,
3208
+ "notNull": false
3209
+ },
3210
+ "messages": {
3211
+ "name": "messages",
3212
+ "type": "jsonb",
3213
+ "primaryKey": false,
3214
+ "notNull": false,
3215
+ "default": "'[]'::jsonb"
3216
+ },
3217
+ "total_tokens": {
3218
+ "name": "total_tokens",
3219
+ "type": "integer",
3220
+ "primaryKey": false,
3221
+ "notNull": true,
3222
+ "default": 0
3223
+ },
3224
+ "created_at": {
3225
+ "name": "created_at",
3226
+ "type": "timestamp",
3227
+ "primaryKey": false,
3228
+ "notNull": true,
3229
+ "default": "now()"
3230
+ },
3231
+ "updated_at": {
3232
+ "name": "updated_at",
3233
+ "type": "timestamp",
3234
+ "primaryKey": false,
3235
+ "notNull": true,
3236
+ "default": "now()"
3237
+ },
3238
+ "created_by": {
3239
+ "name": "created_by",
3240
+ "type": "text",
3241
+ "primaryKey": false,
3242
+ "notNull": true
3243
+ }
3244
+ },
3245
+ "indexes": {
3246
+ "ai_conversation_org_idx": {
3247
+ "name": "ai_conversation_org_idx",
3248
+ "columns": [
3249
+ {
3250
+ "expression": "organization_id",
3251
+ "isExpression": false,
3252
+ "asc": true,
3253
+ "nulls": "last"
3254
+ }
3255
+ ],
3256
+ "isUnique": false,
3257
+ "concurrently": false,
3258
+ "method": "btree",
3259
+ "with": {}
3260
+ },
3261
+ "ai_conversation_template_idx": {
3262
+ "name": "ai_conversation_template_idx",
3263
+ "columns": [
3264
+ {
3265
+ "expression": "template_id",
3266
+ "isExpression": false,
3267
+ "asc": true,
3268
+ "nulls": "last"
3269
+ }
3270
+ ],
3271
+ "isUnique": false,
3272
+ "concurrently": false,
3273
+ "method": "btree",
3274
+ "with": {}
3275
+ }
3276
+ },
3277
+ "foreignKeys": {
3278
+ "ai_conversation_organization_id_organization_id_fk": {
3279
+ "name": "ai_conversation_organization_id_organization_id_fk",
3280
+ "tableFrom": "ai_conversation",
3281
+ "tableTo": "organization",
3282
+ "columnsFrom": ["organization_id"],
3283
+ "columnsTo": ["id"],
3284
+ "onDelete": "cascade",
3285
+ "onUpdate": "no action"
3286
+ },
3287
+ "ai_conversation_template_id_template_id_fk": {
3288
+ "name": "ai_conversation_template_id_template_id_fk",
3289
+ "tableFrom": "ai_conversation",
3290
+ "tableTo": "template",
3291
+ "columnsFrom": ["template_id"],
3292
+ "columnsTo": ["id"],
3293
+ "onDelete": "cascade",
3294
+ "onUpdate": "no action"
3295
+ },
3296
+ "ai_conversation_created_by_user_id_fk": {
3297
+ "name": "ai_conversation_created_by_user_id_fk",
3298
+ "tableFrom": "ai_conversation",
3299
+ "tableTo": "user",
3300
+ "columnsFrom": ["created_by"],
3301
+ "columnsTo": ["id"],
3302
+ "onDelete": "set null",
3303
+ "onUpdate": "no action"
3304
+ }
3305
+ },
3306
+ "compositePrimaryKeys": {},
3307
+ "uniqueConstraints": {},
3308
+ "policies": {},
3309
+ "checkConstraints": {},
3310
+ "isRLSEnabled": false
3311
+ },
3312
+ "public.brand_kit": {
3313
+ "name": "brand_kit",
3314
+ "schema": "",
3315
+ "columns": {
3316
+ "id": {
3317
+ "name": "id",
3318
+ "type": "text",
3319
+ "primaryKey": true,
3320
+ "notNull": true
3321
+ },
3322
+ "organization_id": {
3323
+ "name": "organization_id",
3324
+ "type": "text",
3325
+ "primaryKey": false,
3326
+ "notNull": true
3327
+ },
3328
+ "name": {
3329
+ "name": "name",
3330
+ "type": "text",
3331
+ "primaryKey": false,
3332
+ "notNull": true,
3333
+ "default": "'Default'"
3334
+ },
3335
+ "logo_url": {
3336
+ "name": "logo_url",
3337
+ "type": "text",
3338
+ "primaryKey": false,
3339
+ "notNull": false
3340
+ },
3341
+ "primary_color": {
3342
+ "name": "primary_color",
3343
+ "type": "text",
3344
+ "primaryKey": false,
3345
+ "notNull": true,
3346
+ "default": "'#5046e5'"
3347
+ },
3348
+ "secondary_color": {
3349
+ "name": "secondary_color",
3350
+ "type": "text",
3351
+ "primaryKey": false,
3352
+ "notNull": true,
3353
+ "default": "'#6366f1'"
3354
+ },
3355
+ "background_color": {
3356
+ "name": "background_color",
3357
+ "type": "text",
3358
+ "primaryKey": false,
3359
+ "notNull": true,
3360
+ "default": "'#ffffff'"
3361
+ },
3362
+ "text_color": {
3363
+ "name": "text_color",
3364
+ "type": "text",
3365
+ "primaryKey": false,
3366
+ "notNull": true,
3367
+ "default": "'#1f2937'"
3368
+ },
3369
+ "font_family": {
3370
+ "name": "font_family",
3371
+ "type": "text",
3372
+ "primaryKey": false,
3373
+ "notNull": true,
3374
+ "default": "'system-ui, sans-serif'"
3375
+ },
3376
+ "heading_font_family": {
3377
+ "name": "heading_font_family",
3378
+ "type": "text",
3379
+ "primaryKey": false,
3380
+ "notNull": false
3381
+ },
3382
+ "button_style": {
3383
+ "name": "button_style",
3384
+ "type": "text",
3385
+ "primaryKey": false,
3386
+ "notNull": true,
3387
+ "default": "'rounded'"
3388
+ },
3389
+ "button_radius": {
3390
+ "name": "button_radius",
3391
+ "type": "text",
3392
+ "primaryKey": false,
3393
+ "notNull": true,
3394
+ "default": "'4px'"
3395
+ },
3396
+ "company_name": {
3397
+ "name": "company_name",
3398
+ "type": "text",
3399
+ "primaryKey": false,
3400
+ "notNull": false
3401
+ },
3402
+ "company_address": {
3403
+ "name": "company_address",
3404
+ "type": "text",
3405
+ "primaryKey": false,
3406
+ "notNull": false
3407
+ },
3408
+ "social_links": {
3409
+ "name": "social_links",
3410
+ "type": "jsonb",
3411
+ "primaryKey": false,
3412
+ "notNull": false,
3413
+ "default": "'[]'::jsonb"
3414
+ },
3415
+ "source_domain": {
3416
+ "name": "source_domain",
3417
+ "type": "text",
3418
+ "primaryKey": false,
3419
+ "notNull": false
3420
+ },
3421
+ "auto_extracted": {
3422
+ "name": "auto_extracted",
3423
+ "type": "boolean",
3424
+ "primaryKey": false,
3425
+ "notNull": true,
3426
+ "default": false
3427
+ },
3428
+ "is_default": {
3429
+ "name": "is_default",
3430
+ "type": "boolean",
3431
+ "primaryKey": false,
3432
+ "notNull": true,
3433
+ "default": false
3434
+ },
3435
+ "created_at": {
3436
+ "name": "created_at",
3437
+ "type": "timestamp",
3438
+ "primaryKey": false,
3439
+ "notNull": true,
3440
+ "default": "now()"
3441
+ },
3442
+ "updated_at": {
3443
+ "name": "updated_at",
3444
+ "type": "timestamp",
3445
+ "primaryKey": false,
3446
+ "notNull": true,
3447
+ "default": "now()"
3448
+ }
3449
+ },
3450
+ "indexes": {
3451
+ "brand_kit_org_idx": {
3452
+ "name": "brand_kit_org_idx",
3453
+ "columns": [
3454
+ {
3455
+ "expression": "organization_id",
3456
+ "isExpression": false,
3457
+ "asc": true,
3458
+ "nulls": "last"
3459
+ }
3460
+ ],
3461
+ "isUnique": false,
3462
+ "concurrently": false,
3463
+ "method": "btree",
3464
+ "with": {}
3465
+ },
3466
+ "brand_kit_default_idx": {
3467
+ "name": "brand_kit_default_idx",
3468
+ "columns": [
3469
+ {
3470
+ "expression": "organization_id",
3471
+ "isExpression": false,
3472
+ "asc": true,
3473
+ "nulls": "last"
3474
+ },
3475
+ {
3476
+ "expression": "is_default",
3477
+ "isExpression": false,
3478
+ "asc": true,
3479
+ "nulls": "last"
3480
+ }
3481
+ ],
3482
+ "isUnique": false,
3483
+ "concurrently": false,
3484
+ "method": "btree",
3485
+ "with": {}
3486
+ }
3487
+ },
3488
+ "foreignKeys": {
3489
+ "brand_kit_organization_id_organization_id_fk": {
3490
+ "name": "brand_kit_organization_id_organization_id_fk",
3491
+ "tableFrom": "brand_kit",
3492
+ "tableTo": "organization",
3493
+ "columnsFrom": ["organization_id"],
3494
+ "columnsTo": ["id"],
3495
+ "onDelete": "cascade",
3496
+ "onUpdate": "no action"
3497
+ }
3498
+ },
3499
+ "compositePrimaryKeys": {},
3500
+ "uniqueConstraints": {},
3501
+ "policies": {},
3502
+ "checkConstraints": {},
3503
+ "isRLSEnabled": false
3504
+ },
3505
+ "public.reusable_block": {
3506
+ "name": "reusable_block",
3507
+ "schema": "",
3508
+ "columns": {
3509
+ "id": {
3510
+ "name": "id",
3511
+ "type": "text",
3512
+ "primaryKey": true,
3513
+ "notNull": true
3514
+ },
3515
+ "organization_id": {
3516
+ "name": "organization_id",
3517
+ "type": "text",
3518
+ "primaryKey": false,
3519
+ "notNull": true
3520
+ },
3521
+ "name": {
3522
+ "name": "name",
3523
+ "type": "text",
3524
+ "primaryKey": false,
3525
+ "notNull": true
3526
+ },
3527
+ "description": {
3528
+ "name": "description",
3529
+ "type": "text",
3530
+ "primaryKey": false,
3531
+ "notNull": false
3532
+ },
3533
+ "category": {
3534
+ "name": "category",
3535
+ "type": "text",
3536
+ "primaryKey": false,
3537
+ "notNull": true,
3538
+ "default": "'custom'"
3539
+ },
3540
+ "content": {
3541
+ "name": "content",
3542
+ "type": "jsonb",
3543
+ "primaryKey": false,
3544
+ "notNull": true
3545
+ },
3546
+ "thumbnail": {
3547
+ "name": "thumbnail",
3548
+ "type": "text",
3549
+ "primaryKey": false,
3550
+ "notNull": false
3551
+ },
3552
+ "is_public": {
3553
+ "name": "is_public",
3554
+ "type": "boolean",
3555
+ "primaryKey": false,
3556
+ "notNull": true,
3557
+ "default": false
3558
+ },
3559
+ "usage_count": {
3560
+ "name": "usage_count",
3561
+ "type": "integer",
3562
+ "primaryKey": false,
3563
+ "notNull": true,
3564
+ "default": 0
3565
+ },
3566
+ "created_at": {
3567
+ "name": "created_at",
3568
+ "type": "timestamp",
3569
+ "primaryKey": false,
3570
+ "notNull": true,
3571
+ "default": "now()"
3572
+ },
3573
+ "updated_at": {
3574
+ "name": "updated_at",
3575
+ "type": "timestamp",
3576
+ "primaryKey": false,
3577
+ "notNull": true,
3578
+ "default": "now()"
3579
+ },
3580
+ "created_by": {
3581
+ "name": "created_by",
3582
+ "type": "text",
3583
+ "primaryKey": false,
3584
+ "notNull": true
3585
+ }
3586
+ },
3587
+ "indexes": {
3588
+ "reusable_block_org_idx": {
3589
+ "name": "reusable_block_org_idx",
3590
+ "columns": [
3591
+ {
3592
+ "expression": "organization_id",
3593
+ "isExpression": false,
3594
+ "asc": true,
3595
+ "nulls": "last"
3596
+ }
3597
+ ],
3598
+ "isUnique": false,
3599
+ "concurrently": false,
3600
+ "method": "btree",
3601
+ "with": {}
3602
+ },
3603
+ "reusable_block_created_by_category_idx": {
3604
+ "name": "reusable_block_created_by_category_idx",
3605
+ "columns": [
3606
+ {
3607
+ "expression": "created_by",
3608
+ "isExpression": false,
3609
+ "asc": true,
3610
+ "nulls": "last"
3611
+ },
3612
+ {
3613
+ "expression": "category",
3614
+ "isExpression": false,
3615
+ "asc": true,
3616
+ "nulls": "last"
3617
+ }
3618
+ ],
3619
+ "isUnique": false,
3620
+ "concurrently": false,
3621
+ "method": "btree",
3622
+ "with": {}
3623
+ },
3624
+ "reusable_block_public_category_idx": {
3625
+ "name": "reusable_block_public_category_idx",
3626
+ "columns": [
3627
+ {
3628
+ "expression": "is_public",
3629
+ "isExpression": false,
3630
+ "asc": true,
3631
+ "nulls": "last"
3632
+ },
3633
+ {
3634
+ "expression": "category",
3635
+ "isExpression": false,
3636
+ "asc": true,
3637
+ "nulls": "last"
3638
+ }
3639
+ ],
3640
+ "isUnique": false,
3641
+ "concurrently": false,
3642
+ "method": "btree",
3643
+ "with": {}
3644
+ }
3645
+ },
3646
+ "foreignKeys": {
3647
+ "reusable_block_organization_id_organization_id_fk": {
3648
+ "name": "reusable_block_organization_id_organization_id_fk",
3649
+ "tableFrom": "reusable_block",
3650
+ "tableTo": "organization",
3651
+ "columnsFrom": ["organization_id"],
3652
+ "columnsTo": ["id"],
3653
+ "onDelete": "cascade",
3654
+ "onUpdate": "no action"
3655
+ },
3656
+ "reusable_block_created_by_user_id_fk": {
3657
+ "name": "reusable_block_created_by_user_id_fk",
3658
+ "tableFrom": "reusable_block",
3659
+ "tableTo": "user",
3660
+ "columnsFrom": ["created_by"],
3661
+ "columnsTo": ["id"],
3662
+ "onDelete": "set null",
3663
+ "onUpdate": "no action"
3664
+ }
3665
+ },
3666
+ "compositePrimaryKeys": {},
3667
+ "uniqueConstraints": {},
3668
+ "policies": {},
3669
+ "checkConstraints": {},
3670
+ "isRLSEnabled": false
3671
+ },
3672
+ "public.template": {
3673
+ "name": "template",
3674
+ "schema": "",
3675
+ "columns": {
3676
+ "id": {
3677
+ "name": "id",
3678
+ "type": "text",
3679
+ "primaryKey": true,
3680
+ "notNull": true
3681
+ },
3682
+ "organization_id": {
3683
+ "name": "organization_id",
3684
+ "type": "text",
3685
+ "primaryKey": false,
3686
+ "notNull": true
3687
+ },
3688
+ "name": {
3689
+ "name": "name",
3690
+ "type": "text",
3691
+ "primaryKey": false,
3692
+ "notNull": true
3693
+ },
3694
+ "description": {
3695
+ "name": "description",
3696
+ "type": "text",
3697
+ "primaryKey": false,
3698
+ "notNull": false
3699
+ },
3700
+ "subject": {
3701
+ "name": "subject",
3702
+ "type": "text",
3703
+ "primaryKey": false,
3704
+ "notNull": false
3705
+ },
3706
+ "content": {
3707
+ "name": "content",
3708
+ "type": "jsonb",
3709
+ "primaryKey": false,
3710
+ "notNull": true
3711
+ },
3712
+ "compiled_html": {
3713
+ "name": "compiled_html",
3714
+ "type": "text",
3715
+ "primaryKey": false,
3716
+ "notNull": false
3717
+ },
3718
+ "compiled_text": {
3719
+ "name": "compiled_text",
3720
+ "type": "text",
3721
+ "primaryKey": false,
3722
+ "notNull": false
3723
+ },
3724
+ "variables": {
3725
+ "name": "variables",
3726
+ "type": "jsonb",
3727
+ "primaryKey": false,
3728
+ "notNull": false,
3729
+ "default": "'[]'::jsonb"
3730
+ },
3731
+ "test_data": {
3732
+ "name": "test_data",
3733
+ "type": "jsonb",
3734
+ "primaryKey": false,
3735
+ "notNull": false,
3736
+ "default": "'{}'::jsonb"
3737
+ },
3738
+ "room_id": {
3739
+ "name": "room_id",
3740
+ "type": "text",
3741
+ "primaryKey": false,
3742
+ "notNull": false
3743
+ },
3744
+ "is_collaborative": {
3745
+ "name": "is_collaborative",
3746
+ "type": "boolean",
3747
+ "primaryKey": false,
3748
+ "notNull": true,
3749
+ "default": false
3750
+ },
3751
+ "ai_generated": {
3752
+ "name": "ai_generated",
3753
+ "type": "boolean",
3754
+ "primaryKey": false,
3755
+ "notNull": true,
3756
+ "default": false
3757
+ },
3758
+ "ai_conversation_id": {
3759
+ "name": "ai_conversation_id",
3760
+ "type": "text",
3761
+ "primaryKey": false,
3762
+ "notNull": false
3763
+ },
3764
+ "ses_template_name": {
3765
+ "name": "ses_template_name",
3766
+ "type": "text",
3767
+ "primaryKey": false,
3768
+ "notNull": false
3769
+ },
3770
+ "published_at": {
3771
+ "name": "published_at",
3772
+ "type": "timestamp",
3773
+ "primaryKey": false,
3774
+ "notNull": false
3775
+ },
3776
+ "status": {
3777
+ "name": "status",
3778
+ "type": "template_status",
3779
+ "typeSchema": "public",
3780
+ "primaryKey": false,
3781
+ "notNull": true,
3782
+ "default": "'DRAFT'"
3783
+ },
3784
+ "created_at": {
3785
+ "name": "created_at",
3786
+ "type": "timestamp",
3787
+ "primaryKey": false,
3788
+ "notNull": true,
3789
+ "default": "now()"
3790
+ },
3791
+ "updated_at": {
3792
+ "name": "updated_at",
3793
+ "type": "timestamp",
3794
+ "primaryKey": false,
3795
+ "notNull": true,
3796
+ "default": "now()"
3797
+ },
3798
+ "created_by": {
3799
+ "name": "created_by",
3800
+ "type": "text",
3801
+ "primaryKey": false,
3802
+ "notNull": true
3803
+ },
3804
+ "last_edited_by": {
3805
+ "name": "last_edited_by",
3806
+ "type": "text",
3807
+ "primaryKey": false,
3808
+ "notNull": false
3809
+ }
3810
+ },
3811
+ "indexes": {
3812
+ "template_org_idx": {
3813
+ "name": "template_org_idx",
3814
+ "columns": [
3815
+ {
3816
+ "expression": "organization_id",
3817
+ "isExpression": false,
3818
+ "asc": true,
3819
+ "nulls": "last"
3820
+ }
3821
+ ],
3822
+ "isUnique": false,
3823
+ "concurrently": false,
3824
+ "method": "btree",
3825
+ "with": {}
3826
+ },
3827
+ "template_status_updated_at_idx": {
3828
+ "name": "template_status_updated_at_idx",
3829
+ "columns": [
3830
+ {
3831
+ "expression": "status",
3832
+ "isExpression": false,
3833
+ "asc": true,
3834
+ "nulls": "last"
3835
+ },
3836
+ {
3837
+ "expression": "updated_at",
3838
+ "isExpression": false,
3839
+ "asc": true,
3840
+ "nulls": "last"
3841
+ }
3842
+ ],
3843
+ "isUnique": false,
3844
+ "concurrently": false,
3845
+ "method": "btree",
3846
+ "with": {}
3847
+ },
3848
+ "template_created_by_idx": {
3849
+ "name": "template_created_by_idx",
3850
+ "columns": [
3851
+ {
3852
+ "expression": "created_by",
3853
+ "isExpression": false,
3854
+ "asc": true,
3855
+ "nulls": "last"
3856
+ }
3857
+ ],
3858
+ "isUnique": false,
3859
+ "concurrently": false,
3860
+ "method": "btree",
3861
+ "with": {}
3862
+ },
3863
+ "template_room_id_idx": {
3864
+ "name": "template_room_id_idx",
3865
+ "columns": [
3866
+ {
3867
+ "expression": "room_id",
3868
+ "isExpression": false,
3869
+ "asc": true,
3870
+ "nulls": "last"
3871
+ }
3872
+ ],
3873
+ "isUnique": true,
3874
+ "concurrently": false,
3875
+ "method": "btree",
3876
+ "with": {}
3877
+ }
3878
+ },
3879
+ "foreignKeys": {
3880
+ "template_organization_id_organization_id_fk": {
3881
+ "name": "template_organization_id_organization_id_fk",
3882
+ "tableFrom": "template",
3883
+ "tableTo": "organization",
3884
+ "columnsFrom": ["organization_id"],
3885
+ "columnsTo": ["id"],
3886
+ "onDelete": "cascade",
3887
+ "onUpdate": "no action"
3888
+ },
3889
+ "template_created_by_user_id_fk": {
3890
+ "name": "template_created_by_user_id_fk",
3891
+ "tableFrom": "template",
3892
+ "tableTo": "user",
3893
+ "columnsFrom": ["created_by"],
3894
+ "columnsTo": ["id"],
3895
+ "onDelete": "set null",
3896
+ "onUpdate": "no action"
3897
+ },
3898
+ "template_last_edited_by_user_id_fk": {
3899
+ "name": "template_last_edited_by_user_id_fk",
3900
+ "tableFrom": "template",
3901
+ "tableTo": "user",
3902
+ "columnsFrom": ["last_edited_by"],
3903
+ "columnsTo": ["id"],
3904
+ "onDelete": "set null",
3905
+ "onUpdate": "no action"
3906
+ }
3907
+ },
3908
+ "compositePrimaryKeys": {},
3909
+ "uniqueConstraints": {},
3910
+ "policies": {},
3911
+ "checkConstraints": {},
3912
+ "isRLSEnabled": false
3913
+ },
3914
+ "public.template_variable": {
3915
+ "name": "template_variable",
3916
+ "schema": "",
3917
+ "columns": {
3918
+ "id": {
3919
+ "name": "id",
3920
+ "type": "text",
3921
+ "primaryKey": true,
3922
+ "notNull": true
3923
+ },
3924
+ "organization_id": {
3925
+ "name": "organization_id",
3926
+ "type": "text",
3927
+ "primaryKey": false,
3928
+ "notNull": true
3929
+ },
3930
+ "name": {
3931
+ "name": "name",
3932
+ "type": "text",
3933
+ "primaryKey": false,
3934
+ "notNull": true
3935
+ },
3936
+ "label": {
3937
+ "name": "label",
3938
+ "type": "text",
3939
+ "primaryKey": false,
3940
+ "notNull": true
3941
+ },
3942
+ "type": {
3943
+ "name": "type",
3944
+ "type": "variable_type",
3945
+ "typeSchema": "public",
3946
+ "primaryKey": false,
3947
+ "notNull": true
3948
+ },
3949
+ "required": {
3950
+ "name": "required",
3951
+ "type": "boolean",
3952
+ "primaryKey": false,
3953
+ "notNull": true,
3954
+ "default": false
3955
+ },
3956
+ "fallback": {
3957
+ "name": "fallback",
3958
+ "type": "text",
3959
+ "primaryKey": false,
3960
+ "notNull": false
3961
+ },
3962
+ "validation": {
3963
+ "name": "validation",
3964
+ "type": "jsonb",
3965
+ "primaryKey": false,
3966
+ "notNull": false
3967
+ },
3968
+ "created_at": {
3969
+ "name": "created_at",
3970
+ "type": "timestamp",
3971
+ "primaryKey": false,
3972
+ "notNull": true,
3973
+ "default": "now()"
3974
+ },
3975
+ "updated_at": {
3976
+ "name": "updated_at",
3977
+ "type": "timestamp",
3978
+ "primaryKey": false,
3979
+ "notNull": true,
3980
+ "default": "now()"
3981
+ }
3982
+ },
3983
+ "indexes": {
3984
+ "template_variable_org_name_idx": {
3985
+ "name": "template_variable_org_name_idx",
3986
+ "columns": [
3987
+ {
3988
+ "expression": "organization_id",
3989
+ "isExpression": false,
3990
+ "asc": true,
3991
+ "nulls": "last"
3992
+ },
3993
+ {
3994
+ "expression": "name",
3995
+ "isExpression": false,
3996
+ "asc": true,
3997
+ "nulls": "last"
3998
+ }
3999
+ ],
4000
+ "isUnique": true,
4001
+ "concurrently": false,
4002
+ "method": "btree",
4003
+ "with": {}
4004
+ }
4005
+ },
4006
+ "foreignKeys": {
4007
+ "template_variable_organization_id_organization_id_fk": {
4008
+ "name": "template_variable_organization_id_organization_id_fk",
4009
+ "tableFrom": "template_variable",
4010
+ "tableTo": "organization",
4011
+ "columnsFrom": ["organization_id"],
4012
+ "columnsTo": ["id"],
4013
+ "onDelete": "cascade",
4014
+ "onUpdate": "no action"
4015
+ }
4016
+ },
4017
+ "compositePrimaryKeys": {},
4018
+ "uniqueConstraints": {},
4019
+ "policies": {},
4020
+ "checkConstraints": {},
4021
+ "isRLSEnabled": false
4022
+ },
4023
+ "public.template_version": {
4024
+ "name": "template_version",
4025
+ "schema": "",
4026
+ "columns": {
4027
+ "id": {
4028
+ "name": "id",
4029
+ "type": "text",
4030
+ "primaryKey": true,
4031
+ "notNull": true
4032
+ },
4033
+ "template_id": {
4034
+ "name": "template_id",
4035
+ "type": "text",
4036
+ "primaryKey": false,
4037
+ "notNull": true
4038
+ },
4039
+ "content": {
4040
+ "name": "content",
4041
+ "type": "jsonb",
4042
+ "primaryKey": false,
4043
+ "notNull": true
4044
+ },
4045
+ "version": {
4046
+ "name": "version",
4047
+ "type": "integer",
4048
+ "primaryKey": false,
4049
+ "notNull": true
4050
+ },
4051
+ "created_at": {
4052
+ "name": "created_at",
4053
+ "type": "timestamp",
4054
+ "primaryKey": false,
4055
+ "notNull": true,
4056
+ "default": "now()"
4057
+ },
4058
+ "created_by": {
4059
+ "name": "created_by",
4060
+ "type": "text",
4061
+ "primaryKey": false,
4062
+ "notNull": true
4063
+ },
4064
+ "change_note": {
4065
+ "name": "change_note",
4066
+ "type": "text",
4067
+ "primaryKey": false,
4068
+ "notNull": false
4069
+ }
4070
+ },
4071
+ "indexes": {
4072
+ "template_version_template_version_idx": {
4073
+ "name": "template_version_template_version_idx",
4074
+ "columns": [
4075
+ {
4076
+ "expression": "template_id",
4077
+ "isExpression": false,
4078
+ "asc": true,
4079
+ "nulls": "last"
4080
+ },
4081
+ {
4082
+ "expression": "version",
4083
+ "isExpression": false,
4084
+ "asc": true,
4085
+ "nulls": "last"
4086
+ }
4087
+ ],
4088
+ "isUnique": true,
4089
+ "concurrently": false,
4090
+ "method": "btree",
4091
+ "with": {}
4092
+ },
4093
+ "template_version_template_created_at_idx": {
4094
+ "name": "template_version_template_created_at_idx",
4095
+ "columns": [
4096
+ {
4097
+ "expression": "template_id",
4098
+ "isExpression": false,
4099
+ "asc": true,
4100
+ "nulls": "last"
4101
+ },
4102
+ {
4103
+ "expression": "created_at",
4104
+ "isExpression": false,
4105
+ "asc": true,
4106
+ "nulls": "last"
4107
+ }
4108
+ ],
4109
+ "isUnique": false,
4110
+ "concurrently": false,
4111
+ "method": "btree",
4112
+ "with": {}
4113
+ }
4114
+ },
4115
+ "foreignKeys": {
4116
+ "template_version_template_id_template_id_fk": {
4117
+ "name": "template_version_template_id_template_id_fk",
4118
+ "tableFrom": "template_version",
4119
+ "tableTo": "template",
4120
+ "columnsFrom": ["template_id"],
4121
+ "columnsTo": ["id"],
4122
+ "onDelete": "cascade",
4123
+ "onUpdate": "no action"
4124
+ },
4125
+ "template_version_created_by_user_id_fk": {
4126
+ "name": "template_version_created_by_user_id_fk",
4127
+ "tableFrom": "template_version",
4128
+ "tableTo": "user",
4129
+ "columnsFrom": ["created_by"],
4130
+ "columnsTo": ["id"],
4131
+ "onDelete": "set null",
4132
+ "onUpdate": "no action"
4133
+ }
4134
+ },
4135
+ "compositePrimaryKeys": {},
4136
+ "uniqueConstraints": {},
4137
+ "policies": {},
4138
+ "checkConstraints": {},
4139
+ "isRLSEnabled": false
4140
+ },
4141
+ "public.ai_usage_log": {
4142
+ "name": "ai_usage_log",
4143
+ "schema": "",
4144
+ "columns": {
4145
+ "id": {
4146
+ "name": "id",
4147
+ "type": "text",
4148
+ "primaryKey": true,
4149
+ "notNull": true
4150
+ },
4151
+ "organization_id": {
4152
+ "name": "organization_id",
4153
+ "type": "text",
4154
+ "primaryKey": false,
4155
+ "notNull": true
4156
+ },
4157
+ "user_id": {
4158
+ "name": "user_id",
4159
+ "type": "text",
4160
+ "primaryKey": false,
4161
+ "notNull": false
4162
+ },
4163
+ "period_key": {
4164
+ "name": "period_key",
4165
+ "type": "text",
4166
+ "primaryKey": false,
4167
+ "notNull": true
4168
+ },
4169
+ "feature_type": {
4170
+ "name": "feature_type",
4171
+ "type": "text",
4172
+ "primaryKey": false,
4173
+ "notNull": true,
4174
+ "default": "'ai_chat'"
4175
+ },
4176
+ "template_id": {
4177
+ "name": "template_id",
4178
+ "type": "text",
4179
+ "primaryKey": false,
4180
+ "notNull": false
4181
+ },
4182
+ "input_tokens": {
4183
+ "name": "input_tokens",
4184
+ "type": "integer",
4185
+ "primaryKey": false,
4186
+ "notNull": false
4187
+ },
4188
+ "output_tokens": {
4189
+ "name": "output_tokens",
4190
+ "type": "integer",
4191
+ "primaryKey": false,
4192
+ "notNull": false
4193
+ },
4194
+ "total_tokens": {
4195
+ "name": "total_tokens",
4196
+ "type": "integer",
4197
+ "primaryKey": false,
4198
+ "notNull": false
4199
+ },
4200
+ "model": {
4201
+ "name": "model",
4202
+ "type": "text",
4203
+ "primaryKey": false,
4204
+ "notNull": false
4205
+ },
4206
+ "duration_ms": {
4207
+ "name": "duration_ms",
4208
+ "type": "integer",
4209
+ "primaryKey": false,
4210
+ "notNull": false
4211
+ },
4212
+ "created_at": {
4213
+ "name": "created_at",
4214
+ "type": "timestamp",
4215
+ "primaryKey": false,
4216
+ "notNull": true,
4217
+ "default": "now()"
4218
+ }
4219
+ },
4220
+ "indexes": {
4221
+ "ai_usage_log_org_idx": {
4222
+ "name": "ai_usage_log_org_idx",
4223
+ "columns": [
4224
+ {
4225
+ "expression": "organization_id",
4226
+ "isExpression": false,
4227
+ "asc": true,
4228
+ "nulls": "last"
4229
+ }
4230
+ ],
4231
+ "isUnique": false,
4232
+ "concurrently": false,
4233
+ "method": "btree",
4234
+ "with": {}
4235
+ },
4236
+ "ai_usage_log_period_idx": {
4237
+ "name": "ai_usage_log_period_idx",
4238
+ "columns": [
4239
+ {
4240
+ "expression": "period_key",
4241
+ "isExpression": false,
4242
+ "asc": true,
4243
+ "nulls": "last"
4244
+ }
4245
+ ],
4246
+ "isUnique": false,
4247
+ "concurrently": false,
4248
+ "method": "btree",
4249
+ "with": {}
4250
+ },
4251
+ "ai_usage_log_org_period_idx": {
4252
+ "name": "ai_usage_log_org_period_idx",
4253
+ "columns": [
4254
+ {
4255
+ "expression": "organization_id",
4256
+ "isExpression": false,
4257
+ "asc": true,
4258
+ "nulls": "last"
4259
+ },
4260
+ {
4261
+ "expression": "period_key",
4262
+ "isExpression": false,
4263
+ "asc": true,
4264
+ "nulls": "last"
4265
+ }
4266
+ ],
4267
+ "isUnique": false,
4268
+ "concurrently": false,
4269
+ "method": "btree",
4270
+ "with": {}
4271
+ },
4272
+ "ai_usage_log_user_idx": {
4273
+ "name": "ai_usage_log_user_idx",
4274
+ "columns": [
4275
+ {
4276
+ "expression": "user_id",
4277
+ "isExpression": false,
4278
+ "asc": true,
4279
+ "nulls": "last"
4280
+ }
4281
+ ],
4282
+ "isUnique": false,
4283
+ "concurrently": false,
4284
+ "method": "btree",
4285
+ "with": {}
4286
+ },
4287
+ "ai_usage_log_created_idx": {
4288
+ "name": "ai_usage_log_created_idx",
4289
+ "columns": [
4290
+ {
4291
+ "expression": "created_at",
4292
+ "isExpression": false,
4293
+ "asc": true,
4294
+ "nulls": "last"
4295
+ }
4296
+ ],
4297
+ "isUnique": false,
4298
+ "concurrently": false,
4299
+ "method": "btree",
4300
+ "with": {}
4301
+ }
4302
+ },
4303
+ "foreignKeys": {
4304
+ "ai_usage_log_organization_id_organization_id_fk": {
4305
+ "name": "ai_usage_log_organization_id_organization_id_fk",
4306
+ "tableFrom": "ai_usage_log",
4307
+ "tableTo": "organization",
4308
+ "columnsFrom": ["organization_id"],
4309
+ "columnsTo": ["id"],
4310
+ "onDelete": "cascade",
4311
+ "onUpdate": "no action"
4312
+ },
4313
+ "ai_usage_log_user_id_user_id_fk": {
4314
+ "name": "ai_usage_log_user_id_user_id_fk",
4315
+ "tableFrom": "ai_usage_log",
4316
+ "tableTo": "user",
4317
+ "columnsFrom": ["user_id"],
4318
+ "columnsTo": ["id"],
4319
+ "onDelete": "set null",
4320
+ "onUpdate": "no action"
4321
+ }
4322
+ },
4323
+ "compositePrimaryKeys": {},
4324
+ "uniqueConstraints": {},
4325
+ "policies": {},
4326
+ "checkConstraints": {},
4327
+ "isRLSEnabled": false
4328
+ },
4329
+ "public.ai_usage_monthly": {
4330
+ "name": "ai_usage_monthly",
4331
+ "schema": "",
4332
+ "columns": {
4333
+ "id": {
4334
+ "name": "id",
4335
+ "type": "text",
4336
+ "primaryKey": true,
4337
+ "notNull": true
4338
+ },
4339
+ "organization_id": {
4340
+ "name": "organization_id",
4341
+ "type": "text",
4342
+ "primaryKey": false,
4343
+ "notNull": true
4344
+ },
4345
+ "period_key": {
4346
+ "name": "period_key",
4347
+ "type": "text",
4348
+ "primaryKey": false,
4349
+ "notNull": true
4350
+ },
4351
+ "message_count": {
4352
+ "name": "message_count",
4353
+ "type": "integer",
4354
+ "primaryKey": false,
4355
+ "notNull": true,
4356
+ "default": 0
4357
+ },
4358
+ "updated_at": {
4359
+ "name": "updated_at",
4360
+ "type": "timestamp",
4361
+ "primaryKey": false,
4362
+ "notNull": true,
4363
+ "default": "now()"
4364
+ }
4365
+ },
4366
+ "indexes": {
4367
+ "ai_usage_monthly_org_period_idx": {
4368
+ "name": "ai_usage_monthly_org_period_idx",
4369
+ "columns": [
4370
+ {
4371
+ "expression": "organization_id",
4372
+ "isExpression": false,
4373
+ "asc": true,
4374
+ "nulls": "last"
4375
+ },
4376
+ {
4377
+ "expression": "period_key",
4378
+ "isExpression": false,
4379
+ "asc": true,
4380
+ "nulls": "last"
4381
+ }
4382
+ ],
4383
+ "isUnique": true,
4384
+ "concurrently": false,
4385
+ "method": "btree",
4386
+ "with": {}
4387
+ },
4388
+ "ai_usage_monthly_period_idx": {
4389
+ "name": "ai_usage_monthly_period_idx",
4390
+ "columns": [
4391
+ {
4392
+ "expression": "period_key",
4393
+ "isExpression": false,
4394
+ "asc": true,
4395
+ "nulls": "last"
4396
+ }
4397
+ ],
4398
+ "isUnique": false,
4399
+ "concurrently": false,
4400
+ "method": "btree",
4401
+ "with": {}
4402
+ }
4403
+ },
4404
+ "foreignKeys": {
4405
+ "ai_usage_monthly_organization_id_organization_id_fk": {
4406
+ "name": "ai_usage_monthly_organization_id_organization_id_fk",
4407
+ "tableFrom": "ai_usage_monthly",
4408
+ "tableTo": "organization",
4409
+ "columnsFrom": ["organization_id"],
4410
+ "columnsTo": ["id"],
4411
+ "onDelete": "cascade",
4412
+ "onUpdate": "no action"
4413
+ }
4414
+ },
4415
+ "compositePrimaryKeys": {},
4416
+ "uniqueConstraints": {},
4417
+ "policies": {},
4418
+ "checkConstraints": {},
4419
+ "isRLSEnabled": false
4420
+ },
4421
+ "public.api_rate_limit_window": {
4422
+ "name": "api_rate_limit_window",
4423
+ "schema": "",
4424
+ "columns": {
4425
+ "id": {
4426
+ "name": "id",
4427
+ "type": "text",
4428
+ "primaryKey": true,
4429
+ "notNull": true
4430
+ },
4431
+ "organization_id": {
4432
+ "name": "organization_id",
4433
+ "type": "text",
4434
+ "primaryKey": false,
4435
+ "notNull": true
4436
+ },
4437
+ "minute_key": {
4438
+ "name": "minute_key",
4439
+ "type": "text",
4440
+ "primaryKey": false,
4441
+ "notNull": true
4442
+ },
4443
+ "request_count": {
4444
+ "name": "request_count",
4445
+ "type": "integer",
4446
+ "primaryKey": false,
4447
+ "notNull": true,
4448
+ "default": 0
4449
+ },
4450
+ "expires_at": {
4451
+ "name": "expires_at",
4452
+ "type": "timestamp",
4453
+ "primaryKey": false,
4454
+ "notNull": true
4455
+ }
4456
+ },
4457
+ "indexes": {
4458
+ "api_rate_limit_org_minute_idx": {
4459
+ "name": "api_rate_limit_org_minute_idx",
4460
+ "columns": [
4461
+ {
4462
+ "expression": "organization_id",
4463
+ "isExpression": false,
4464
+ "asc": true,
4465
+ "nulls": "last"
4466
+ },
4467
+ {
4468
+ "expression": "minute_key",
4469
+ "isExpression": false,
4470
+ "asc": true,
4471
+ "nulls": "last"
4472
+ }
4473
+ ],
4474
+ "isUnique": true,
4475
+ "concurrently": false,
4476
+ "method": "btree",
4477
+ "with": {}
4478
+ },
4479
+ "api_rate_limit_expires_idx": {
4480
+ "name": "api_rate_limit_expires_idx",
4481
+ "columns": [
4482
+ {
4483
+ "expression": "expires_at",
4484
+ "isExpression": false,
4485
+ "asc": true,
4486
+ "nulls": "last"
4487
+ }
4488
+ ],
4489
+ "isUnique": false,
4490
+ "concurrently": false,
4491
+ "method": "btree",
4492
+ "with": {}
4493
+ }
4494
+ },
4495
+ "foreignKeys": {
4496
+ "api_rate_limit_window_organization_id_organization_id_fk": {
4497
+ "name": "api_rate_limit_window_organization_id_organization_id_fk",
4498
+ "tableFrom": "api_rate_limit_window",
4499
+ "tableTo": "organization",
4500
+ "columnsFrom": ["organization_id"],
4501
+ "columnsTo": ["id"],
4502
+ "onDelete": "cascade",
4503
+ "onUpdate": "no action"
4504
+ }
4505
+ },
4506
+ "compositePrimaryKeys": {},
4507
+ "uniqueConstraints": {},
4508
+ "policies": {},
4509
+ "checkConstraints": {},
4510
+ "isRLSEnabled": false
4511
+ },
4512
+ "public.api_usage_daily": {
4513
+ "name": "api_usage_daily",
4514
+ "schema": "",
4515
+ "columns": {
4516
+ "id": {
4517
+ "name": "id",
4518
+ "type": "text",
4519
+ "primaryKey": true,
4520
+ "notNull": true
4521
+ },
4522
+ "organization_id": {
4523
+ "name": "organization_id",
4524
+ "type": "text",
4525
+ "primaryKey": false,
4526
+ "notNull": true
4527
+ },
4528
+ "date_key": {
4529
+ "name": "date_key",
4530
+ "type": "text",
4531
+ "primaryKey": false,
4532
+ "notNull": true
4533
+ },
4534
+ "request_count": {
4535
+ "name": "request_count",
4536
+ "type": "integer",
4537
+ "primaryKey": false,
4538
+ "notNull": true,
4539
+ "default": 0
4540
+ },
4541
+ "updated_at": {
4542
+ "name": "updated_at",
4543
+ "type": "timestamp",
4544
+ "primaryKey": false,
4545
+ "notNull": true,
4546
+ "default": "now()"
4547
+ }
4548
+ },
4549
+ "indexes": {
4550
+ "api_usage_daily_org_date_idx": {
4551
+ "name": "api_usage_daily_org_date_idx",
4552
+ "columns": [
4553
+ {
4554
+ "expression": "organization_id",
4555
+ "isExpression": false,
4556
+ "asc": true,
4557
+ "nulls": "last"
4558
+ },
4559
+ {
4560
+ "expression": "date_key",
4561
+ "isExpression": false,
4562
+ "asc": true,
4563
+ "nulls": "last"
4564
+ }
4565
+ ],
4566
+ "isUnique": true,
4567
+ "concurrently": false,
4568
+ "method": "btree",
4569
+ "with": {}
4570
+ },
4571
+ "api_usage_daily_date_idx": {
4572
+ "name": "api_usage_daily_date_idx",
4573
+ "columns": [
4574
+ {
4575
+ "expression": "date_key",
4576
+ "isExpression": false,
4577
+ "asc": true,
4578
+ "nulls": "last"
4579
+ }
4580
+ ],
4581
+ "isUnique": false,
4582
+ "concurrently": false,
4583
+ "method": "btree",
4584
+ "with": {}
4585
+ }
4586
+ },
4587
+ "foreignKeys": {
4588
+ "api_usage_daily_organization_id_organization_id_fk": {
4589
+ "name": "api_usage_daily_organization_id_organization_id_fk",
4590
+ "tableFrom": "api_usage_daily",
4591
+ "tableTo": "organization",
4592
+ "columnsFrom": ["organization_id"],
4593
+ "columnsTo": ["id"],
4594
+ "onDelete": "cascade",
4595
+ "onUpdate": "no action"
4596
+ }
4597
+ },
4598
+ "compositePrimaryKeys": {},
4599
+ "uniqueConstraints": {},
4600
+ "policies": {},
4601
+ "checkConstraints": {},
4602
+ "isRLSEnabled": false
4603
+ },
4604
+ "public.waitlist": {
4605
+ "name": "waitlist",
4606
+ "schema": "",
4607
+ "columns": {
4608
+ "id": {
4609
+ "name": "id",
4610
+ "type": "text",
4611
+ "primaryKey": true,
4612
+ "notNull": true
4613
+ },
4614
+ "email": {
4615
+ "name": "email",
4616
+ "type": "text",
4617
+ "primaryKey": false,
4618
+ "notNull": true
4619
+ },
4620
+ "email_hash": {
4621
+ "name": "email_hash",
4622
+ "type": "text",
4623
+ "primaryKey": false,
4624
+ "notNull": true
4625
+ },
4626
+ "product": {
4627
+ "name": "product",
4628
+ "type": "text",
4629
+ "primaryKey": false,
4630
+ "notNull": true
4631
+ },
4632
+ "source": {
4633
+ "name": "source",
4634
+ "type": "text",
4635
+ "primaryKey": false,
4636
+ "notNull": false
4637
+ },
4638
+ "referrer": {
4639
+ "name": "referrer",
4640
+ "type": "text",
4641
+ "primaryKey": false,
4642
+ "notNull": false
4643
+ },
4644
+ "created_at": {
4645
+ "name": "created_at",
4646
+ "type": "timestamp",
4647
+ "primaryKey": false,
4648
+ "notNull": true,
4649
+ "default": "now()"
4650
+ }
4651
+ },
4652
+ "indexes": {
4653
+ "waitlist_email_product_idx": {
4654
+ "name": "waitlist_email_product_idx",
4655
+ "columns": [
4656
+ {
4657
+ "expression": "email_hash",
4658
+ "isExpression": false,
4659
+ "asc": true,
4660
+ "nulls": "last"
4661
+ },
4662
+ {
4663
+ "expression": "product",
4664
+ "isExpression": false,
4665
+ "asc": true,
4666
+ "nulls": "last"
4667
+ }
4668
+ ],
4669
+ "isUnique": true,
4670
+ "concurrently": false,
4671
+ "method": "btree",
4672
+ "with": {}
4673
+ },
4674
+ "waitlist_product_idx": {
4675
+ "name": "waitlist_product_idx",
4676
+ "columns": [
4677
+ {
4678
+ "expression": "product",
4679
+ "isExpression": false,
4680
+ "asc": true,
4681
+ "nulls": "last"
4682
+ }
4683
+ ],
4684
+ "isUnique": false,
4685
+ "concurrently": false,
4686
+ "method": "btree",
4687
+ "with": {}
4688
+ },
4689
+ "waitlist_created_at_idx": {
4690
+ "name": "waitlist_created_at_idx",
4691
+ "columns": [
4692
+ {
4693
+ "expression": "created_at",
4694
+ "isExpression": false,
4695
+ "asc": true,
4696
+ "nulls": "last"
4697
+ }
4698
+ ],
4699
+ "isUnique": false,
4700
+ "concurrently": false,
4701
+ "method": "btree",
4702
+ "with": {}
4703
+ }
4704
+ },
4705
+ "foreignKeys": {},
4706
+ "compositePrimaryKeys": {},
4707
+ "uniqueConstraints": {},
4708
+ "policies": {},
4709
+ "checkConstraints": {},
4710
+ "isRLSEnabled": false
4711
+ }
4712
+ },
4713
+ "enums": {
4714
+ "public.batch_send_status": {
4715
+ "name": "batch_send_status",
4716
+ "schema": "public",
4717
+ "values": [
4718
+ "draft",
4719
+ "scheduled",
4720
+ "queued",
4721
+ "processing",
4722
+ "completed",
4723
+ "failed",
4724
+ "cancelled"
4725
+ ]
4726
+ },
4727
+ "public.message_send_status": {
4728
+ "name": "message_send_status",
4729
+ "schema": "public",
4730
+ "values": [
4731
+ "pending",
4732
+ "queued",
4733
+ "sent",
4734
+ "delivered",
4735
+ "opened",
4736
+ "clicked",
4737
+ "bounced",
4738
+ "complained",
4739
+ "failed",
4740
+ "opted_out"
4741
+ ]
4742
+ },
4743
+ "public.message_source_type": {
4744
+ "name": "message_source_type",
4745
+ "schema": "public",
4746
+ "values": ["transactional", "batch", "campaign", "workflow"]
4747
+ },
4748
+ "public.template_status": {
4749
+ "name": "template_status",
4750
+ "schema": "public",
4751
+ "values": ["DRAFT", "PUBLISHED", "ARCHIVED"]
4752
+ },
4753
+ "public.variable_type": {
4754
+ "name": "variable_type",
4755
+ "schema": "public",
4756
+ "values": ["TEXT", "NUMBER", "BOOLEAN", "DATE", "URL", "EMAIL"]
4757
+ }
4758
+ },
4759
+ "schemas": {},
4760
+ "sequences": {},
4761
+ "roles": {},
4762
+ "policies": {},
4763
+ "views": {},
4764
+ "_meta": {
4765
+ "columns": {},
4766
+ "schemas": {},
4767
+ "tables": {}
4768
+ }
4769
+ }