@paperclipai/db 0.2.2 → 0.2.4

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