@claroshq/claros 0.0.0-stage → 0.8.3

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 (92) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -2
  3. package/assets/dashboard/apple-touch-icon.png +0 -0
  4. package/assets/dashboard/assets/bricolage-grotesque-latin-ext-wght-normal-CcLUaPy7.woff2 +0 -0
  5. package/assets/dashboard/assets/bricolage-grotesque-latin-wght-normal-DLoelf7F.woff2 +0 -0
  6. package/assets/dashboard/assets/bricolage-grotesque-vietnamese-wght-normal-BUzh504Q.woff2 +0 -0
  7. package/assets/dashboard/assets/index-Dvs1k10B.js +23 -0
  8. package/assets/dashboard/assets/index-gR64IOwq.css +1 -0
  9. package/assets/dashboard/assets/instrument-sans-latin-ext-wght-normal-B5bTHO_g.woff2 +0 -0
  10. package/assets/dashboard/assets/instrument-sans-latin-wght-normal-BbzFLZTg.woff2 +0 -0
  11. package/assets/dashboard/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
  12. package/assets/dashboard/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  13. package/assets/dashboard/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  14. package/assets/dashboard/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  15. package/assets/dashboard/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  16. package/assets/dashboard/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  17. package/assets/dashboard/assets/quicksand-latin-ext-wght-normal-CrJ75Ewg.woff2 +0 -0
  18. package/assets/dashboard/assets/quicksand-latin-wght-normal-Buj9m_3d.woff2 +0 -0
  19. package/assets/dashboard/assets/quicksand-vietnamese-wght-normal-ei70gACF.woff2 +0 -0
  20. package/assets/dashboard/claros.js +122 -0
  21. package/assets/dashboard/favicon-16.png +0 -0
  22. package/assets/dashboard/favicon-32.png +0 -0
  23. package/assets/dashboard/favicon.ico +0 -0
  24. package/assets/dashboard/favicon.svg +17 -0
  25. package/assets/dashboard/fonts-license.txt +119 -0
  26. package/assets/dashboard/index.html +34 -0
  27. package/assets/migrations/0000_baseline.sql +343 -0
  28. package/assets/migrations/0001_kb_fts.sql +22 -0
  29. package/assets/migrations/0002_instance_layer.sql +51 -0
  30. package/assets/migrations/0003_suppressions_lower_email.sql +22 -0
  31. package/assets/migrations/0004_claim_tokens.sql +9 -0
  32. package/assets/migrations/0005_topics_transports.sql +36 -0
  33. package/assets/migrations/0006_ops_alerts.sql +28 -0
  34. package/assets/migrations/0007_integration_surface.sql +46 -0
  35. package/assets/migrations/0008_p5_engine.sql +31 -0
  36. package/assets/migrations/0009_p5b_readiness.sql +11 -0
  37. package/assets/migrations/meta/0000_snapshot.json +2489 -0
  38. package/assets/migrations/meta/0002_snapshot.json +2645 -0
  39. package/assets/migrations/meta/0004_snapshot.json +2698 -0
  40. package/assets/migrations/meta/0005_snapshot.json +2959 -0
  41. package/assets/migrations/meta/0006_snapshot.json +3138 -0
  42. package/assets/migrations/meta/0007_snapshot.json +3469 -0
  43. package/assets/migrations/meta/0008_snapshot.json +3709 -0
  44. package/assets/migrations/meta/0009_snapshot.json +3785 -0
  45. package/assets/migrations/meta/_journal.json +76 -0
  46. package/assets/worker/index.js +57863 -0
  47. package/bin/claros.mjs +13 -0
  48. package/dist/apply.d.ts +10 -0
  49. package/dist/apply.d.ts.map +1 -0
  50. package/dist/apply.js +72 -0
  51. package/dist/apply.js.map +1 -0
  52. package/dist/assets.d.ts +15 -0
  53. package/dist/assets.d.ts.map +1 -0
  54. package/dist/assets.js +48 -0
  55. package/dist/assets.js.map +1 -0
  56. package/dist/claim.d.ts +12 -0
  57. package/dist/claim.d.ts.map +1 -0
  58. package/dist/claim.js +26 -0
  59. package/dist/claim.js.map +1 -0
  60. package/dist/cli.d.ts +13 -0
  61. package/dist/cli.d.ts.map +1 -0
  62. package/dist/cli.js +158 -0
  63. package/dist/cli.js.map +1 -0
  64. package/dist/cloudflare-api.d.ts +48 -0
  65. package/dist/cloudflare-api.d.ts.map +1 -0
  66. package/dist/cloudflare-api.js +94 -0
  67. package/dist/cloudflare-api.js.map +1 -0
  68. package/dist/import.d.ts +16 -0
  69. package/dist/import.d.ts.map +1 -0
  70. package/dist/import.js +97 -0
  71. package/dist/import.js.map +1 -0
  72. package/dist/ops.d.ts +84 -0
  73. package/dist/ops.d.ts.map +1 -0
  74. package/dist/ops.js +552 -0
  75. package/dist/ops.js.map +1 -0
  76. package/dist/state.d.ts +53 -0
  77. package/dist/state.d.ts.map +1 -0
  78. package/dist/state.js +87 -0
  79. package/dist/state.js.map +1 -0
  80. package/dist/template.d.ts +77 -0
  81. package/dist/template.d.ts.map +1 -0
  82. package/dist/template.js +127 -0
  83. package/dist/template.js.map +1 -0
  84. package/dist/version.d.ts +3 -0
  85. package/dist/version.d.ts.map +1 -0
  86. package/dist/version.js +36 -0
  87. package/dist/version.js.map +1 -0
  88. package/dist/wrangler.d.ts +116 -0
  89. package/dist/wrangler.d.ts.map +1 -0
  90. package/dist/wrangler.js +210 -0
  91. package/dist/wrangler.js.map +1 -0
  92. package/package.json +53 -4
@@ -0,0 +1,3469 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "958ad852-09d3-49d8-a439-c10b567dcec3",
5
+ "prevId": "b29bf8a8-c33c-4f2b-b153-1b9121f2fc47",
6
+ "tables": {
7
+ "api_keys": {
8
+ "name": "api_keys",
9
+ "columns": {
10
+ "id": {
11
+ "name": "id",
12
+ "type": "text",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "tenant_id": {
18
+ "name": "tenant_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": false,
22
+ "autoincrement": false
23
+ },
24
+ "key_hash": {
25
+ "name": "key_hash",
26
+ "type": "text",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ },
31
+ "prefix": {
32
+ "name": "prefix",
33
+ "type": "text",
34
+ "primaryKey": false,
35
+ "notNull": true,
36
+ "autoincrement": false
37
+ },
38
+ "label": {
39
+ "name": "label",
40
+ "type": "text",
41
+ "primaryKey": false,
42
+ "notNull": false,
43
+ "autoincrement": false
44
+ },
45
+ "kind": {
46
+ "name": "kind",
47
+ "type": "text",
48
+ "primaryKey": false,
49
+ "notNull": true,
50
+ "autoincrement": false,
51
+ "default": "'secret'"
52
+ },
53
+ "allowed_origins": {
54
+ "name": "allowed_origins",
55
+ "type": "text",
56
+ "primaryKey": false,
57
+ "notNull": false,
58
+ "autoincrement": false
59
+ },
60
+ "scopes": {
61
+ "name": "scopes",
62
+ "type": "text",
63
+ "primaryKey": false,
64
+ "notNull": false,
65
+ "autoincrement": false
66
+ },
67
+ "last_used_at": {
68
+ "name": "last_used_at",
69
+ "type": "integer",
70
+ "primaryKey": false,
71
+ "notNull": false,
72
+ "autoincrement": false
73
+ },
74
+ "created_at": {
75
+ "name": "created_at",
76
+ "type": "integer",
77
+ "primaryKey": false,
78
+ "notNull": false,
79
+ "autoincrement": false
80
+ },
81
+ "revoked_at": {
82
+ "name": "revoked_at",
83
+ "type": "integer",
84
+ "primaryKey": false,
85
+ "notNull": false,
86
+ "autoincrement": false
87
+ }
88
+ },
89
+ "indexes": {
90
+ "uq_api_keys_hash_active": {
91
+ "name": "uq_api_keys_hash_active",
92
+ "columns": [
93
+ "key_hash"
94
+ ],
95
+ "isUnique": true,
96
+ "where": "revoked_at IS NULL"
97
+ },
98
+ "idx_api_keys_tenant": {
99
+ "name": "idx_api_keys_tenant",
100
+ "columns": [
101
+ "tenant_id"
102
+ ],
103
+ "isUnique": false
104
+ }
105
+ },
106
+ "foreignKeys": {
107
+ "api_keys_tenant_id_tenants_id_fk": {
108
+ "name": "api_keys_tenant_id_tenants_id_fk",
109
+ "tableFrom": "api_keys",
110
+ "tableTo": "tenants",
111
+ "columnsFrom": [
112
+ "tenant_id"
113
+ ],
114
+ "columnsTo": [
115
+ "id"
116
+ ],
117
+ "onDelete": "no action",
118
+ "onUpdate": "no action"
119
+ }
120
+ },
121
+ "compositePrimaryKeys": {},
122
+ "uniqueConstraints": {},
123
+ "checkConstraints": {}
124
+ },
125
+ "claim_tokens": {
126
+ "name": "claim_tokens",
127
+ "columns": {
128
+ "id": {
129
+ "name": "id",
130
+ "type": "text",
131
+ "primaryKey": true,
132
+ "notNull": true,
133
+ "autoincrement": false
134
+ },
135
+ "token_hash": {
136
+ "name": "token_hash",
137
+ "type": "text",
138
+ "primaryKey": false,
139
+ "notNull": true,
140
+ "autoincrement": false
141
+ },
142
+ "expires_at": {
143
+ "name": "expires_at",
144
+ "type": "integer",
145
+ "primaryKey": false,
146
+ "notNull": true,
147
+ "autoincrement": false
148
+ },
149
+ "consumed_at": {
150
+ "name": "consumed_at",
151
+ "type": "integer",
152
+ "primaryKey": false,
153
+ "notNull": false,
154
+ "autoincrement": false
155
+ },
156
+ "created_at": {
157
+ "name": "created_at",
158
+ "type": "integer",
159
+ "primaryKey": false,
160
+ "notNull": false,
161
+ "autoincrement": false
162
+ }
163
+ },
164
+ "indexes": {
165
+ "uq_claim_tokens_token_hash": {
166
+ "name": "uq_claim_tokens_token_hash",
167
+ "columns": [
168
+ "token_hash"
169
+ ],
170
+ "isUnique": true
171
+ }
172
+ },
173
+ "foreignKeys": {},
174
+ "compositePrimaryKeys": {},
175
+ "uniqueConstraints": {},
176
+ "checkConstraints": {}
177
+ },
178
+ "contact_conflicts": {
179
+ "name": "contact_conflicts",
180
+ "columns": {
181
+ "id": {
182
+ "name": "id",
183
+ "type": "text",
184
+ "primaryKey": true,
185
+ "notNull": true,
186
+ "autoincrement": false
187
+ },
188
+ "tenant_id": {
189
+ "name": "tenant_id",
190
+ "type": "text",
191
+ "primaryKey": false,
192
+ "notNull": true,
193
+ "autoincrement": false
194
+ },
195
+ "contact_id": {
196
+ "name": "contact_id",
197
+ "type": "text",
198
+ "primaryKey": false,
199
+ "notNull": true,
200
+ "autoincrement": false
201
+ },
202
+ "field": {
203
+ "name": "field",
204
+ "type": "text",
205
+ "primaryKey": false,
206
+ "notNull": true,
207
+ "autoincrement": false
208
+ },
209
+ "rejected_value": {
210
+ "name": "rejected_value",
211
+ "type": "text",
212
+ "primaryKey": false,
213
+ "notNull": true,
214
+ "autoincrement": false
215
+ },
216
+ "event_id": {
217
+ "name": "event_id",
218
+ "type": "text",
219
+ "primaryKey": false,
220
+ "notNull": true,
221
+ "autoincrement": false
222
+ },
223
+ "created_at": {
224
+ "name": "created_at",
225
+ "type": "integer",
226
+ "primaryKey": false,
227
+ "notNull": false,
228
+ "autoincrement": false
229
+ }
230
+ },
231
+ "indexes": {
232
+ "idx_contact_conflicts_tenant": {
233
+ "name": "idx_contact_conflicts_tenant",
234
+ "columns": [
235
+ "tenant_id",
236
+ "created_at"
237
+ ],
238
+ "isUnique": false
239
+ },
240
+ "idx_contact_conflicts_contact": {
241
+ "name": "idx_contact_conflicts_contact",
242
+ "columns": [
243
+ "contact_id"
244
+ ],
245
+ "isUnique": false
246
+ }
247
+ },
248
+ "foreignKeys": {
249
+ "contact_conflicts_tenant_id_tenants_id_fk": {
250
+ "name": "contact_conflicts_tenant_id_tenants_id_fk",
251
+ "tableFrom": "contact_conflicts",
252
+ "tableTo": "tenants",
253
+ "columnsFrom": [
254
+ "tenant_id"
255
+ ],
256
+ "columnsTo": [
257
+ "id"
258
+ ],
259
+ "onDelete": "no action",
260
+ "onUpdate": "no action"
261
+ },
262
+ "contact_conflicts_contact_id_contacts_id_fk": {
263
+ "name": "contact_conflicts_contact_id_contacts_id_fk",
264
+ "tableFrom": "contact_conflicts",
265
+ "tableTo": "contacts",
266
+ "columnsFrom": [
267
+ "contact_id"
268
+ ],
269
+ "columnsTo": [
270
+ "id"
271
+ ],
272
+ "onDelete": "no action",
273
+ "onUpdate": "no action"
274
+ }
275
+ },
276
+ "compositePrimaryKeys": {},
277
+ "uniqueConstraints": {},
278
+ "checkConstraints": {}
279
+ },
280
+ "contact_topics": {
281
+ "name": "contact_topics",
282
+ "columns": {
283
+ "tenant_id": {
284
+ "name": "tenant_id",
285
+ "type": "text",
286
+ "primaryKey": false,
287
+ "notNull": true,
288
+ "autoincrement": false
289
+ },
290
+ "contact_id": {
291
+ "name": "contact_id",
292
+ "type": "text",
293
+ "primaryKey": false,
294
+ "notNull": true,
295
+ "autoincrement": false
296
+ },
297
+ "topic_id": {
298
+ "name": "topic_id",
299
+ "type": "text",
300
+ "primaryKey": false,
301
+ "notNull": true,
302
+ "autoincrement": false
303
+ },
304
+ "status": {
305
+ "name": "status",
306
+ "type": "text",
307
+ "primaryKey": false,
308
+ "notNull": true,
309
+ "autoincrement": false
310
+ },
311
+ "updated_at": {
312
+ "name": "updated_at",
313
+ "type": "integer",
314
+ "primaryKey": false,
315
+ "notNull": false,
316
+ "autoincrement": false
317
+ },
318
+ "source": {
319
+ "name": "source",
320
+ "type": "text",
321
+ "primaryKey": false,
322
+ "notNull": false,
323
+ "autoincrement": false
324
+ }
325
+ },
326
+ "indexes": {
327
+ "idx_contact_topics_tenant_topic": {
328
+ "name": "idx_contact_topics_tenant_topic",
329
+ "columns": [
330
+ "tenant_id",
331
+ "topic_id"
332
+ ],
333
+ "isUnique": false
334
+ }
335
+ },
336
+ "foreignKeys": {
337
+ "contact_topics_tenant_id_tenants_id_fk": {
338
+ "name": "contact_topics_tenant_id_tenants_id_fk",
339
+ "tableFrom": "contact_topics",
340
+ "tableTo": "tenants",
341
+ "columnsFrom": [
342
+ "tenant_id"
343
+ ],
344
+ "columnsTo": [
345
+ "id"
346
+ ],
347
+ "onDelete": "no action",
348
+ "onUpdate": "no action"
349
+ },
350
+ "contact_topics_contact_id_contacts_id_fk": {
351
+ "name": "contact_topics_contact_id_contacts_id_fk",
352
+ "tableFrom": "contact_topics",
353
+ "tableTo": "contacts",
354
+ "columnsFrom": [
355
+ "contact_id"
356
+ ],
357
+ "columnsTo": [
358
+ "id"
359
+ ],
360
+ "onDelete": "no action",
361
+ "onUpdate": "no action"
362
+ },
363
+ "contact_topics_topic_id_topics_id_fk": {
364
+ "name": "contact_topics_topic_id_topics_id_fk",
365
+ "tableFrom": "contact_topics",
366
+ "tableTo": "topics",
367
+ "columnsFrom": [
368
+ "topic_id"
369
+ ],
370
+ "columnsTo": [
371
+ "id"
372
+ ],
373
+ "onDelete": "no action",
374
+ "onUpdate": "no action"
375
+ }
376
+ },
377
+ "compositePrimaryKeys": {
378
+ "contact_topics_pkey": {
379
+ "columns": [
380
+ "contact_id",
381
+ "topic_id"
382
+ ],
383
+ "name": "contact_topics_pkey"
384
+ }
385
+ },
386
+ "uniqueConstraints": {},
387
+ "checkConstraints": {}
388
+ },
389
+ "contacts": {
390
+ "name": "contacts",
391
+ "columns": {
392
+ "id": {
393
+ "name": "id",
394
+ "type": "text",
395
+ "primaryKey": true,
396
+ "notNull": true,
397
+ "autoincrement": false
398
+ },
399
+ "tenant_id": {
400
+ "name": "tenant_id",
401
+ "type": "text",
402
+ "primaryKey": false,
403
+ "notNull": true,
404
+ "autoincrement": false
405
+ },
406
+ "external_id": {
407
+ "name": "external_id",
408
+ "type": "text",
409
+ "primaryKey": false,
410
+ "notNull": true,
411
+ "autoincrement": false
412
+ },
413
+ "email": {
414
+ "name": "email",
415
+ "type": "text",
416
+ "primaryKey": false,
417
+ "notNull": false,
418
+ "autoincrement": false
419
+ },
420
+ "name": {
421
+ "name": "name",
422
+ "type": "text",
423
+ "primaryKey": false,
424
+ "notNull": false,
425
+ "autoincrement": false
426
+ },
427
+ "company": {
428
+ "name": "company",
429
+ "type": "text",
430
+ "primaryKey": false,
431
+ "notNull": false,
432
+ "autoincrement": false
433
+ },
434
+ "properties": {
435
+ "name": "properties",
436
+ "type": "text",
437
+ "primaryKey": false,
438
+ "notNull": false,
439
+ "autoincrement": false
440
+ },
441
+ "lifecycle_state": {
442
+ "name": "lifecycle_state",
443
+ "type": "text",
444
+ "primaryKey": false,
445
+ "notNull": true,
446
+ "autoincrement": false
447
+ },
448
+ "engagement_depth": {
449
+ "name": "engagement_depth",
450
+ "type": "text",
451
+ "primaryKey": false,
452
+ "notNull": false,
453
+ "autoincrement": false
454
+ },
455
+ "payment_status": {
456
+ "name": "payment_status",
457
+ "type": "text",
458
+ "primaryKey": false,
459
+ "notNull": false,
460
+ "autoincrement": false,
461
+ "default": "'free'"
462
+ },
463
+ "first_seen_at": {
464
+ "name": "first_seen_at",
465
+ "type": "integer",
466
+ "primaryKey": false,
467
+ "notNull": false,
468
+ "autoincrement": false
469
+ },
470
+ "last_seen_at": {
471
+ "name": "last_seen_at",
472
+ "type": "integer",
473
+ "primaryKey": false,
474
+ "notNull": false,
475
+ "autoincrement": false
476
+ },
477
+ "activated_at": {
478
+ "name": "activated_at",
479
+ "type": "integer",
480
+ "primaryKey": false,
481
+ "notNull": false,
482
+ "autoincrement": false
483
+ },
484
+ "created_at": {
485
+ "name": "created_at",
486
+ "type": "integer",
487
+ "primaryKey": false,
488
+ "notNull": false,
489
+ "autoincrement": false
490
+ },
491
+ "event_count_bucket_current": {
492
+ "name": "event_count_bucket_current",
493
+ "type": "integer",
494
+ "primaryKey": false,
495
+ "notNull": false,
496
+ "autoincrement": false,
497
+ "default": 0
498
+ },
499
+ "event_count_bucket_prev": {
500
+ "name": "event_count_bucket_prev",
501
+ "type": "integer",
502
+ "primaryKey": false,
503
+ "notNull": false,
504
+ "autoincrement": false,
505
+ "default": 0
506
+ },
507
+ "last_counter_reset_at": {
508
+ "name": "last_counter_reset_at",
509
+ "type": "integer",
510
+ "primaryKey": false,
511
+ "notNull": false,
512
+ "autoincrement": false
513
+ }
514
+ },
515
+ "indexes": {
516
+ "uq_contacts_tenant_external_id": {
517
+ "name": "uq_contacts_tenant_external_id",
518
+ "columns": [
519
+ "tenant_id",
520
+ "external_id"
521
+ ],
522
+ "isUnique": true
523
+ },
524
+ "uq_contacts_tenant_email": {
525
+ "name": "uq_contacts_tenant_email",
526
+ "columns": [
527
+ "tenant_id",
528
+ "email"
529
+ ],
530
+ "isUnique": true,
531
+ "where": "email IS NOT NULL"
532
+ },
533
+ "idx_contacts_tenant_state": {
534
+ "name": "idx_contacts_tenant_state",
535
+ "columns": [
536
+ "tenant_id",
537
+ "lifecycle_state"
538
+ ],
539
+ "isUnique": false
540
+ },
541
+ "idx_contacts_last_seen": {
542
+ "name": "idx_contacts_last_seen",
543
+ "columns": [
544
+ "tenant_id",
545
+ "last_seen_at"
546
+ ],
547
+ "isUnique": false
548
+ },
549
+ "idx_contacts_tenant_created": {
550
+ "name": "idx_contacts_tenant_created",
551
+ "columns": [
552
+ "tenant_id",
553
+ "created_at",
554
+ "id"
555
+ ],
556
+ "isUnique": false
557
+ }
558
+ },
559
+ "foreignKeys": {
560
+ "contacts_tenant_id_tenants_id_fk": {
561
+ "name": "contacts_tenant_id_tenants_id_fk",
562
+ "tableFrom": "contacts",
563
+ "tableTo": "tenants",
564
+ "columnsFrom": [
565
+ "tenant_id"
566
+ ],
567
+ "columnsTo": [
568
+ "id"
569
+ ],
570
+ "onDelete": "no action",
571
+ "onUpdate": "no action"
572
+ }
573
+ },
574
+ "compositePrimaryKeys": {},
575
+ "uniqueConstraints": {},
576
+ "checkConstraints": {}
577
+ },
578
+ "events": {
579
+ "name": "events",
580
+ "columns": {
581
+ "id": {
582
+ "name": "id",
583
+ "type": "text",
584
+ "primaryKey": true,
585
+ "notNull": true,
586
+ "autoincrement": false
587
+ },
588
+ "tenant_id": {
589
+ "name": "tenant_id",
590
+ "type": "text",
591
+ "primaryKey": false,
592
+ "notNull": true,
593
+ "autoincrement": false
594
+ },
595
+ "contact_id": {
596
+ "name": "contact_id",
597
+ "type": "text",
598
+ "primaryKey": false,
599
+ "notNull": true,
600
+ "autoincrement": false
601
+ },
602
+ "type": {
603
+ "name": "type",
604
+ "type": "text",
605
+ "primaryKey": false,
606
+ "notNull": true,
607
+ "autoincrement": false
608
+ },
609
+ "event_name": {
610
+ "name": "event_name",
611
+ "type": "text",
612
+ "primaryKey": false,
613
+ "notNull": false,
614
+ "autoincrement": false
615
+ },
616
+ "properties": {
617
+ "name": "properties",
618
+ "type": "text",
619
+ "primaryKey": false,
620
+ "notNull": false,
621
+ "autoincrement": false
622
+ },
623
+ "context": {
624
+ "name": "context",
625
+ "type": "text",
626
+ "primaryKey": false,
627
+ "notNull": false,
628
+ "autoincrement": false
629
+ },
630
+ "message_id": {
631
+ "name": "message_id",
632
+ "type": "text",
633
+ "primaryKey": false,
634
+ "notNull": false,
635
+ "autoincrement": false
636
+ },
637
+ "timestamp": {
638
+ "name": "timestamp",
639
+ "type": "integer",
640
+ "primaryKey": false,
641
+ "notNull": true,
642
+ "autoincrement": false
643
+ },
644
+ "received_at": {
645
+ "name": "received_at",
646
+ "type": "integer",
647
+ "primaryKey": false,
648
+ "notNull": true,
649
+ "autoincrement": false
650
+ }
651
+ },
652
+ "indexes": {
653
+ "idx_events_contact_time": {
654
+ "name": "idx_events_contact_time",
655
+ "columns": [
656
+ "contact_id",
657
+ "timestamp"
658
+ ],
659
+ "isUnique": false
660
+ },
661
+ "idx_events_tenant_name": {
662
+ "name": "idx_events_tenant_name",
663
+ "columns": [
664
+ "tenant_id",
665
+ "event_name",
666
+ "timestamp"
667
+ ],
668
+ "isUnique": false
669
+ },
670
+ "idx_events_tenant_time": {
671
+ "name": "idx_events_tenant_time",
672
+ "columns": [
673
+ "tenant_id",
674
+ "timestamp"
675
+ ],
676
+ "isUnique": false
677
+ },
678
+ "idx_events_dedup_lookup": {
679
+ "name": "idx_events_dedup_lookup",
680
+ "columns": [
681
+ "tenant_id",
682
+ "message_id"
683
+ ],
684
+ "isUnique": false,
685
+ "where": "message_id IS NOT NULL"
686
+ }
687
+ },
688
+ "foreignKeys": {
689
+ "events_tenant_id_tenants_id_fk": {
690
+ "name": "events_tenant_id_tenants_id_fk",
691
+ "tableFrom": "events",
692
+ "tableTo": "tenants",
693
+ "columnsFrom": [
694
+ "tenant_id"
695
+ ],
696
+ "columnsTo": [
697
+ "id"
698
+ ],
699
+ "onDelete": "no action",
700
+ "onUpdate": "no action"
701
+ },
702
+ "events_contact_id_contacts_id_fk": {
703
+ "name": "events_contact_id_contacts_id_fk",
704
+ "tableFrom": "events",
705
+ "tableTo": "contacts",
706
+ "columnsFrom": [
707
+ "contact_id"
708
+ ],
709
+ "columnsTo": [
710
+ "id"
711
+ ],
712
+ "onDelete": "no action",
713
+ "onUpdate": "no action"
714
+ }
715
+ },
716
+ "compositePrimaryKeys": {},
717
+ "uniqueConstraints": {},
718
+ "checkConstraints": {}
719
+ },
720
+ "flow_memberships": {
721
+ "name": "flow_memberships",
722
+ "columns": {
723
+ "id": {
724
+ "name": "id",
725
+ "type": "text",
726
+ "primaryKey": true,
727
+ "notNull": true,
728
+ "autoincrement": false
729
+ },
730
+ "tenant_id": {
731
+ "name": "tenant_id",
732
+ "type": "text",
733
+ "primaryKey": false,
734
+ "notNull": true,
735
+ "autoincrement": false
736
+ },
737
+ "contact_id": {
738
+ "name": "contact_id",
739
+ "type": "text",
740
+ "primaryKey": false,
741
+ "notNull": true,
742
+ "autoincrement": false
743
+ },
744
+ "flow_id": {
745
+ "name": "flow_id",
746
+ "type": "text",
747
+ "primaryKey": false,
748
+ "notNull": true,
749
+ "autoincrement": false
750
+ },
751
+ "current_step": {
752
+ "name": "current_step",
753
+ "type": "integer",
754
+ "primaryKey": false,
755
+ "notNull": true,
756
+ "autoincrement": false,
757
+ "default": 1
758
+ },
759
+ "status": {
760
+ "name": "status",
761
+ "type": "text",
762
+ "primaryKey": false,
763
+ "notNull": true,
764
+ "autoincrement": false,
765
+ "default": "'active'"
766
+ },
767
+ "entered_at": {
768
+ "name": "entered_at",
769
+ "type": "integer",
770
+ "primaryKey": false,
771
+ "notNull": true,
772
+ "autoincrement": false
773
+ },
774
+ "completed_at": {
775
+ "name": "completed_at",
776
+ "type": "integer",
777
+ "primaryKey": false,
778
+ "notNull": false,
779
+ "autoincrement": false
780
+ },
781
+ "exited_at": {
782
+ "name": "exited_at",
783
+ "type": "integer",
784
+ "primaryKey": false,
785
+ "notNull": false,
786
+ "autoincrement": false
787
+ },
788
+ "exit_reason": {
789
+ "name": "exit_reason",
790
+ "type": "text",
791
+ "primaryKey": false,
792
+ "notNull": false,
793
+ "autoincrement": false
794
+ },
795
+ "condition_error": {
796
+ "name": "condition_error",
797
+ "type": "text",
798
+ "primaryKey": false,
799
+ "notNull": false,
800
+ "autoincrement": false
801
+ }
802
+ },
803
+ "indexes": {
804
+ "uq_flow_membership_active": {
805
+ "name": "uq_flow_membership_active",
806
+ "columns": [
807
+ "contact_id",
808
+ "flow_id"
809
+ ],
810
+ "isUnique": true,
811
+ "where": "status = 'active'"
812
+ },
813
+ "idx_flow_members_contact": {
814
+ "name": "idx_flow_members_contact",
815
+ "columns": [
816
+ "contact_id",
817
+ "status"
818
+ ],
819
+ "isUnique": false
820
+ },
821
+ "idx_flow_members_flow": {
822
+ "name": "idx_flow_members_flow",
823
+ "columns": [
824
+ "flow_id",
825
+ "status",
826
+ "current_step"
827
+ ],
828
+ "isUnique": false
829
+ }
830
+ },
831
+ "foreignKeys": {
832
+ "flow_memberships_tenant_id_tenants_id_fk": {
833
+ "name": "flow_memberships_tenant_id_tenants_id_fk",
834
+ "tableFrom": "flow_memberships",
835
+ "tableTo": "tenants",
836
+ "columnsFrom": [
837
+ "tenant_id"
838
+ ],
839
+ "columnsTo": [
840
+ "id"
841
+ ],
842
+ "onDelete": "no action",
843
+ "onUpdate": "no action"
844
+ },
845
+ "flow_memberships_contact_id_contacts_id_fk": {
846
+ "name": "flow_memberships_contact_id_contacts_id_fk",
847
+ "tableFrom": "flow_memberships",
848
+ "tableTo": "contacts",
849
+ "columnsFrom": [
850
+ "contact_id"
851
+ ],
852
+ "columnsTo": [
853
+ "id"
854
+ ],
855
+ "onDelete": "no action",
856
+ "onUpdate": "no action"
857
+ },
858
+ "flow_memberships_flow_id_flows_id_fk": {
859
+ "name": "flow_memberships_flow_id_flows_id_fk",
860
+ "tableFrom": "flow_memberships",
861
+ "tableTo": "flows",
862
+ "columnsFrom": [
863
+ "flow_id"
864
+ ],
865
+ "columnsTo": [
866
+ "id"
867
+ ],
868
+ "onDelete": "no action",
869
+ "onUpdate": "no action"
870
+ }
871
+ },
872
+ "compositePrimaryKeys": {},
873
+ "uniqueConstraints": {},
874
+ "checkConstraints": {}
875
+ },
876
+ "flows": {
877
+ "name": "flows",
878
+ "columns": {
879
+ "id": {
880
+ "name": "id",
881
+ "type": "text",
882
+ "primaryKey": true,
883
+ "notNull": true,
884
+ "autoincrement": false
885
+ },
886
+ "tenant_id": {
887
+ "name": "tenant_id",
888
+ "type": "text",
889
+ "primaryKey": false,
890
+ "notNull": true,
891
+ "autoincrement": false
892
+ },
893
+ "name": {
894
+ "name": "name",
895
+ "type": "text",
896
+ "primaryKey": false,
897
+ "notNull": true,
898
+ "autoincrement": false
899
+ },
900
+ "description": {
901
+ "name": "description",
902
+ "type": "text",
903
+ "primaryKey": false,
904
+ "notNull": false,
905
+ "autoincrement": false
906
+ },
907
+ "priority": {
908
+ "name": "priority",
909
+ "type": "integer",
910
+ "primaryKey": false,
911
+ "notNull": false,
912
+ "autoincrement": false,
913
+ "default": 0
914
+ },
915
+ "trigger_type": {
916
+ "name": "trigger_type",
917
+ "type": "text",
918
+ "primaryKey": false,
919
+ "notNull": true,
920
+ "autoincrement": false
921
+ },
922
+ "trigger_config": {
923
+ "name": "trigger_config",
924
+ "type": "text",
925
+ "primaryKey": false,
926
+ "notNull": true,
927
+ "autoincrement": false
928
+ },
929
+ "steps": {
930
+ "name": "steps",
931
+ "type": "text",
932
+ "primaryKey": false,
933
+ "notNull": true,
934
+ "autoincrement": false
935
+ },
936
+ "source": {
937
+ "name": "source",
938
+ "type": "text",
939
+ "primaryKey": false,
940
+ "notNull": false,
941
+ "autoincrement": false,
942
+ "default": "'manual'"
943
+ },
944
+ "content_mode": {
945
+ "name": "content_mode",
946
+ "type": "text",
947
+ "primaryKey": false,
948
+ "notNull": false,
949
+ "autoincrement": false,
950
+ "default": "'ai_drafted'"
951
+ },
952
+ "status": {
953
+ "name": "status",
954
+ "type": "text",
955
+ "primaryKey": false,
956
+ "notNull": false,
957
+ "autoincrement": false,
958
+ "default": "'draft'"
959
+ },
960
+ "approval_mode": {
961
+ "name": "approval_mode",
962
+ "type": "text",
963
+ "primaryKey": false,
964
+ "notNull": false,
965
+ "autoincrement": false,
966
+ "default": "'require'"
967
+ },
968
+ "flow_class": {
969
+ "name": "flow_class",
970
+ "type": "text",
971
+ "primaryKey": false,
972
+ "notNull": true,
973
+ "autoincrement": false,
974
+ "default": "'nurture'"
975
+ },
976
+ "reentry_policy": {
977
+ "name": "reentry_policy",
978
+ "type": "text",
979
+ "primaryKey": false,
980
+ "notNull": true,
981
+ "autoincrement": false,
982
+ "default": "'cooldown'"
983
+ },
984
+ "reentry_cooldown_days": {
985
+ "name": "reentry_cooldown_days",
986
+ "type": "integer",
987
+ "primaryKey": false,
988
+ "notNull": false,
989
+ "autoincrement": false,
990
+ "default": 30
991
+ },
992
+ "prompt_source": {
993
+ "name": "prompt_source",
994
+ "type": "text",
995
+ "primaryKey": false,
996
+ "notNull": false,
997
+ "autoincrement": false
998
+ },
999
+ "compiled_plan": {
1000
+ "name": "compiled_plan",
1001
+ "type": "text",
1002
+ "primaryKey": false,
1003
+ "notNull": false,
1004
+ "autoincrement": false
1005
+ },
1006
+ "compiled_at": {
1007
+ "name": "compiled_at",
1008
+ "type": "integer",
1009
+ "primaryKey": false,
1010
+ "notNull": false,
1011
+ "autoincrement": false
1012
+ },
1013
+ "compile_status": {
1014
+ "name": "compile_status",
1015
+ "type": "text",
1016
+ "primaryKey": false,
1017
+ "notNull": false,
1018
+ "autoincrement": false
1019
+ },
1020
+ "compile_error": {
1021
+ "name": "compile_error",
1022
+ "type": "text",
1023
+ "primaryKey": false,
1024
+ "notNull": false,
1025
+ "autoincrement": false
1026
+ },
1027
+ "topic_id": {
1028
+ "name": "topic_id",
1029
+ "type": "text",
1030
+ "primaryKey": false,
1031
+ "notNull": false,
1032
+ "autoincrement": false
1033
+ },
1034
+ "slug": {
1035
+ "name": "slug",
1036
+ "type": "text",
1037
+ "primaryKey": false,
1038
+ "notNull": false,
1039
+ "autoincrement": false
1040
+ },
1041
+ "created_at": {
1042
+ "name": "created_at",
1043
+ "type": "integer",
1044
+ "primaryKey": false,
1045
+ "notNull": false,
1046
+ "autoincrement": false
1047
+ },
1048
+ "updated_at": {
1049
+ "name": "updated_at",
1050
+ "type": "integer",
1051
+ "primaryKey": false,
1052
+ "notNull": false,
1053
+ "autoincrement": false
1054
+ }
1055
+ },
1056
+ "indexes": {
1057
+ "uq_flows_tenant_slug": {
1058
+ "name": "uq_flows_tenant_slug",
1059
+ "columns": [
1060
+ "tenant_id",
1061
+ "slug"
1062
+ ],
1063
+ "isUnique": true,
1064
+ "where": "slug IS NOT NULL"
1065
+ }
1066
+ },
1067
+ "foreignKeys": {
1068
+ "flows_tenant_id_tenants_id_fk": {
1069
+ "name": "flows_tenant_id_tenants_id_fk",
1070
+ "tableFrom": "flows",
1071
+ "tableTo": "tenants",
1072
+ "columnsFrom": [
1073
+ "tenant_id"
1074
+ ],
1075
+ "columnsTo": [
1076
+ "id"
1077
+ ],
1078
+ "onDelete": "no action",
1079
+ "onUpdate": "no action"
1080
+ },
1081
+ "flows_topic_id_topics_id_fk": {
1082
+ "name": "flows_topic_id_topics_id_fk",
1083
+ "tableFrom": "flows",
1084
+ "tableTo": "topics",
1085
+ "columnsFrom": [
1086
+ "topic_id"
1087
+ ],
1088
+ "columnsTo": [
1089
+ "id"
1090
+ ],
1091
+ "onDelete": "no action",
1092
+ "onUpdate": "no action"
1093
+ }
1094
+ },
1095
+ "compositePrimaryKeys": {},
1096
+ "uniqueConstraints": {},
1097
+ "checkConstraints": {}
1098
+ },
1099
+ "instance_settings": {
1100
+ "name": "instance_settings",
1101
+ "columns": {
1102
+ "key": {
1103
+ "name": "key",
1104
+ "type": "text",
1105
+ "primaryKey": true,
1106
+ "notNull": true,
1107
+ "autoincrement": false
1108
+ },
1109
+ "value": {
1110
+ "name": "value",
1111
+ "type": "text",
1112
+ "primaryKey": false,
1113
+ "notNull": true,
1114
+ "autoincrement": false
1115
+ },
1116
+ "updated_at": {
1117
+ "name": "updated_at",
1118
+ "type": "integer",
1119
+ "primaryKey": false,
1120
+ "notNull": false,
1121
+ "autoincrement": false
1122
+ }
1123
+ },
1124
+ "indexes": {},
1125
+ "foreignKeys": {},
1126
+ "compositePrimaryKeys": {},
1127
+ "uniqueConstraints": {},
1128
+ "checkConstraints": {}
1129
+ },
1130
+ "invites": {
1131
+ "name": "invites",
1132
+ "columns": {
1133
+ "id": {
1134
+ "name": "id",
1135
+ "type": "text",
1136
+ "primaryKey": true,
1137
+ "notNull": true,
1138
+ "autoincrement": false
1139
+ },
1140
+ "tenant_id": {
1141
+ "name": "tenant_id",
1142
+ "type": "text",
1143
+ "primaryKey": false,
1144
+ "notNull": true,
1145
+ "autoincrement": false
1146
+ },
1147
+ "email": {
1148
+ "name": "email",
1149
+ "type": "text",
1150
+ "primaryKey": false,
1151
+ "notNull": true,
1152
+ "autoincrement": false
1153
+ },
1154
+ "role": {
1155
+ "name": "role",
1156
+ "type": "text",
1157
+ "primaryKey": false,
1158
+ "notNull": true,
1159
+ "autoincrement": false,
1160
+ "default": "'member'"
1161
+ },
1162
+ "token_hash": {
1163
+ "name": "token_hash",
1164
+ "type": "text",
1165
+ "primaryKey": false,
1166
+ "notNull": true,
1167
+ "autoincrement": false
1168
+ },
1169
+ "invited_by": {
1170
+ "name": "invited_by",
1171
+ "type": "text",
1172
+ "primaryKey": false,
1173
+ "notNull": true,
1174
+ "autoincrement": false
1175
+ },
1176
+ "expires_at": {
1177
+ "name": "expires_at",
1178
+ "type": "integer",
1179
+ "primaryKey": false,
1180
+ "notNull": true,
1181
+ "autoincrement": false
1182
+ },
1183
+ "accepted_at": {
1184
+ "name": "accepted_at",
1185
+ "type": "integer",
1186
+ "primaryKey": false,
1187
+ "notNull": false,
1188
+ "autoincrement": false
1189
+ },
1190
+ "created_at": {
1191
+ "name": "created_at",
1192
+ "type": "integer",
1193
+ "primaryKey": false,
1194
+ "notNull": false,
1195
+ "autoincrement": false
1196
+ }
1197
+ },
1198
+ "indexes": {
1199
+ "idx_invites_token_hash": {
1200
+ "name": "idx_invites_token_hash",
1201
+ "columns": [
1202
+ "token_hash"
1203
+ ],
1204
+ "isUnique": false
1205
+ },
1206
+ "idx_invites_tenant": {
1207
+ "name": "idx_invites_tenant",
1208
+ "columns": [
1209
+ "tenant_id"
1210
+ ],
1211
+ "isUnique": false
1212
+ }
1213
+ },
1214
+ "foreignKeys": {
1215
+ "invites_tenant_id_tenants_id_fk": {
1216
+ "name": "invites_tenant_id_tenants_id_fk",
1217
+ "tableFrom": "invites",
1218
+ "tableTo": "tenants",
1219
+ "columnsFrom": [
1220
+ "tenant_id"
1221
+ ],
1222
+ "columnsTo": [
1223
+ "id"
1224
+ ],
1225
+ "onDelete": "no action",
1226
+ "onUpdate": "no action"
1227
+ },
1228
+ "invites_invited_by_users_id_fk": {
1229
+ "name": "invites_invited_by_users_id_fk",
1230
+ "tableFrom": "invites",
1231
+ "tableTo": "users",
1232
+ "columnsFrom": [
1233
+ "invited_by"
1234
+ ],
1235
+ "columnsTo": [
1236
+ "id"
1237
+ ],
1238
+ "onDelete": "no action",
1239
+ "onUpdate": "no action"
1240
+ }
1241
+ },
1242
+ "compositePrimaryKeys": {},
1243
+ "uniqueConstraints": {},
1244
+ "checkConstraints": {}
1245
+ },
1246
+ "kb_entries": {
1247
+ "name": "kb_entries",
1248
+ "columns": {
1249
+ "id": {
1250
+ "name": "id",
1251
+ "type": "text",
1252
+ "primaryKey": true,
1253
+ "notNull": true,
1254
+ "autoincrement": false
1255
+ },
1256
+ "tenant_id": {
1257
+ "name": "tenant_id",
1258
+ "type": "text",
1259
+ "primaryKey": false,
1260
+ "notNull": true,
1261
+ "autoincrement": false
1262
+ },
1263
+ "title": {
1264
+ "name": "title",
1265
+ "type": "text",
1266
+ "primaryKey": false,
1267
+ "notNull": true,
1268
+ "autoincrement": false
1269
+ },
1270
+ "content": {
1271
+ "name": "content",
1272
+ "type": "text",
1273
+ "primaryKey": false,
1274
+ "notNull": true,
1275
+ "autoincrement": false
1276
+ },
1277
+ "content_type": {
1278
+ "name": "content_type",
1279
+ "type": "text",
1280
+ "primaryKey": false,
1281
+ "notNull": false,
1282
+ "autoincrement": false,
1283
+ "default": "'markdown'"
1284
+ },
1285
+ "source": {
1286
+ "name": "source",
1287
+ "type": "text",
1288
+ "primaryKey": false,
1289
+ "notNull": false,
1290
+ "autoincrement": false,
1291
+ "default": "'manual'"
1292
+ },
1293
+ "source_url": {
1294
+ "name": "source_url",
1295
+ "type": "text",
1296
+ "primaryKey": false,
1297
+ "notNull": false,
1298
+ "autoincrement": false
1299
+ },
1300
+ "tags": {
1301
+ "name": "tags",
1302
+ "type": "text",
1303
+ "primaryKey": false,
1304
+ "notNull": false,
1305
+ "autoincrement": false
1306
+ },
1307
+ "embedding": {
1308
+ "name": "embedding",
1309
+ "type": "text",
1310
+ "primaryKey": false,
1311
+ "notNull": false,
1312
+ "autoincrement": false
1313
+ },
1314
+ "embedding_status": {
1315
+ "name": "embedding_status",
1316
+ "type": "text",
1317
+ "primaryKey": false,
1318
+ "notNull": false,
1319
+ "autoincrement": false
1320
+ },
1321
+ "embedding_error": {
1322
+ "name": "embedding_error",
1323
+ "type": "text",
1324
+ "primaryKey": false,
1325
+ "notNull": false,
1326
+ "autoincrement": false
1327
+ },
1328
+ "is_active": {
1329
+ "name": "is_active",
1330
+ "type": "integer",
1331
+ "primaryKey": false,
1332
+ "notNull": false,
1333
+ "autoincrement": false,
1334
+ "default": true
1335
+ },
1336
+ "created_at": {
1337
+ "name": "created_at",
1338
+ "type": "integer",
1339
+ "primaryKey": false,
1340
+ "notNull": false,
1341
+ "autoincrement": false
1342
+ },
1343
+ "updated_at": {
1344
+ "name": "updated_at",
1345
+ "type": "integer",
1346
+ "primaryKey": false,
1347
+ "notNull": false,
1348
+ "autoincrement": false
1349
+ }
1350
+ },
1351
+ "indexes": {
1352
+ "idx_kb_entries_tenant_created": {
1353
+ "name": "idx_kb_entries_tenant_created",
1354
+ "columns": [
1355
+ "tenant_id",
1356
+ "created_at",
1357
+ "id"
1358
+ ],
1359
+ "isUnique": false
1360
+ }
1361
+ },
1362
+ "foreignKeys": {
1363
+ "kb_entries_tenant_id_tenants_id_fk": {
1364
+ "name": "kb_entries_tenant_id_tenants_id_fk",
1365
+ "tableFrom": "kb_entries",
1366
+ "tableTo": "tenants",
1367
+ "columnsFrom": [
1368
+ "tenant_id"
1369
+ ],
1370
+ "columnsTo": [
1371
+ "id"
1372
+ ],
1373
+ "onDelete": "no action",
1374
+ "onUpdate": "no action"
1375
+ }
1376
+ },
1377
+ "compositePrimaryKeys": {},
1378
+ "uniqueConstraints": {},
1379
+ "checkConstraints": {}
1380
+ },
1381
+ "lifecycle_messages": {
1382
+ "name": "lifecycle_messages",
1383
+ "columns": {
1384
+ "id": {
1385
+ "name": "id",
1386
+ "type": "text",
1387
+ "primaryKey": true,
1388
+ "notNull": true,
1389
+ "autoincrement": false
1390
+ },
1391
+ "tenant_id": {
1392
+ "name": "tenant_id",
1393
+ "type": "text",
1394
+ "primaryKey": false,
1395
+ "notNull": true,
1396
+ "autoincrement": false
1397
+ },
1398
+ "contact_id": {
1399
+ "name": "contact_id",
1400
+ "type": "text",
1401
+ "primaryKey": false,
1402
+ "notNull": true,
1403
+ "autoincrement": false
1404
+ },
1405
+ "flow_id": {
1406
+ "name": "flow_id",
1407
+ "type": "text",
1408
+ "primaryKey": false,
1409
+ "notNull": true,
1410
+ "autoincrement": false
1411
+ },
1412
+ "membership_id": {
1413
+ "name": "membership_id",
1414
+ "type": "text",
1415
+ "primaryKey": false,
1416
+ "notNull": true,
1417
+ "autoincrement": false
1418
+ },
1419
+ "flow_step_order": {
1420
+ "name": "flow_step_order",
1421
+ "type": "integer",
1422
+ "primaryKey": false,
1423
+ "notNull": false,
1424
+ "autoincrement": false
1425
+ },
1426
+ "status": {
1427
+ "name": "status",
1428
+ "type": "text",
1429
+ "primaryKey": false,
1430
+ "notNull": true,
1431
+ "autoincrement": false
1432
+ },
1433
+ "feedback": {
1434
+ "name": "feedback",
1435
+ "type": "text",
1436
+ "primaryKey": false,
1437
+ "notNull": false,
1438
+ "autoincrement": false
1439
+ },
1440
+ "subject": {
1441
+ "name": "subject",
1442
+ "type": "text",
1443
+ "primaryKey": false,
1444
+ "notNull": false,
1445
+ "autoincrement": false
1446
+ },
1447
+ "body_html": {
1448
+ "name": "body_html",
1449
+ "type": "text",
1450
+ "primaryKey": false,
1451
+ "notNull": false,
1452
+ "autoincrement": false
1453
+ },
1454
+ "body_text": {
1455
+ "name": "body_text",
1456
+ "type": "text",
1457
+ "primaryKey": false,
1458
+ "notNull": false,
1459
+ "autoincrement": false
1460
+ },
1461
+ "brain_reasoning": {
1462
+ "name": "brain_reasoning",
1463
+ "type": "text",
1464
+ "primaryKey": false,
1465
+ "notNull": false,
1466
+ "autoincrement": false
1467
+ },
1468
+ "brain_action_type": {
1469
+ "name": "brain_action_type",
1470
+ "type": "text",
1471
+ "primaryKey": false,
1472
+ "notNull": false,
1473
+ "autoincrement": false
1474
+ },
1475
+ "scheduled_send_at": {
1476
+ "name": "scheduled_send_at",
1477
+ "type": "integer",
1478
+ "primaryKey": false,
1479
+ "notNull": false,
1480
+ "autoincrement": false
1481
+ },
1482
+ "approved_at": {
1483
+ "name": "approved_at",
1484
+ "type": "integer",
1485
+ "primaryKey": false,
1486
+ "notNull": false,
1487
+ "autoincrement": false
1488
+ },
1489
+ "sent_at": {
1490
+ "name": "sent_at",
1491
+ "type": "integer",
1492
+ "primaryKey": false,
1493
+ "notNull": false,
1494
+ "autoincrement": false
1495
+ },
1496
+ "retry_count": {
1497
+ "name": "retry_count",
1498
+ "type": "integer",
1499
+ "primaryKey": false,
1500
+ "notNull": false,
1501
+ "autoincrement": false,
1502
+ "default": 0
1503
+ },
1504
+ "provider_message_id": {
1505
+ "name": "provider_message_id",
1506
+ "type": "text",
1507
+ "primaryKey": false,
1508
+ "notNull": false,
1509
+ "autoincrement": false
1510
+ },
1511
+ "recipient_address": {
1512
+ "name": "recipient_address",
1513
+ "type": "text",
1514
+ "primaryKey": false,
1515
+ "notNull": false,
1516
+ "autoincrement": false
1517
+ },
1518
+ "topic_id": {
1519
+ "name": "topic_id",
1520
+ "type": "text",
1521
+ "primaryKey": false,
1522
+ "notNull": false,
1523
+ "autoincrement": false
1524
+ },
1525
+ "transport_id": {
1526
+ "name": "transport_id",
1527
+ "type": "text",
1528
+ "primaryKey": false,
1529
+ "notNull": false,
1530
+ "autoincrement": false
1531
+ },
1532
+ "status_reason": {
1533
+ "name": "status_reason",
1534
+ "type": "text",
1535
+ "primaryKey": false,
1536
+ "notNull": false,
1537
+ "autoincrement": false
1538
+ },
1539
+ "approved_by": {
1540
+ "name": "approved_by",
1541
+ "type": "text",
1542
+ "primaryKey": false,
1543
+ "notNull": false,
1544
+ "autoincrement": false
1545
+ },
1546
+ "rejected_by": {
1547
+ "name": "rejected_by",
1548
+ "type": "text",
1549
+ "primaryKey": false,
1550
+ "notNull": false,
1551
+ "autoincrement": false
1552
+ },
1553
+ "edited_by": {
1554
+ "name": "edited_by",
1555
+ "type": "text",
1556
+ "primaryKey": false,
1557
+ "notNull": false,
1558
+ "autoincrement": false
1559
+ },
1560
+ "edited_at": {
1561
+ "name": "edited_at",
1562
+ "type": "integer",
1563
+ "primaryKey": false,
1564
+ "notNull": false,
1565
+ "autoincrement": false
1566
+ },
1567
+ "original_subject": {
1568
+ "name": "original_subject",
1569
+ "type": "text",
1570
+ "primaryKey": false,
1571
+ "notNull": false,
1572
+ "autoincrement": false
1573
+ },
1574
+ "original_body_html": {
1575
+ "name": "original_body_html",
1576
+ "type": "text",
1577
+ "primaryKey": false,
1578
+ "notNull": false,
1579
+ "autoincrement": false
1580
+ },
1581
+ "original_body_text": {
1582
+ "name": "original_body_text",
1583
+ "type": "text",
1584
+ "primaryKey": false,
1585
+ "notNull": false,
1586
+ "autoincrement": false
1587
+ },
1588
+ "forced_action_type": {
1589
+ "name": "forced_action_type",
1590
+ "type": "text",
1591
+ "primaryKey": false,
1592
+ "notNull": false,
1593
+ "autoincrement": false
1594
+ },
1595
+ "created_at": {
1596
+ "name": "created_at",
1597
+ "type": "integer",
1598
+ "primaryKey": false,
1599
+ "notNull": false,
1600
+ "autoincrement": false
1601
+ },
1602
+ "updated_at": {
1603
+ "name": "updated_at",
1604
+ "type": "integer",
1605
+ "primaryKey": false,
1606
+ "notNull": false,
1607
+ "autoincrement": false
1608
+ }
1609
+ },
1610
+ "indexes": {
1611
+ "idx_messages_drain": {
1612
+ "name": "idx_messages_drain",
1613
+ "columns": [
1614
+ "tenant_id",
1615
+ "status",
1616
+ "scheduled_send_at"
1617
+ ],
1618
+ "isUnique": false,
1619
+ "where": "status IN ('approved', 'sending')"
1620
+ },
1621
+ "idx_messages_contact": {
1622
+ "name": "idx_messages_contact",
1623
+ "columns": [
1624
+ "contact_id",
1625
+ "status",
1626
+ "created_at"
1627
+ ],
1628
+ "isUnique": false
1629
+ },
1630
+ "idx_messages_contact_sent": {
1631
+ "name": "idx_messages_contact_sent",
1632
+ "columns": [
1633
+ "contact_id",
1634
+ "sent_at"
1635
+ ],
1636
+ "isUnique": false,
1637
+ "where": "status IN ('sending', 'sent')"
1638
+ },
1639
+ "uq_messages_membership_step": {
1640
+ "name": "uq_messages_membership_step",
1641
+ "columns": [
1642
+ "membership_id",
1643
+ "flow_step_order"
1644
+ ],
1645
+ "isUnique": true
1646
+ },
1647
+ "idx_messages_generation": {
1648
+ "name": "idx_messages_generation",
1649
+ "columns": [
1650
+ "tenant_id",
1651
+ "status",
1652
+ "created_at"
1653
+ ],
1654
+ "isUnique": false,
1655
+ "where": "status IN ('pending_generation', 'generating')"
1656
+ },
1657
+ "idx_messages_provider_id": {
1658
+ "name": "idx_messages_provider_id",
1659
+ "columns": [
1660
+ "provider_message_id"
1661
+ ],
1662
+ "isUnique": false,
1663
+ "where": "provider_message_id IS NOT NULL"
1664
+ },
1665
+ "idx_messages_tenant_sent": {
1666
+ "name": "idx_messages_tenant_sent",
1667
+ "columns": [
1668
+ "tenant_id",
1669
+ "sent_at"
1670
+ ],
1671
+ "isUnique": false,
1672
+ "where": "sent_at IS NOT NULL"
1673
+ }
1674
+ },
1675
+ "foreignKeys": {
1676
+ "lifecycle_messages_tenant_id_tenants_id_fk": {
1677
+ "name": "lifecycle_messages_tenant_id_tenants_id_fk",
1678
+ "tableFrom": "lifecycle_messages",
1679
+ "tableTo": "tenants",
1680
+ "columnsFrom": [
1681
+ "tenant_id"
1682
+ ],
1683
+ "columnsTo": [
1684
+ "id"
1685
+ ],
1686
+ "onDelete": "no action",
1687
+ "onUpdate": "no action"
1688
+ },
1689
+ "lifecycle_messages_contact_id_contacts_id_fk": {
1690
+ "name": "lifecycle_messages_contact_id_contacts_id_fk",
1691
+ "tableFrom": "lifecycle_messages",
1692
+ "tableTo": "contacts",
1693
+ "columnsFrom": [
1694
+ "contact_id"
1695
+ ],
1696
+ "columnsTo": [
1697
+ "id"
1698
+ ],
1699
+ "onDelete": "no action",
1700
+ "onUpdate": "no action"
1701
+ },
1702
+ "lifecycle_messages_flow_id_flows_id_fk": {
1703
+ "name": "lifecycle_messages_flow_id_flows_id_fk",
1704
+ "tableFrom": "lifecycle_messages",
1705
+ "tableTo": "flows",
1706
+ "columnsFrom": [
1707
+ "flow_id"
1708
+ ],
1709
+ "columnsTo": [
1710
+ "id"
1711
+ ],
1712
+ "onDelete": "no action",
1713
+ "onUpdate": "no action"
1714
+ },
1715
+ "lifecycle_messages_membership_id_flow_memberships_id_fk": {
1716
+ "name": "lifecycle_messages_membership_id_flow_memberships_id_fk",
1717
+ "tableFrom": "lifecycle_messages",
1718
+ "tableTo": "flow_memberships",
1719
+ "columnsFrom": [
1720
+ "membership_id"
1721
+ ],
1722
+ "columnsTo": [
1723
+ "id"
1724
+ ],
1725
+ "onDelete": "no action",
1726
+ "onUpdate": "no action"
1727
+ }
1728
+ },
1729
+ "compositePrimaryKeys": {},
1730
+ "uniqueConstraints": {},
1731
+ "checkConstraints": {}
1732
+ },
1733
+ "lifecycle_transitions": {
1734
+ "name": "lifecycle_transitions",
1735
+ "columns": {
1736
+ "id": {
1737
+ "name": "id",
1738
+ "type": "text",
1739
+ "primaryKey": true,
1740
+ "notNull": true,
1741
+ "autoincrement": false
1742
+ },
1743
+ "tenant_id": {
1744
+ "name": "tenant_id",
1745
+ "type": "text",
1746
+ "primaryKey": false,
1747
+ "notNull": true,
1748
+ "autoincrement": false
1749
+ },
1750
+ "contact_id": {
1751
+ "name": "contact_id",
1752
+ "type": "text",
1753
+ "primaryKey": false,
1754
+ "notNull": true,
1755
+ "autoincrement": false
1756
+ },
1757
+ "from_state": {
1758
+ "name": "from_state",
1759
+ "type": "text",
1760
+ "primaryKey": false,
1761
+ "notNull": true,
1762
+ "autoincrement": false
1763
+ },
1764
+ "to_state": {
1765
+ "name": "to_state",
1766
+ "type": "text",
1767
+ "primaryKey": false,
1768
+ "notNull": true,
1769
+ "autoincrement": false
1770
+ },
1771
+ "trigger_event_id": {
1772
+ "name": "trigger_event_id",
1773
+ "type": "text",
1774
+ "primaryKey": false,
1775
+ "notNull": false,
1776
+ "autoincrement": false
1777
+ },
1778
+ "metadata": {
1779
+ "name": "metadata",
1780
+ "type": "text",
1781
+ "primaryKey": false,
1782
+ "notNull": false,
1783
+ "autoincrement": false
1784
+ },
1785
+ "transitioned_at": {
1786
+ "name": "transitioned_at",
1787
+ "type": "integer",
1788
+ "primaryKey": false,
1789
+ "notNull": true,
1790
+ "autoincrement": false
1791
+ }
1792
+ },
1793
+ "indexes": {
1794
+ "idx_transitions_contact": {
1795
+ "name": "idx_transitions_contact",
1796
+ "columns": [
1797
+ "contact_id",
1798
+ "transitioned_at"
1799
+ ],
1800
+ "isUnique": false
1801
+ },
1802
+ "idx_transitions_tenant_time": {
1803
+ "name": "idx_transitions_tenant_time",
1804
+ "columns": [
1805
+ "tenant_id",
1806
+ "transitioned_at"
1807
+ ],
1808
+ "isUnique": false
1809
+ }
1810
+ },
1811
+ "foreignKeys": {
1812
+ "lifecycle_transitions_tenant_id_tenants_id_fk": {
1813
+ "name": "lifecycle_transitions_tenant_id_tenants_id_fk",
1814
+ "tableFrom": "lifecycle_transitions",
1815
+ "tableTo": "tenants",
1816
+ "columnsFrom": [
1817
+ "tenant_id"
1818
+ ],
1819
+ "columnsTo": [
1820
+ "id"
1821
+ ],
1822
+ "onDelete": "no action",
1823
+ "onUpdate": "no action"
1824
+ },
1825
+ "lifecycle_transitions_contact_id_contacts_id_fk": {
1826
+ "name": "lifecycle_transitions_contact_id_contacts_id_fk",
1827
+ "tableFrom": "lifecycle_transitions",
1828
+ "tableTo": "contacts",
1829
+ "columnsFrom": [
1830
+ "contact_id"
1831
+ ],
1832
+ "columnsTo": [
1833
+ "id"
1834
+ ],
1835
+ "onDelete": "no action",
1836
+ "onUpdate": "no action"
1837
+ }
1838
+ },
1839
+ "compositePrimaryKeys": {},
1840
+ "uniqueConstraints": {},
1841
+ "checkConstraints": {}
1842
+ },
1843
+ "llm_configs": {
1844
+ "name": "llm_configs",
1845
+ "columns": {
1846
+ "id": {
1847
+ "name": "id",
1848
+ "type": "text",
1849
+ "primaryKey": true,
1850
+ "notNull": true,
1851
+ "autoincrement": false
1852
+ },
1853
+ "tenant_id": {
1854
+ "name": "tenant_id",
1855
+ "type": "text",
1856
+ "primaryKey": false,
1857
+ "notNull": true,
1858
+ "autoincrement": false
1859
+ },
1860
+ "provider": {
1861
+ "name": "provider",
1862
+ "type": "text",
1863
+ "primaryKey": false,
1864
+ "notNull": true,
1865
+ "autoincrement": false
1866
+ },
1867
+ "config": {
1868
+ "name": "config",
1869
+ "type": "text",
1870
+ "primaryKey": false,
1871
+ "notNull": true,
1872
+ "autoincrement": false
1873
+ },
1874
+ "is_active": {
1875
+ "name": "is_active",
1876
+ "type": "integer",
1877
+ "primaryKey": false,
1878
+ "notNull": false,
1879
+ "autoincrement": false,
1880
+ "default": true
1881
+ },
1882
+ "created_at": {
1883
+ "name": "created_at",
1884
+ "type": "integer",
1885
+ "primaryKey": false,
1886
+ "notNull": false,
1887
+ "autoincrement": false
1888
+ }
1889
+ },
1890
+ "indexes": {},
1891
+ "foreignKeys": {
1892
+ "llm_configs_tenant_id_tenants_id_fk": {
1893
+ "name": "llm_configs_tenant_id_tenants_id_fk",
1894
+ "tableFrom": "llm_configs",
1895
+ "tableTo": "tenants",
1896
+ "columnsFrom": [
1897
+ "tenant_id"
1898
+ ],
1899
+ "columnsTo": [
1900
+ "id"
1901
+ ],
1902
+ "onDelete": "no action",
1903
+ "onUpdate": "no action"
1904
+ }
1905
+ },
1906
+ "compositePrimaryKeys": {},
1907
+ "uniqueConstraints": {},
1908
+ "checkConstraints": {}
1909
+ },
1910
+ "magic_link_tokens": {
1911
+ "name": "magic_link_tokens",
1912
+ "columns": {
1913
+ "id": {
1914
+ "name": "id",
1915
+ "type": "text",
1916
+ "primaryKey": true,
1917
+ "notNull": true,
1918
+ "autoincrement": false
1919
+ },
1920
+ "tenant_id": {
1921
+ "name": "tenant_id",
1922
+ "type": "text",
1923
+ "primaryKey": false,
1924
+ "notNull": true,
1925
+ "autoincrement": false
1926
+ },
1927
+ "user_id": {
1928
+ "name": "user_id",
1929
+ "type": "text",
1930
+ "primaryKey": false,
1931
+ "notNull": true,
1932
+ "autoincrement": false
1933
+ },
1934
+ "token_hash": {
1935
+ "name": "token_hash",
1936
+ "type": "text",
1937
+ "primaryKey": false,
1938
+ "notNull": true,
1939
+ "autoincrement": false
1940
+ },
1941
+ "expires_at": {
1942
+ "name": "expires_at",
1943
+ "type": "integer",
1944
+ "primaryKey": false,
1945
+ "notNull": true,
1946
+ "autoincrement": false
1947
+ },
1948
+ "consumed_at": {
1949
+ "name": "consumed_at",
1950
+ "type": "integer",
1951
+ "primaryKey": false,
1952
+ "notNull": false,
1953
+ "autoincrement": false
1954
+ },
1955
+ "created_at": {
1956
+ "name": "created_at",
1957
+ "type": "integer",
1958
+ "primaryKey": false,
1959
+ "notNull": false,
1960
+ "autoincrement": false
1961
+ }
1962
+ },
1963
+ "indexes": {
1964
+ "idx_magic_link_tokens_hash": {
1965
+ "name": "idx_magic_link_tokens_hash",
1966
+ "columns": [
1967
+ "token_hash"
1968
+ ],
1969
+ "isUnique": false
1970
+ }
1971
+ },
1972
+ "foreignKeys": {
1973
+ "magic_link_tokens_tenant_id_tenants_id_fk": {
1974
+ "name": "magic_link_tokens_tenant_id_tenants_id_fk",
1975
+ "tableFrom": "magic_link_tokens",
1976
+ "tableTo": "tenants",
1977
+ "columnsFrom": [
1978
+ "tenant_id"
1979
+ ],
1980
+ "columnsTo": [
1981
+ "id"
1982
+ ],
1983
+ "onDelete": "no action",
1984
+ "onUpdate": "no action"
1985
+ },
1986
+ "magic_link_tokens_user_id_users_id_fk": {
1987
+ "name": "magic_link_tokens_user_id_users_id_fk",
1988
+ "tableFrom": "magic_link_tokens",
1989
+ "tableTo": "users",
1990
+ "columnsFrom": [
1991
+ "user_id"
1992
+ ],
1993
+ "columnsTo": [
1994
+ "id"
1995
+ ],
1996
+ "onDelete": "cascade",
1997
+ "onUpdate": "no action"
1998
+ }
1999
+ },
2000
+ "compositePrimaryKeys": {},
2001
+ "uniqueConstraints": {},
2002
+ "checkConstraints": {}
2003
+ },
2004
+ "memberships": {
2005
+ "name": "memberships",
2006
+ "columns": {
2007
+ "user_id": {
2008
+ "name": "user_id",
2009
+ "type": "text",
2010
+ "primaryKey": false,
2011
+ "notNull": true,
2012
+ "autoincrement": false
2013
+ },
2014
+ "tenant_id": {
2015
+ "name": "tenant_id",
2016
+ "type": "text",
2017
+ "primaryKey": false,
2018
+ "notNull": true,
2019
+ "autoincrement": false
2020
+ },
2021
+ "role": {
2022
+ "name": "role",
2023
+ "type": "text",
2024
+ "primaryKey": false,
2025
+ "notNull": true,
2026
+ "autoincrement": false
2027
+ },
2028
+ "created_at": {
2029
+ "name": "created_at",
2030
+ "type": "integer",
2031
+ "primaryKey": false,
2032
+ "notNull": false,
2033
+ "autoincrement": false
2034
+ }
2035
+ },
2036
+ "indexes": {
2037
+ "idx_memberships_tenant": {
2038
+ "name": "idx_memberships_tenant",
2039
+ "columns": [
2040
+ "tenant_id"
2041
+ ],
2042
+ "isUnique": false
2043
+ }
2044
+ },
2045
+ "foreignKeys": {
2046
+ "memberships_user_id_users_id_fk": {
2047
+ "name": "memberships_user_id_users_id_fk",
2048
+ "tableFrom": "memberships",
2049
+ "tableTo": "users",
2050
+ "columnsFrom": [
2051
+ "user_id"
2052
+ ],
2053
+ "columnsTo": [
2054
+ "id"
2055
+ ],
2056
+ "onDelete": "cascade",
2057
+ "onUpdate": "no action"
2058
+ },
2059
+ "memberships_tenant_id_tenants_id_fk": {
2060
+ "name": "memberships_tenant_id_tenants_id_fk",
2061
+ "tableFrom": "memberships",
2062
+ "tableTo": "tenants",
2063
+ "columnsFrom": [
2064
+ "tenant_id"
2065
+ ],
2066
+ "columnsTo": [
2067
+ "id"
2068
+ ],
2069
+ "onDelete": "no action",
2070
+ "onUpdate": "no action"
2071
+ }
2072
+ },
2073
+ "compositePrimaryKeys": {
2074
+ "memberships_pkey": {
2075
+ "columns": [
2076
+ "user_id",
2077
+ "tenant_id"
2078
+ ],
2079
+ "name": "memberships_pkey"
2080
+ }
2081
+ },
2082
+ "uniqueConstraints": {},
2083
+ "checkConstraints": {}
2084
+ },
2085
+ "message_events": {
2086
+ "name": "message_events",
2087
+ "columns": {
2088
+ "id": {
2089
+ "name": "id",
2090
+ "type": "text",
2091
+ "primaryKey": true,
2092
+ "notNull": true,
2093
+ "autoincrement": false
2094
+ },
2095
+ "tenant_id": {
2096
+ "name": "tenant_id",
2097
+ "type": "text",
2098
+ "primaryKey": false,
2099
+ "notNull": true,
2100
+ "autoincrement": false
2101
+ },
2102
+ "message_id": {
2103
+ "name": "message_id",
2104
+ "type": "text",
2105
+ "primaryKey": false,
2106
+ "notNull": true,
2107
+ "autoincrement": false
2108
+ },
2109
+ "event_type": {
2110
+ "name": "event_type",
2111
+ "type": "text",
2112
+ "primaryKey": false,
2113
+ "notNull": true,
2114
+ "autoincrement": false
2115
+ },
2116
+ "occurred_at": {
2117
+ "name": "occurred_at",
2118
+ "type": "integer",
2119
+ "primaryKey": false,
2120
+ "notNull": true,
2121
+ "autoincrement": false
2122
+ },
2123
+ "provider_event_id": {
2124
+ "name": "provider_event_id",
2125
+ "type": "text",
2126
+ "primaryKey": false,
2127
+ "notNull": false,
2128
+ "autoincrement": false
2129
+ },
2130
+ "metadata": {
2131
+ "name": "metadata",
2132
+ "type": "text",
2133
+ "primaryKey": false,
2134
+ "notNull": false,
2135
+ "autoincrement": false
2136
+ },
2137
+ "created_at": {
2138
+ "name": "created_at",
2139
+ "type": "integer",
2140
+ "primaryKey": false,
2141
+ "notNull": false,
2142
+ "autoincrement": false
2143
+ }
2144
+ },
2145
+ "indexes": {
2146
+ "idx_message_events_message": {
2147
+ "name": "idx_message_events_message",
2148
+ "columns": [
2149
+ "message_id",
2150
+ "occurred_at"
2151
+ ],
2152
+ "isUnique": false
2153
+ },
2154
+ "idx_message_events_tenant_type_day": {
2155
+ "name": "idx_message_events_tenant_type_day",
2156
+ "columns": [
2157
+ "tenant_id",
2158
+ "event_type",
2159
+ "occurred_at"
2160
+ ],
2161
+ "isUnique": false
2162
+ },
2163
+ "uq_message_events_provider_dedup": {
2164
+ "name": "uq_message_events_provider_dedup",
2165
+ "columns": [
2166
+ "tenant_id",
2167
+ "provider_event_id"
2168
+ ],
2169
+ "isUnique": true,
2170
+ "where": "provider_event_id IS NOT NULL"
2171
+ }
2172
+ },
2173
+ "foreignKeys": {
2174
+ "message_events_tenant_id_tenants_id_fk": {
2175
+ "name": "message_events_tenant_id_tenants_id_fk",
2176
+ "tableFrom": "message_events",
2177
+ "tableTo": "tenants",
2178
+ "columnsFrom": [
2179
+ "tenant_id"
2180
+ ],
2181
+ "columnsTo": [
2182
+ "id"
2183
+ ],
2184
+ "onDelete": "no action",
2185
+ "onUpdate": "no action"
2186
+ },
2187
+ "message_events_message_id_lifecycle_messages_id_fk": {
2188
+ "name": "message_events_message_id_lifecycle_messages_id_fk",
2189
+ "tableFrom": "message_events",
2190
+ "tableTo": "lifecycle_messages",
2191
+ "columnsFrom": [
2192
+ "message_id"
2193
+ ],
2194
+ "columnsTo": [
2195
+ "id"
2196
+ ],
2197
+ "onDelete": "no action",
2198
+ "onUpdate": "no action"
2199
+ }
2200
+ },
2201
+ "compositePrimaryKeys": {},
2202
+ "uniqueConstraints": {},
2203
+ "checkConstraints": {}
2204
+ },
2205
+ "ops_alerts": {
2206
+ "name": "ops_alerts",
2207
+ "columns": {
2208
+ "fingerprint": {
2209
+ "name": "fingerprint",
2210
+ "type": "text",
2211
+ "primaryKey": true,
2212
+ "notNull": true,
2213
+ "autoincrement": false
2214
+ },
2215
+ "kind": {
2216
+ "name": "kind",
2217
+ "type": "text",
2218
+ "primaryKey": false,
2219
+ "notNull": true,
2220
+ "autoincrement": false
2221
+ },
2222
+ "tenant_id": {
2223
+ "name": "tenant_id",
2224
+ "type": "text",
2225
+ "primaryKey": false,
2226
+ "notNull": false,
2227
+ "autoincrement": false
2228
+ },
2229
+ "severity": {
2230
+ "name": "severity",
2231
+ "type": "text",
2232
+ "primaryKey": false,
2233
+ "notNull": true,
2234
+ "autoincrement": false
2235
+ },
2236
+ "message": {
2237
+ "name": "message",
2238
+ "type": "text",
2239
+ "primaryKey": false,
2240
+ "notNull": true,
2241
+ "autoincrement": false
2242
+ },
2243
+ "first_at": {
2244
+ "name": "first_at",
2245
+ "type": "integer",
2246
+ "primaryKey": false,
2247
+ "notNull": true,
2248
+ "autoincrement": false
2249
+ },
2250
+ "last_at": {
2251
+ "name": "last_at",
2252
+ "type": "integer",
2253
+ "primaryKey": false,
2254
+ "notNull": true,
2255
+ "autoincrement": false
2256
+ },
2257
+ "count": {
2258
+ "name": "count",
2259
+ "type": "integer",
2260
+ "primaryKey": false,
2261
+ "notNull": true,
2262
+ "autoincrement": false,
2263
+ "default": 1
2264
+ },
2265
+ "last_notified_at": {
2266
+ "name": "last_notified_at",
2267
+ "type": "integer",
2268
+ "primaryKey": false,
2269
+ "notNull": false,
2270
+ "autoincrement": false
2271
+ },
2272
+ "notified_count": {
2273
+ "name": "notified_count",
2274
+ "type": "integer",
2275
+ "primaryKey": false,
2276
+ "notNull": true,
2277
+ "autoincrement": false,
2278
+ "default": 0
2279
+ },
2280
+ "status": {
2281
+ "name": "status",
2282
+ "type": "text",
2283
+ "primaryKey": false,
2284
+ "notNull": true,
2285
+ "autoincrement": false,
2286
+ "default": "'open'"
2287
+ },
2288
+ "muted_until": {
2289
+ "name": "muted_until",
2290
+ "type": "integer",
2291
+ "primaryKey": false,
2292
+ "notNull": false,
2293
+ "autoincrement": false
2294
+ }
2295
+ },
2296
+ "indexes": {},
2297
+ "foreignKeys": {},
2298
+ "compositePrimaryKeys": {},
2299
+ "uniqueConstraints": {},
2300
+ "checkConstraints": {}
2301
+ },
2302
+ "ops_events": {
2303
+ "name": "ops_events",
2304
+ "columns": {
2305
+ "id": {
2306
+ "name": "id",
2307
+ "type": "text",
2308
+ "primaryKey": true,
2309
+ "notNull": true,
2310
+ "autoincrement": false
2311
+ },
2312
+ "at": {
2313
+ "name": "at",
2314
+ "type": "integer",
2315
+ "primaryKey": false,
2316
+ "notNull": true,
2317
+ "autoincrement": false
2318
+ },
2319
+ "tenant_id": {
2320
+ "name": "tenant_id",
2321
+ "type": "text",
2322
+ "primaryKey": false,
2323
+ "notNull": false,
2324
+ "autoincrement": false
2325
+ },
2326
+ "kind": {
2327
+ "name": "kind",
2328
+ "type": "text",
2329
+ "primaryKey": false,
2330
+ "notNull": true,
2331
+ "autoincrement": false
2332
+ },
2333
+ "severity": {
2334
+ "name": "severity",
2335
+ "type": "text",
2336
+ "primaryKey": false,
2337
+ "notNull": true,
2338
+ "autoincrement": false
2339
+ },
2340
+ "fingerprint": {
2341
+ "name": "fingerprint",
2342
+ "type": "text",
2343
+ "primaryKey": false,
2344
+ "notNull": true,
2345
+ "autoincrement": false
2346
+ },
2347
+ "message": {
2348
+ "name": "message",
2349
+ "type": "text",
2350
+ "primaryKey": false,
2351
+ "notNull": true,
2352
+ "autoincrement": false
2353
+ },
2354
+ "context": {
2355
+ "name": "context",
2356
+ "type": "text",
2357
+ "primaryKey": false,
2358
+ "notNull": false,
2359
+ "autoincrement": false
2360
+ }
2361
+ },
2362
+ "indexes": {
2363
+ "idx_ops_events_fingerprint_at": {
2364
+ "name": "idx_ops_events_fingerprint_at",
2365
+ "columns": [
2366
+ "fingerprint",
2367
+ "at"
2368
+ ],
2369
+ "isUnique": false
2370
+ },
2371
+ "idx_ops_events_at": {
2372
+ "name": "idx_ops_events_at",
2373
+ "columns": [
2374
+ "at"
2375
+ ],
2376
+ "isUnique": false
2377
+ }
2378
+ },
2379
+ "foreignKeys": {},
2380
+ "compositePrimaryKeys": {},
2381
+ "uniqueConstraints": {},
2382
+ "checkConstraints": {}
2383
+ },
2384
+ "retention_grid_snapshots": {
2385
+ "name": "retention_grid_snapshots",
2386
+ "columns": {
2387
+ "tenant_id": {
2388
+ "name": "tenant_id",
2389
+ "type": "text",
2390
+ "primaryKey": false,
2391
+ "notNull": true,
2392
+ "autoincrement": false
2393
+ },
2394
+ "snapshot_date": {
2395
+ "name": "snapshot_date",
2396
+ "type": "text",
2397
+ "primaryKey": false,
2398
+ "notNull": true,
2399
+ "autoincrement": false
2400
+ },
2401
+ "tenure_bucket": {
2402
+ "name": "tenure_bucket",
2403
+ "type": "text",
2404
+ "primaryKey": false,
2405
+ "notNull": true,
2406
+ "autoincrement": false
2407
+ },
2408
+ "recency_bucket": {
2409
+ "name": "recency_bucket",
2410
+ "type": "text",
2411
+ "primaryKey": false,
2412
+ "notNull": true,
2413
+ "autoincrement": false
2414
+ },
2415
+ "contact_count": {
2416
+ "name": "contact_count",
2417
+ "type": "integer",
2418
+ "primaryKey": false,
2419
+ "notNull": true,
2420
+ "autoincrement": false
2421
+ },
2422
+ "paying_count": {
2423
+ "name": "paying_count",
2424
+ "type": "integer",
2425
+ "primaryKey": false,
2426
+ "notNull": true,
2427
+ "autoincrement": false
2428
+ }
2429
+ },
2430
+ "indexes": {},
2431
+ "foreignKeys": {
2432
+ "retention_grid_snapshots_tenant_id_tenants_id_fk": {
2433
+ "name": "retention_grid_snapshots_tenant_id_tenants_id_fk",
2434
+ "tableFrom": "retention_grid_snapshots",
2435
+ "tableTo": "tenants",
2436
+ "columnsFrom": [
2437
+ "tenant_id"
2438
+ ],
2439
+ "columnsTo": [
2440
+ "id"
2441
+ ],
2442
+ "onDelete": "no action",
2443
+ "onUpdate": "no action"
2444
+ }
2445
+ },
2446
+ "compositePrimaryKeys": {
2447
+ "retention_grid_snapshots_tenant_id_snapshot_date_tenure_bucket_recency_bucket_pk": {
2448
+ "columns": [
2449
+ "tenant_id",
2450
+ "snapshot_date",
2451
+ "tenure_bucket",
2452
+ "recency_bucket"
2453
+ ],
2454
+ "name": "retention_grid_snapshots_tenant_id_snapshot_date_tenure_bucket_recency_bucket_pk"
2455
+ }
2456
+ },
2457
+ "uniqueConstraints": {},
2458
+ "checkConstraints": {}
2459
+ },
2460
+ "scan_checkpoints": {
2461
+ "name": "scan_checkpoints",
2462
+ "columns": {
2463
+ "scan_phase": {
2464
+ "name": "scan_phase",
2465
+ "type": "text",
2466
+ "primaryKey": false,
2467
+ "notNull": true,
2468
+ "autoincrement": false
2469
+ },
2470
+ "tenant_id": {
2471
+ "name": "tenant_id",
2472
+ "type": "text",
2473
+ "primaryKey": false,
2474
+ "notNull": true,
2475
+ "autoincrement": false
2476
+ },
2477
+ "last_id": {
2478
+ "name": "last_id",
2479
+ "type": "text",
2480
+ "primaryKey": false,
2481
+ "notNull": true,
2482
+ "autoincrement": false
2483
+ },
2484
+ "started_at": {
2485
+ "name": "started_at",
2486
+ "type": "integer",
2487
+ "primaryKey": false,
2488
+ "notNull": true,
2489
+ "autoincrement": false
2490
+ },
2491
+ "discard_count": {
2492
+ "name": "discard_count",
2493
+ "type": "integer",
2494
+ "primaryKey": false,
2495
+ "notNull": true,
2496
+ "autoincrement": false,
2497
+ "default": 0
2498
+ }
2499
+ },
2500
+ "indexes": {},
2501
+ "foreignKeys": {
2502
+ "scan_checkpoints_tenant_id_tenants_id_fk": {
2503
+ "name": "scan_checkpoints_tenant_id_tenants_id_fk",
2504
+ "tableFrom": "scan_checkpoints",
2505
+ "tableTo": "tenants",
2506
+ "columnsFrom": [
2507
+ "tenant_id"
2508
+ ],
2509
+ "columnsTo": [
2510
+ "id"
2511
+ ],
2512
+ "onDelete": "no action",
2513
+ "onUpdate": "no action"
2514
+ }
2515
+ },
2516
+ "compositePrimaryKeys": {
2517
+ "scan_checkpoints_scan_phase_tenant_id_pk": {
2518
+ "columns": [
2519
+ "scan_phase",
2520
+ "tenant_id"
2521
+ ],
2522
+ "name": "scan_checkpoints_scan_phase_tenant_id_pk"
2523
+ }
2524
+ },
2525
+ "uniqueConstraints": {},
2526
+ "checkConstraints": {}
2527
+ },
2528
+ "sessions": {
2529
+ "name": "sessions",
2530
+ "columns": {
2531
+ "id": {
2532
+ "name": "id",
2533
+ "type": "text",
2534
+ "primaryKey": true,
2535
+ "notNull": true,
2536
+ "autoincrement": false
2537
+ },
2538
+ "tenant_id": {
2539
+ "name": "tenant_id",
2540
+ "type": "text",
2541
+ "primaryKey": false,
2542
+ "notNull": true,
2543
+ "autoincrement": false
2544
+ },
2545
+ "user_id": {
2546
+ "name": "user_id",
2547
+ "type": "text",
2548
+ "primaryKey": false,
2549
+ "notNull": true,
2550
+ "autoincrement": false
2551
+ },
2552
+ "expires_at": {
2553
+ "name": "expires_at",
2554
+ "type": "integer",
2555
+ "primaryKey": false,
2556
+ "notNull": true,
2557
+ "autoincrement": false
2558
+ },
2559
+ "created_at": {
2560
+ "name": "created_at",
2561
+ "type": "integer",
2562
+ "primaryKey": false,
2563
+ "notNull": false,
2564
+ "autoincrement": false
2565
+ }
2566
+ },
2567
+ "indexes": {},
2568
+ "foreignKeys": {
2569
+ "sessions_tenant_id_tenants_id_fk": {
2570
+ "name": "sessions_tenant_id_tenants_id_fk",
2571
+ "tableFrom": "sessions",
2572
+ "tableTo": "tenants",
2573
+ "columnsFrom": [
2574
+ "tenant_id"
2575
+ ],
2576
+ "columnsTo": [
2577
+ "id"
2578
+ ],
2579
+ "onDelete": "no action",
2580
+ "onUpdate": "no action"
2581
+ },
2582
+ "sessions_user_id_users_id_fk": {
2583
+ "name": "sessions_user_id_users_id_fk",
2584
+ "tableFrom": "sessions",
2585
+ "tableTo": "users",
2586
+ "columnsFrom": [
2587
+ "user_id"
2588
+ ],
2589
+ "columnsTo": [
2590
+ "id"
2591
+ ],
2592
+ "onDelete": "cascade",
2593
+ "onUpdate": "no action"
2594
+ }
2595
+ },
2596
+ "compositePrimaryKeys": {},
2597
+ "uniqueConstraints": {},
2598
+ "checkConstraints": {}
2599
+ },
2600
+ "suppressions": {
2601
+ "name": "suppressions",
2602
+ "columns": {
2603
+ "id": {
2604
+ "name": "id",
2605
+ "type": "text",
2606
+ "primaryKey": true,
2607
+ "notNull": true,
2608
+ "autoincrement": false
2609
+ },
2610
+ "tenant_id": {
2611
+ "name": "tenant_id",
2612
+ "type": "text",
2613
+ "primaryKey": false,
2614
+ "notNull": true,
2615
+ "autoincrement": false
2616
+ },
2617
+ "email": {
2618
+ "name": "email",
2619
+ "type": "text",
2620
+ "primaryKey": false,
2621
+ "notNull": true,
2622
+ "autoincrement": false
2623
+ },
2624
+ "reason": {
2625
+ "name": "reason",
2626
+ "type": "text",
2627
+ "primaryKey": false,
2628
+ "notNull": true,
2629
+ "autoincrement": false
2630
+ },
2631
+ "source": {
2632
+ "name": "source",
2633
+ "type": "text",
2634
+ "primaryKey": false,
2635
+ "notNull": false,
2636
+ "autoincrement": false
2637
+ },
2638
+ "created_at": {
2639
+ "name": "created_at",
2640
+ "type": "integer",
2641
+ "primaryKey": false,
2642
+ "notNull": false,
2643
+ "autoincrement": false
2644
+ }
2645
+ },
2646
+ "indexes": {},
2647
+ "foreignKeys": {
2648
+ "suppressions_tenant_id_tenants_id_fk": {
2649
+ "name": "suppressions_tenant_id_tenants_id_fk",
2650
+ "tableFrom": "suppressions",
2651
+ "tableTo": "tenants",
2652
+ "columnsFrom": [
2653
+ "tenant_id"
2654
+ ],
2655
+ "columnsTo": [
2656
+ "id"
2657
+ ],
2658
+ "onDelete": "no action",
2659
+ "onUpdate": "no action"
2660
+ }
2661
+ },
2662
+ "compositePrimaryKeys": {},
2663
+ "uniqueConstraints": {},
2664
+ "checkConstraints": {}
2665
+ },
2666
+ "templates": {
2667
+ "name": "templates",
2668
+ "columns": {
2669
+ "id": {
2670
+ "name": "id",
2671
+ "type": "text",
2672
+ "primaryKey": true,
2673
+ "notNull": true,
2674
+ "autoincrement": false
2675
+ },
2676
+ "tenant_id": {
2677
+ "name": "tenant_id",
2678
+ "type": "text",
2679
+ "primaryKey": false,
2680
+ "notNull": true,
2681
+ "autoincrement": false
2682
+ },
2683
+ "name": {
2684
+ "name": "name",
2685
+ "type": "text",
2686
+ "primaryKey": false,
2687
+ "notNull": true,
2688
+ "autoincrement": false
2689
+ },
2690
+ "slug": {
2691
+ "name": "slug",
2692
+ "type": "text",
2693
+ "primaryKey": false,
2694
+ "notNull": true,
2695
+ "autoincrement": false
2696
+ },
2697
+ "subject": {
2698
+ "name": "subject",
2699
+ "type": "text",
2700
+ "primaryKey": false,
2701
+ "notNull": true,
2702
+ "autoincrement": false
2703
+ },
2704
+ "body_html": {
2705
+ "name": "body_html",
2706
+ "type": "text",
2707
+ "primaryKey": false,
2708
+ "notNull": true,
2709
+ "autoincrement": false
2710
+ },
2711
+ "body_text": {
2712
+ "name": "body_text",
2713
+ "type": "text",
2714
+ "primaryKey": false,
2715
+ "notNull": false,
2716
+ "autoincrement": false
2717
+ },
2718
+ "variables": {
2719
+ "name": "variables",
2720
+ "type": "text",
2721
+ "primaryKey": false,
2722
+ "notNull": false,
2723
+ "autoincrement": false
2724
+ },
2725
+ "category": {
2726
+ "name": "category",
2727
+ "type": "text",
2728
+ "primaryKey": false,
2729
+ "notNull": false,
2730
+ "autoincrement": false
2731
+ },
2732
+ "is_active": {
2733
+ "name": "is_active",
2734
+ "type": "integer",
2735
+ "primaryKey": false,
2736
+ "notNull": false,
2737
+ "autoincrement": false,
2738
+ "default": true
2739
+ },
2740
+ "created_at": {
2741
+ "name": "created_at",
2742
+ "type": "integer",
2743
+ "primaryKey": false,
2744
+ "notNull": false,
2745
+ "autoincrement": false
2746
+ }
2747
+ },
2748
+ "indexes": {
2749
+ "uq_templates_tenant_slug": {
2750
+ "name": "uq_templates_tenant_slug",
2751
+ "columns": [
2752
+ "tenant_id",
2753
+ "slug"
2754
+ ],
2755
+ "isUnique": true
2756
+ }
2757
+ },
2758
+ "foreignKeys": {
2759
+ "templates_tenant_id_tenants_id_fk": {
2760
+ "name": "templates_tenant_id_tenants_id_fk",
2761
+ "tableFrom": "templates",
2762
+ "tableTo": "tenants",
2763
+ "columnsFrom": [
2764
+ "tenant_id"
2765
+ ],
2766
+ "columnsTo": [
2767
+ "id"
2768
+ ],
2769
+ "onDelete": "no action",
2770
+ "onUpdate": "no action"
2771
+ }
2772
+ },
2773
+ "compositePrimaryKeys": {},
2774
+ "uniqueConstraints": {},
2775
+ "checkConstraints": {}
2776
+ },
2777
+ "tenants": {
2778
+ "name": "tenants",
2779
+ "columns": {
2780
+ "id": {
2781
+ "name": "id",
2782
+ "type": "text",
2783
+ "primaryKey": true,
2784
+ "notNull": true,
2785
+ "autoincrement": false
2786
+ },
2787
+ "name": {
2788
+ "name": "name",
2789
+ "type": "text",
2790
+ "primaryKey": false,
2791
+ "notNull": true,
2792
+ "autoincrement": false
2793
+ },
2794
+ "slug": {
2795
+ "name": "slug",
2796
+ "type": "text",
2797
+ "primaryKey": false,
2798
+ "notNull": true,
2799
+ "autoincrement": false
2800
+ },
2801
+ "plan": {
2802
+ "name": "plan",
2803
+ "type": "text",
2804
+ "primaryKey": false,
2805
+ "notNull": false,
2806
+ "autoincrement": false,
2807
+ "default": "'free'"
2808
+ },
2809
+ "settings": {
2810
+ "name": "settings",
2811
+ "type": "text",
2812
+ "primaryKey": false,
2813
+ "notNull": false,
2814
+ "autoincrement": false
2815
+ },
2816
+ "business_model": {
2817
+ "name": "business_model",
2818
+ "type": "text",
2819
+ "primaryKey": false,
2820
+ "notNull": false,
2821
+ "autoincrement": false
2822
+ },
2823
+ "created_at": {
2824
+ "name": "created_at",
2825
+ "type": "integer",
2826
+ "primaryKey": false,
2827
+ "notNull": false,
2828
+ "autoincrement": false
2829
+ },
2830
+ "archived_at": {
2831
+ "name": "archived_at",
2832
+ "type": "integer",
2833
+ "primaryKey": false,
2834
+ "notNull": false,
2835
+ "autoincrement": false
2836
+ },
2837
+ "public_host": {
2838
+ "name": "public_host",
2839
+ "type": "text",
2840
+ "primaryKey": false,
2841
+ "notNull": false,
2842
+ "autoincrement": false
2843
+ },
2844
+ "locale": {
2845
+ "name": "locale",
2846
+ "type": "text",
2847
+ "primaryKey": false,
2848
+ "notNull": false,
2849
+ "autoincrement": false
2850
+ },
2851
+ "config_version": {
2852
+ "name": "config_version",
2853
+ "type": "integer",
2854
+ "primaryKey": false,
2855
+ "notNull": true,
2856
+ "autoincrement": false,
2857
+ "default": 0
2858
+ }
2859
+ },
2860
+ "indexes": {
2861
+ "tenants_slug_unique": {
2862
+ "name": "tenants_slug_unique",
2863
+ "columns": [
2864
+ "slug"
2865
+ ],
2866
+ "isUnique": true
2867
+ },
2868
+ "uq_tenants_public_host": {
2869
+ "name": "uq_tenants_public_host",
2870
+ "columns": [
2871
+ "public_host"
2872
+ ],
2873
+ "isUnique": true,
2874
+ "where": "public_host IS NOT NULL"
2875
+ }
2876
+ },
2877
+ "foreignKeys": {},
2878
+ "compositePrimaryKeys": {},
2879
+ "uniqueConstraints": {},
2880
+ "checkConstraints": {}
2881
+ },
2882
+ "topics": {
2883
+ "name": "topics",
2884
+ "columns": {
2885
+ "id": {
2886
+ "name": "id",
2887
+ "type": "text",
2888
+ "primaryKey": true,
2889
+ "notNull": true,
2890
+ "autoincrement": false
2891
+ },
2892
+ "tenant_id": {
2893
+ "name": "tenant_id",
2894
+ "type": "text",
2895
+ "primaryKey": false,
2896
+ "notNull": true,
2897
+ "autoincrement": false
2898
+ },
2899
+ "slug": {
2900
+ "name": "slug",
2901
+ "type": "text",
2902
+ "primaryKey": false,
2903
+ "notNull": true,
2904
+ "autoincrement": false
2905
+ },
2906
+ "name": {
2907
+ "name": "name",
2908
+ "type": "text",
2909
+ "primaryKey": false,
2910
+ "notNull": true,
2911
+ "autoincrement": false
2912
+ },
2913
+ "kind": {
2914
+ "name": "kind",
2915
+ "type": "text",
2916
+ "primaryKey": false,
2917
+ "notNull": true,
2918
+ "autoincrement": false
2919
+ },
2920
+ "description": {
2921
+ "name": "description",
2922
+ "type": "text",
2923
+ "primaryKey": false,
2924
+ "notNull": false,
2925
+ "autoincrement": false
2926
+ },
2927
+ "default_subscribed": {
2928
+ "name": "default_subscribed",
2929
+ "type": "integer",
2930
+ "primaryKey": false,
2931
+ "notNull": true,
2932
+ "autoincrement": false,
2933
+ "default": true
2934
+ },
2935
+ "created_at": {
2936
+ "name": "created_at",
2937
+ "type": "integer",
2938
+ "primaryKey": false,
2939
+ "notNull": false,
2940
+ "autoincrement": false
2941
+ }
2942
+ },
2943
+ "indexes": {
2944
+ "uq_topics_tenant_slug": {
2945
+ "name": "uq_topics_tenant_slug",
2946
+ "columns": [
2947
+ "tenant_id",
2948
+ "slug"
2949
+ ],
2950
+ "isUnique": true
2951
+ }
2952
+ },
2953
+ "foreignKeys": {
2954
+ "topics_tenant_id_tenants_id_fk": {
2955
+ "name": "topics_tenant_id_tenants_id_fk",
2956
+ "tableFrom": "topics",
2957
+ "tableTo": "tenants",
2958
+ "columnsFrom": [
2959
+ "tenant_id"
2960
+ ],
2961
+ "columnsTo": [
2962
+ "id"
2963
+ ],
2964
+ "onDelete": "no action",
2965
+ "onUpdate": "no action"
2966
+ }
2967
+ },
2968
+ "compositePrimaryKeys": {},
2969
+ "uniqueConstraints": {},
2970
+ "checkConstraints": {}
2971
+ },
2972
+ "transport_configs": {
2973
+ "name": "transport_configs",
2974
+ "columns": {
2975
+ "id": {
2976
+ "name": "id",
2977
+ "type": "text",
2978
+ "primaryKey": true,
2979
+ "notNull": true,
2980
+ "autoincrement": false
2981
+ },
2982
+ "tenant_id": {
2983
+ "name": "tenant_id",
2984
+ "type": "text",
2985
+ "primaryKey": false,
2986
+ "notNull": true,
2987
+ "autoincrement": false
2988
+ },
2989
+ "provider": {
2990
+ "name": "provider",
2991
+ "type": "text",
2992
+ "primaryKey": false,
2993
+ "notNull": true,
2994
+ "autoincrement": false
2995
+ },
2996
+ "config": {
2997
+ "name": "config",
2998
+ "type": "text",
2999
+ "primaryKey": false,
3000
+ "notNull": true,
3001
+ "autoincrement": false
3002
+ },
3003
+ "is_active": {
3004
+ "name": "is_active",
3005
+ "type": "integer",
3006
+ "primaryKey": false,
3007
+ "notNull": false,
3008
+ "autoincrement": false,
3009
+ "default": true
3010
+ },
3011
+ "dkim_verified": {
3012
+ "name": "dkim_verified",
3013
+ "type": "integer",
3014
+ "primaryKey": false,
3015
+ "notNull": false,
3016
+ "autoincrement": false,
3017
+ "default": false
3018
+ },
3019
+ "from_email": {
3020
+ "name": "from_email",
3021
+ "type": "text",
3022
+ "primaryKey": false,
3023
+ "notNull": true,
3024
+ "autoincrement": false
3025
+ },
3026
+ "from_name": {
3027
+ "name": "from_name",
3028
+ "type": "text",
3029
+ "primaryKey": false,
3030
+ "notNull": false,
3031
+ "autoincrement": false
3032
+ },
3033
+ "daily_limit": {
3034
+ "name": "daily_limit",
3035
+ "type": "integer",
3036
+ "primaryKey": false,
3037
+ "notNull": false,
3038
+ "autoincrement": false
3039
+ },
3040
+ "kind": {
3041
+ "name": "kind",
3042
+ "type": "text",
3043
+ "primaryKey": false,
3044
+ "notNull": false,
3045
+ "autoincrement": false
3046
+ },
3047
+ "name": {
3048
+ "name": "name",
3049
+ "type": "text",
3050
+ "primaryKey": false,
3051
+ "notNull": false,
3052
+ "autoincrement": false
3053
+ },
3054
+ "reply_to": {
3055
+ "name": "reply_to",
3056
+ "type": "text",
3057
+ "primaryKey": false,
3058
+ "notNull": false,
3059
+ "autoincrement": false
3060
+ },
3061
+ "created_at": {
3062
+ "name": "created_at",
3063
+ "type": "integer",
3064
+ "primaryKey": false,
3065
+ "notNull": false,
3066
+ "autoincrement": false
3067
+ }
3068
+ },
3069
+ "indexes": {},
3070
+ "foreignKeys": {
3071
+ "transport_configs_tenant_id_tenants_id_fk": {
3072
+ "name": "transport_configs_tenant_id_tenants_id_fk",
3073
+ "tableFrom": "transport_configs",
3074
+ "tableTo": "tenants",
3075
+ "columnsFrom": [
3076
+ "tenant_id"
3077
+ ],
3078
+ "columnsTo": [
3079
+ "id"
3080
+ ],
3081
+ "onDelete": "no action",
3082
+ "onUpdate": "no action"
3083
+ }
3084
+ },
3085
+ "compositePrimaryKeys": {},
3086
+ "uniqueConstraints": {},
3087
+ "checkConstraints": {}
3088
+ },
3089
+ "users": {
3090
+ "name": "users",
3091
+ "columns": {
3092
+ "id": {
3093
+ "name": "id",
3094
+ "type": "text",
3095
+ "primaryKey": true,
3096
+ "notNull": true,
3097
+ "autoincrement": false
3098
+ },
3099
+ "tenant_id": {
3100
+ "name": "tenant_id",
3101
+ "type": "text",
3102
+ "primaryKey": false,
3103
+ "notNull": true,
3104
+ "autoincrement": false
3105
+ },
3106
+ "email": {
3107
+ "name": "email",
3108
+ "type": "text",
3109
+ "primaryKey": false,
3110
+ "notNull": true,
3111
+ "autoincrement": false
3112
+ },
3113
+ "name": {
3114
+ "name": "name",
3115
+ "type": "text",
3116
+ "primaryKey": false,
3117
+ "notNull": false,
3118
+ "autoincrement": false
3119
+ },
3120
+ "role": {
3121
+ "name": "role",
3122
+ "type": "text",
3123
+ "primaryKey": false,
3124
+ "notNull": true,
3125
+ "autoincrement": false,
3126
+ "default": "'member'"
3127
+ },
3128
+ "instance_role": {
3129
+ "name": "instance_role",
3130
+ "type": "text",
3131
+ "primaryKey": false,
3132
+ "notNull": false,
3133
+ "autoincrement": false
3134
+ },
3135
+ "last_login_at": {
3136
+ "name": "last_login_at",
3137
+ "type": "integer",
3138
+ "primaryKey": false,
3139
+ "notNull": false,
3140
+ "autoincrement": false
3141
+ },
3142
+ "deactivated_at": {
3143
+ "name": "deactivated_at",
3144
+ "type": "integer",
3145
+ "primaryKey": false,
3146
+ "notNull": false,
3147
+ "autoincrement": false
3148
+ },
3149
+ "pending_email": {
3150
+ "name": "pending_email",
3151
+ "type": "text",
3152
+ "primaryKey": false,
3153
+ "notNull": false,
3154
+ "autoincrement": false
3155
+ },
3156
+ "pending_email_token_hash": {
3157
+ "name": "pending_email_token_hash",
3158
+ "type": "text",
3159
+ "primaryKey": false,
3160
+ "notNull": false,
3161
+ "autoincrement": false
3162
+ },
3163
+ "pending_email_expires_at": {
3164
+ "name": "pending_email_expires_at",
3165
+ "type": "integer",
3166
+ "primaryKey": false,
3167
+ "notNull": false,
3168
+ "autoincrement": false
3169
+ },
3170
+ "created_at": {
3171
+ "name": "created_at",
3172
+ "type": "integer",
3173
+ "primaryKey": false,
3174
+ "notNull": false,
3175
+ "autoincrement": false
3176
+ }
3177
+ },
3178
+ "indexes": {
3179
+ "uq_users_tenant_email": {
3180
+ "name": "uq_users_tenant_email",
3181
+ "columns": [
3182
+ "tenant_id",
3183
+ "email"
3184
+ ],
3185
+ "isUnique": true
3186
+ }
3187
+ },
3188
+ "foreignKeys": {
3189
+ "users_tenant_id_tenants_id_fk": {
3190
+ "name": "users_tenant_id_tenants_id_fk",
3191
+ "tableFrom": "users",
3192
+ "tableTo": "tenants",
3193
+ "columnsFrom": [
3194
+ "tenant_id"
3195
+ ],
3196
+ "columnsTo": [
3197
+ "id"
3198
+ ],
3199
+ "onDelete": "no action",
3200
+ "onUpdate": "no action"
3201
+ }
3202
+ },
3203
+ "compositePrimaryKeys": {},
3204
+ "uniqueConstraints": {},
3205
+ "checkConstraints": {}
3206
+ },
3207
+ "webhook_endpoints": {
3208
+ "name": "webhook_endpoints",
3209
+ "columns": {
3210
+ "id": {
3211
+ "name": "id",
3212
+ "type": "text",
3213
+ "primaryKey": true,
3214
+ "notNull": true,
3215
+ "autoincrement": false
3216
+ },
3217
+ "tenant_id": {
3218
+ "name": "tenant_id",
3219
+ "type": "text",
3220
+ "primaryKey": false,
3221
+ "notNull": true,
3222
+ "autoincrement": false
3223
+ },
3224
+ "slug": {
3225
+ "name": "slug",
3226
+ "type": "text",
3227
+ "primaryKey": false,
3228
+ "notNull": true,
3229
+ "autoincrement": false
3230
+ },
3231
+ "kind": {
3232
+ "name": "kind",
3233
+ "type": "text",
3234
+ "primaryKey": false,
3235
+ "notNull": true,
3236
+ "autoincrement": false,
3237
+ "default": "'webhook'"
3238
+ },
3239
+ "url": {
3240
+ "name": "url",
3241
+ "type": "text",
3242
+ "primaryKey": false,
3243
+ "notNull": true,
3244
+ "autoincrement": false
3245
+ },
3246
+ "secret": {
3247
+ "name": "secret",
3248
+ "type": "text",
3249
+ "primaryKey": false,
3250
+ "notNull": false,
3251
+ "autoincrement": false
3252
+ },
3253
+ "events": {
3254
+ "name": "events",
3255
+ "type": "text",
3256
+ "primaryKey": false,
3257
+ "notNull": true,
3258
+ "autoincrement": false
3259
+ },
3260
+ "config": {
3261
+ "name": "config",
3262
+ "type": "text",
3263
+ "primaryKey": false,
3264
+ "notNull": false,
3265
+ "autoincrement": false
3266
+ },
3267
+ "enabled": {
3268
+ "name": "enabled",
3269
+ "type": "integer",
3270
+ "primaryKey": false,
3271
+ "notNull": true,
3272
+ "autoincrement": false,
3273
+ "default": true
3274
+ },
3275
+ "created_at": {
3276
+ "name": "created_at",
3277
+ "type": "integer",
3278
+ "primaryKey": false,
3279
+ "notNull": false,
3280
+ "autoincrement": false
3281
+ },
3282
+ "updated_at": {
3283
+ "name": "updated_at",
3284
+ "type": "integer",
3285
+ "primaryKey": false,
3286
+ "notNull": false,
3287
+ "autoincrement": false
3288
+ }
3289
+ },
3290
+ "indexes": {
3291
+ "uq_webhook_endpoints_tenant_slug": {
3292
+ "name": "uq_webhook_endpoints_tenant_slug",
3293
+ "columns": [
3294
+ "tenant_id",
3295
+ "slug"
3296
+ ],
3297
+ "isUnique": true
3298
+ }
3299
+ },
3300
+ "foreignKeys": {
3301
+ "webhook_endpoints_tenant_id_tenants_id_fk": {
3302
+ "name": "webhook_endpoints_tenant_id_tenants_id_fk",
3303
+ "tableFrom": "webhook_endpoints",
3304
+ "tableTo": "tenants",
3305
+ "columnsFrom": [
3306
+ "tenant_id"
3307
+ ],
3308
+ "columnsTo": [
3309
+ "id"
3310
+ ],
3311
+ "onDelete": "no action",
3312
+ "onUpdate": "no action"
3313
+ }
3314
+ },
3315
+ "compositePrimaryKeys": {},
3316
+ "uniqueConstraints": {},
3317
+ "checkConstraints": {}
3318
+ },
3319
+ "webhook_outbox": {
3320
+ "name": "webhook_outbox",
3321
+ "columns": {
3322
+ "id": {
3323
+ "name": "id",
3324
+ "type": "text",
3325
+ "primaryKey": true,
3326
+ "notNull": true,
3327
+ "autoincrement": false
3328
+ },
3329
+ "tenant_id": {
3330
+ "name": "tenant_id",
3331
+ "type": "text",
3332
+ "primaryKey": false,
3333
+ "notNull": true,
3334
+ "autoincrement": false
3335
+ },
3336
+ "endpoint_id": {
3337
+ "name": "endpoint_id",
3338
+ "type": "text",
3339
+ "primaryKey": false,
3340
+ "notNull": true,
3341
+ "autoincrement": false
3342
+ },
3343
+ "event": {
3344
+ "name": "event",
3345
+ "type": "text",
3346
+ "primaryKey": false,
3347
+ "notNull": true,
3348
+ "autoincrement": false
3349
+ },
3350
+ "payload": {
3351
+ "name": "payload",
3352
+ "type": "text",
3353
+ "primaryKey": false,
3354
+ "notNull": true,
3355
+ "autoincrement": false
3356
+ },
3357
+ "status": {
3358
+ "name": "status",
3359
+ "type": "text",
3360
+ "primaryKey": false,
3361
+ "notNull": true,
3362
+ "autoincrement": false,
3363
+ "default": "'pending'"
3364
+ },
3365
+ "attempts": {
3366
+ "name": "attempts",
3367
+ "type": "integer",
3368
+ "primaryKey": false,
3369
+ "notNull": true,
3370
+ "autoincrement": false,
3371
+ "default": 0
3372
+ },
3373
+ "next_attempt_at": {
3374
+ "name": "next_attempt_at",
3375
+ "type": "integer",
3376
+ "primaryKey": false,
3377
+ "notNull": true,
3378
+ "autoincrement": false
3379
+ },
3380
+ "last_error": {
3381
+ "name": "last_error",
3382
+ "type": "text",
3383
+ "primaryKey": false,
3384
+ "notNull": false,
3385
+ "autoincrement": false
3386
+ },
3387
+ "dedup_key": {
3388
+ "name": "dedup_key",
3389
+ "type": "text",
3390
+ "primaryKey": false,
3391
+ "notNull": false,
3392
+ "autoincrement": false
3393
+ },
3394
+ "created_at": {
3395
+ "name": "created_at",
3396
+ "type": "integer",
3397
+ "primaryKey": false,
3398
+ "notNull": true,
3399
+ "autoincrement": false
3400
+ },
3401
+ "delivered_at": {
3402
+ "name": "delivered_at",
3403
+ "type": "integer",
3404
+ "primaryKey": false,
3405
+ "notNull": false,
3406
+ "autoincrement": false
3407
+ }
3408
+ },
3409
+ "indexes": {
3410
+ "idx_webhook_outbox_due": {
3411
+ "name": "idx_webhook_outbox_due",
3412
+ "columns": [
3413
+ "tenant_id",
3414
+ "next_attempt_at"
3415
+ ],
3416
+ "isUnique": false,
3417
+ "where": "status = 'pending'"
3418
+ },
3419
+ "idx_webhook_outbox_tenant_event": {
3420
+ "name": "idx_webhook_outbox_tenant_event",
3421
+ "columns": [
3422
+ "tenant_id",
3423
+ "event",
3424
+ "created_at"
3425
+ ],
3426
+ "isUnique": false
3427
+ },
3428
+ "uq_webhook_outbox_dedup": {
3429
+ "name": "uq_webhook_outbox_dedup",
3430
+ "columns": [
3431
+ "tenant_id",
3432
+ "endpoint_id",
3433
+ "dedup_key"
3434
+ ],
3435
+ "isUnique": true,
3436
+ "where": "dedup_key IS NOT NULL"
3437
+ }
3438
+ },
3439
+ "foreignKeys": {
3440
+ "webhook_outbox_tenant_id_tenants_id_fk": {
3441
+ "name": "webhook_outbox_tenant_id_tenants_id_fk",
3442
+ "tableFrom": "webhook_outbox",
3443
+ "tableTo": "tenants",
3444
+ "columnsFrom": [
3445
+ "tenant_id"
3446
+ ],
3447
+ "columnsTo": [
3448
+ "id"
3449
+ ],
3450
+ "onDelete": "no action",
3451
+ "onUpdate": "no action"
3452
+ }
3453
+ },
3454
+ "compositePrimaryKeys": {},
3455
+ "uniqueConstraints": {},
3456
+ "checkConstraints": {}
3457
+ }
3458
+ },
3459
+ "views": {},
3460
+ "enums": {},
3461
+ "_meta": {
3462
+ "schemas": {},
3463
+ "tables": {},
3464
+ "columns": {}
3465
+ },
3466
+ "internal": {
3467
+ "indexes": {}
3468
+ }
3469
+ }