@coffre/db 0.6.2 → 0.7.0

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 (64) hide show
  1. package/dist/connect.d.ts +1 -1
  2. package/dist/{database-C63WjCrC.d.ts → database-BEnexh-3.d.ts} +1 -1
  3. package/dist/dialect.d.ts +1 -1
  4. package/dist/grants.d.ts +1 -1
  5. package/dist/hyperdrive.d.ts +1 -1
  6. package/dist/index.d.ts +2 -2
  7. package/dist/log.d.ts +22 -1
  8. package/dist/log.js +37 -2
  9. package/dist/migrations/postgres/0004_environment_parents.sql +5 -0
  10. package/dist/migrations/postgres/0005_personal_tokens.sql +5 -0
  11. package/dist/migrations/postgres/0006_uploaded_keys.sql +2 -0
  12. package/dist/migrations/postgres/0007_personal_configs.sql +4 -0
  13. package/dist/migrations/postgres/0008_recipes.sql +19 -0
  14. package/dist/migrations/postgres/meta/0004_snapshot.json +2913 -0
  15. package/dist/migrations/postgres/meta/0005_snapshot.json +2929 -0
  16. package/dist/migrations/postgres/meta/0006_snapshot.json +2935 -0
  17. package/dist/migrations/postgres/meta/0007_snapshot.json +2967 -0
  18. package/dist/migrations/postgres/meta/0008_snapshot.json +2985 -0
  19. package/dist/migrations/postgres/meta/_journal.json +35 -0
  20. package/dist/migrations/sqlite/0004_environment_parents.sql +3 -0
  21. package/dist/migrations/sqlite/0005_personal_tokens.sql +37 -0
  22. package/dist/migrations/sqlite/0006_uploaded_keys.sql +1 -0
  23. package/dist/migrations/sqlite/0007_personal_configs.sql +3 -0
  24. package/dist/migrations/sqlite/0008_recipes.sql +15 -0
  25. package/dist/migrations/sqlite/meta/0004_snapshot.json +2641 -0
  26. package/dist/migrations/sqlite/meta/0005_snapshot.json +2656 -0
  27. package/dist/migrations/sqlite/meta/0006_snapshot.json +2663 -0
  28. package/dist/migrations/sqlite/meta/0007_snapshot.json +2683 -0
  29. package/dist/migrations/sqlite/meta/0008_snapshot.json +2704 -0
  30. package/dist/migrations/sqlite/meta/_journal.json +35 -0
  31. package/dist/portable.d.ts +2 -2
  32. package/dist/{schema-a7PkFgea.d.ts → schema-BZRkBJQZ.d.ts} +102 -0
  33. package/dist/schema-sqlite.d.ts +114 -0
  34. package/dist/schema-sqlite.js +20 -4
  35. package/dist/schema-version.d.ts +1 -1
  36. package/dist/schema-version.js +70 -0
  37. package/dist/schema.d.ts +1 -1
  38. package/dist/schema.js +20 -4
  39. package/package.json +2 -2
  40. package/src/log.ts +40 -1
  41. package/src/migrations/postgres/0004_environment_parents.sql +5 -0
  42. package/src/migrations/postgres/0005_personal_tokens.sql +5 -0
  43. package/src/migrations/postgres/0006_uploaded_keys.sql +2 -0
  44. package/src/migrations/postgres/0007_personal_configs.sql +4 -0
  45. package/src/migrations/postgres/0008_recipes.sql +19 -0
  46. package/src/migrations/postgres/meta/0004_snapshot.json +2913 -0
  47. package/src/migrations/postgres/meta/0005_snapshot.json +2929 -0
  48. package/src/migrations/postgres/meta/0006_snapshot.json +2935 -0
  49. package/src/migrations/postgres/meta/0007_snapshot.json +2967 -0
  50. package/src/migrations/postgres/meta/0008_snapshot.json +2985 -0
  51. package/src/migrations/postgres/meta/_journal.json +35 -0
  52. package/src/migrations/sqlite/0004_environment_parents.sql +3 -0
  53. package/src/migrations/sqlite/0005_personal_tokens.sql +37 -0
  54. package/src/migrations/sqlite/0006_uploaded_keys.sql +1 -0
  55. package/src/migrations/sqlite/0007_personal_configs.sql +3 -0
  56. package/src/migrations/sqlite/0008_recipes.sql +15 -0
  57. package/src/migrations/sqlite/meta/0004_snapshot.json +2641 -0
  58. package/src/migrations/sqlite/meta/0005_snapshot.json +2656 -0
  59. package/src/migrations/sqlite/meta/0006_snapshot.json +2663 -0
  60. package/src/migrations/sqlite/meta/0007_snapshot.json +2683 -0
  61. package/src/migrations/sqlite/meta/0008_snapshot.json +2704 -0
  62. package/src/migrations/sqlite/meta/_journal.json +35 -0
  63. package/src/schema.sqlite.ts +31 -3
  64. package/src/schema.ts +37 -3
@@ -0,0 +1,2641 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "6c8539b6-8306-405b-848a-18716ed0faf1",
5
+ "prevId": "e88f495b-b45b-45f9-a361-e1b224e6ecfe",
6
+ "tables": {
7
+ "audit_chain_head": {
8
+ "name": "audit_chain_head",
9
+ "columns": {
10
+ "only_row": {
11
+ "name": "only_row",
12
+ "type": "integer",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false,
16
+ "default": true
17
+ },
18
+ "next_seq": {
19
+ "name": "next_seq",
20
+ "type": "integer",
21
+ "primaryKey": false,
22
+ "notNull": true,
23
+ "autoincrement": false,
24
+ "default": "0"
25
+ },
26
+ "head_hash": {
27
+ "name": "head_hash",
28
+ "type": "blob",
29
+ "primaryKey": false,
30
+ "notNull": true,
31
+ "autoincrement": false
32
+ }
33
+ },
34
+ "indexes": {},
35
+ "foreignKeys": {},
36
+ "compositePrimaryKeys": {},
37
+ "uniqueConstraints": {},
38
+ "checkConstraints": {
39
+ "audit_chain_head_only_row_check": {
40
+ "name": "audit_chain_head_only_row_check",
41
+ "value": "\"audit_chain_head\".\"only_row\""
42
+ },
43
+ "audit_chain_head_next_seq_check": {
44
+ "name": "audit_chain_head_next_seq_check",
45
+ "value": "\"audit_chain_head\".\"next_seq\" >= 0"
46
+ },
47
+ "audit_chain_head_head_hash_check": {
48
+ "name": "audit_chain_head_head_hash_check",
49
+ "value": "octet_length(\"audit_chain_head\".\"head_hash\") = 32"
50
+ }
51
+ }
52
+ },
53
+ "audit_log": {
54
+ "name": "audit_log",
55
+ "columns": {
56
+ "seq": {
57
+ "name": "seq",
58
+ "type": "integer",
59
+ "primaryKey": true,
60
+ "notNull": true,
61
+ "autoincrement": false
62
+ },
63
+ "author": {
64
+ "name": "author",
65
+ "type": "text",
66
+ "primaryKey": false,
67
+ "notNull": true,
68
+ "autoincrement": false
69
+ },
70
+ "key_id": {
71
+ "name": "key_id",
72
+ "type": "text",
73
+ "primaryKey": false,
74
+ "notNull": true,
75
+ "autoincrement": false
76
+ },
77
+ "occurred_at": {
78
+ "name": "occurred_at",
79
+ "type": "integer",
80
+ "primaryKey": false,
81
+ "notNull": true,
82
+ "autoincrement": false
83
+ },
84
+ "actor": {
85
+ "name": "actor",
86
+ "type": "text",
87
+ "primaryKey": false,
88
+ "notNull": true,
89
+ "autoincrement": false
90
+ },
91
+ "action": {
92
+ "name": "action",
93
+ "type": "text",
94
+ "primaryKey": false,
95
+ "notNull": true,
96
+ "autoincrement": false
97
+ },
98
+ "decision": {
99
+ "name": "decision",
100
+ "type": "text",
101
+ "primaryKey": false,
102
+ "notNull": true,
103
+ "autoincrement": false
104
+ },
105
+ "code": {
106
+ "name": "code",
107
+ "type": "text",
108
+ "primaryKey": false,
109
+ "notNull": false,
110
+ "autoincrement": false
111
+ },
112
+ "subject_principal": {
113
+ "name": "subject_principal",
114
+ "type": "text",
115
+ "primaryKey": false,
116
+ "notNull": false,
117
+ "autoincrement": false
118
+ },
119
+ "project_id": {
120
+ "name": "project_id",
121
+ "type": "text",
122
+ "primaryKey": false,
123
+ "notNull": false,
124
+ "autoincrement": false
125
+ },
126
+ "environment_id": {
127
+ "name": "environment_id",
128
+ "type": "text",
129
+ "primaryKey": false,
130
+ "notNull": false,
131
+ "autoincrement": false
132
+ },
133
+ "secret_id": {
134
+ "name": "secret_id",
135
+ "type": "text",
136
+ "primaryKey": false,
137
+ "notNull": false,
138
+ "autoincrement": false
139
+ },
140
+ "secret_version_id": {
141
+ "name": "secret_version_id",
142
+ "type": "text",
143
+ "primaryKey": false,
144
+ "notNull": false,
145
+ "autoincrement": false
146
+ },
147
+ "operation_id": {
148
+ "name": "operation_id",
149
+ "type": "text",
150
+ "primaryKey": false,
151
+ "notNull": false,
152
+ "autoincrement": false
153
+ },
154
+ "request_id": {
155
+ "name": "request_id",
156
+ "type": "text",
157
+ "primaryKey": false,
158
+ "notNull": false,
159
+ "autoincrement": false
160
+ },
161
+ "source_ip": {
162
+ "name": "source_ip",
163
+ "type": "text",
164
+ "primaryKey": false,
165
+ "notNull": false,
166
+ "autoincrement": false
167
+ },
168
+ "related_seq": {
169
+ "name": "related_seq",
170
+ "type": "integer",
171
+ "primaryKey": false,
172
+ "notNull": false,
173
+ "autoincrement": false
174
+ },
175
+ "metadata": {
176
+ "name": "metadata",
177
+ "type": "text",
178
+ "primaryKey": false,
179
+ "notNull": true,
180
+ "autoincrement": false,
181
+ "default": "'{}'"
182
+ },
183
+ "prev_hash": {
184
+ "name": "prev_hash",
185
+ "type": "blob",
186
+ "primaryKey": false,
187
+ "notNull": true,
188
+ "autoincrement": false
189
+ },
190
+ "mac": {
191
+ "name": "mac",
192
+ "type": "blob",
193
+ "primaryKey": false,
194
+ "notNull": true,
195
+ "autoincrement": false
196
+ },
197
+ "hash": {
198
+ "name": "hash",
199
+ "type": "blob",
200
+ "primaryKey": false,
201
+ "notNull": true,
202
+ "autoincrement": false
203
+ }
204
+ },
205
+ "indexes": {
206
+ "audit_log_project_idx": {
207
+ "name": "audit_log_project_idx",
208
+ "columns": [
209
+ "project_id",
210
+ "seq"
211
+ ],
212
+ "isUnique": false
213
+ },
214
+ "audit_log_environment_idx": {
215
+ "name": "audit_log_environment_idx",
216
+ "columns": [
217
+ "environment_id",
218
+ "seq"
219
+ ],
220
+ "isUnique": false
221
+ },
222
+ "audit_log_secret_idx": {
223
+ "name": "audit_log_secret_idx",
224
+ "columns": [
225
+ "secret_id",
226
+ "seq"
227
+ ],
228
+ "isUnique": false
229
+ },
230
+ "audit_log_actor_idx": {
231
+ "name": "audit_log_actor_idx",
232
+ "columns": [
233
+ "actor",
234
+ "seq"
235
+ ],
236
+ "isUnique": false
237
+ },
238
+ "audit_log_operation_idx": {
239
+ "name": "audit_log_operation_idx",
240
+ "columns": [
241
+ "operation_id",
242
+ "seq"
243
+ ],
244
+ "isUnique": false
245
+ },
246
+ "audit_log_action_idx": {
247
+ "name": "audit_log_action_idx",
248
+ "columns": [
249
+ "author",
250
+ "action",
251
+ "seq"
252
+ ],
253
+ "isUnique": false
254
+ },
255
+ "audit_log_releases_idx": {
256
+ "name": "audit_log_releases_idx",
257
+ "columns": [
258
+ "author",
259
+ "actor",
260
+ "action",
261
+ "decision",
262
+ "occurred_at"
263
+ ],
264
+ "isUnique": false
265
+ },
266
+ "audit_log_subject_idx": {
267
+ "name": "audit_log_subject_idx",
268
+ "columns": [
269
+ "author",
270
+ "subject_principal",
271
+ "seq"
272
+ ],
273
+ "isUnique": false
274
+ },
275
+ "audit_log_unbind_idx": {
276
+ "name": "audit_log_unbind_idx",
277
+ "columns": [
278
+ "json_extract(\"metadata\", '$.bindingId')"
279
+ ],
280
+ "isUnique": false,
281
+ "where": "\"audit_log\".\"author\" = 'app' AND \"audit_log\".\"action\" = 'token.unbind' AND \"audit_log\".\"decision\" = 'allow'"
282
+ },
283
+ "audit_log_exchange_idx": {
284
+ "name": "audit_log_exchange_idx",
285
+ "columns": [
286
+ "json_extract(\"metadata\", '$.credentialId')"
287
+ ],
288
+ "isUnique": false,
289
+ "where": "\"audit_log\".\"author\" = 'app' AND \"audit_log\".\"action\" = 'token.exchange' AND \"audit_log\".\"decision\" = 'allow'"
290
+ },
291
+ "audit_log_reference_end_idx": {
292
+ "name": "audit_log_reference_end_idx",
293
+ "columns": [
294
+ "related_seq"
295
+ ],
296
+ "isUnique": false,
297
+ "where": "\"audit_log\".\"author\" = 'vault' AND \"audit_log\".\"action\" = 'reference.end' AND \"audit_log\".\"decision\" = 'allow'"
298
+ },
299
+ "audit_log_also_project_idx": {
300
+ "name": "audit_log_also_project_idx",
301
+ "columns": [
302
+ "json_extract(\"metadata\", '$.also.projectId')",
303
+ "seq"
304
+ ],
305
+ "isUnique": false,
306
+ "where": "json_extract(\"audit_log\".\"metadata\", '$.also') IS NOT NULL"
307
+ },
308
+ "audit_log_also_environment_idx": {
309
+ "name": "audit_log_also_environment_idx",
310
+ "columns": [
311
+ "json_extract(\"metadata\", '$.also.environmentId')",
312
+ "seq"
313
+ ],
314
+ "isUnique": false,
315
+ "where": "json_extract(\"audit_log\".\"metadata\", '$.also') IS NOT NULL"
316
+ },
317
+ "audit_log_also_secret_idx": {
318
+ "name": "audit_log_also_secret_idx",
319
+ "columns": [
320
+ "json_extract(\"metadata\", '$.also.secretId')",
321
+ "seq"
322
+ ],
323
+ "isUnique": false,
324
+ "where": "json_extract(\"audit_log\".\"metadata\", '$.also') IS NOT NULL"
325
+ }
326
+ },
327
+ "foreignKeys": {
328
+ "audit_log_project_id_fkey": {
329
+ "name": "audit_log_project_id_fkey",
330
+ "tableFrom": "audit_log",
331
+ "tableTo": "projects",
332
+ "columnsFrom": [
333
+ "project_id"
334
+ ],
335
+ "columnsTo": [
336
+ "id"
337
+ ],
338
+ "onDelete": "restrict",
339
+ "onUpdate": "no action"
340
+ },
341
+ "audit_log_environment_id_fkey": {
342
+ "name": "audit_log_environment_id_fkey",
343
+ "tableFrom": "audit_log",
344
+ "tableTo": "environments",
345
+ "columnsFrom": [
346
+ "environment_id"
347
+ ],
348
+ "columnsTo": [
349
+ "id"
350
+ ],
351
+ "onDelete": "restrict",
352
+ "onUpdate": "no action"
353
+ },
354
+ "audit_log_secret_id_fkey": {
355
+ "name": "audit_log_secret_id_fkey",
356
+ "tableFrom": "audit_log",
357
+ "tableTo": "secrets",
358
+ "columnsFrom": [
359
+ "secret_id"
360
+ ],
361
+ "columnsTo": [
362
+ "id"
363
+ ],
364
+ "onDelete": "restrict",
365
+ "onUpdate": "no action"
366
+ },
367
+ "audit_log_secret_version_id_fkey": {
368
+ "name": "audit_log_secret_version_id_fkey",
369
+ "tableFrom": "audit_log",
370
+ "tableTo": "secret_versions",
371
+ "columnsFrom": [
372
+ "secret_version_id"
373
+ ],
374
+ "columnsTo": [
375
+ "id"
376
+ ],
377
+ "onDelete": "restrict",
378
+ "onUpdate": "no action"
379
+ },
380
+ "audit_log_related_seq_fkey": {
381
+ "name": "audit_log_related_seq_fkey",
382
+ "tableFrom": "audit_log",
383
+ "tableTo": "audit_log",
384
+ "columnsFrom": [
385
+ "related_seq"
386
+ ],
387
+ "columnsTo": [
388
+ "seq"
389
+ ],
390
+ "onDelete": "restrict",
391
+ "onUpdate": "no action"
392
+ }
393
+ },
394
+ "compositePrimaryKeys": {},
395
+ "uniqueConstraints": {},
396
+ "checkConstraints": {
397
+ "audit_log_author_check": {
398
+ "name": "audit_log_author_check",
399
+ "value": "\"audit_log\".\"author\" IN ('app', 'vault')"
400
+ },
401
+ "audit_log_actor_check": {
402
+ "name": "audit_log_actor_check",
403
+ "value": "\"audit_log\".\"actor\" GLOB 'user:?*' OR \"audit_log\".\"actor\" GLOB 'token:?*' OR \"audit_log\".\"actor\" GLOB 'system:?*'"
404
+ },
405
+ "audit_log_decision_check": {
406
+ "name": "audit_log_decision_check",
407
+ "value": "\"audit_log\".\"decision\" IN ('allow', 'deny')"
408
+ },
409
+ "audit_log_metadata_check": {
410
+ "name": "audit_log_metadata_check",
411
+ "value": "json_valid(\"audit_log\".\"metadata\")"
412
+ },
413
+ "audit_log_prev_hash_check": {
414
+ "name": "audit_log_prev_hash_check",
415
+ "value": "octet_length(\"audit_log\".\"prev_hash\") = 32"
416
+ },
417
+ "audit_log_mac_check": {
418
+ "name": "audit_log_mac_check",
419
+ "value": "octet_length(\"audit_log\".\"mac\") = 32"
420
+ },
421
+ "audit_log_hash_check": {
422
+ "name": "audit_log_hash_check",
423
+ "value": "octet_length(\"audit_log\".\"hash\") = 32"
424
+ }
425
+ }
426
+ },
427
+ "consumed_tokens": {
428
+ "name": "consumed_tokens",
429
+ "columns": {
430
+ "hash": {
431
+ "name": "hash",
432
+ "type": "blob",
433
+ "primaryKey": true,
434
+ "notNull": true,
435
+ "autoincrement": false
436
+ },
437
+ "consumed_at": {
438
+ "name": "consumed_at",
439
+ "type": "integer",
440
+ "primaryKey": false,
441
+ "notNull": true,
442
+ "autoincrement": false,
443
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
444
+ }
445
+ },
446
+ "indexes": {},
447
+ "foreignKeys": {},
448
+ "compositePrimaryKeys": {},
449
+ "uniqueConstraints": {},
450
+ "checkConstraints": {
451
+ "consumed_tokens_hash_check": {
452
+ "name": "consumed_tokens_hash_check",
453
+ "value": "octet_length(\"consumed_tokens\".\"hash\") = 32"
454
+ }
455
+ }
456
+ },
457
+ "credentials": {
458
+ "name": "credentials",
459
+ "columns": {
460
+ "id": {
461
+ "name": "id",
462
+ "type": "text",
463
+ "primaryKey": true,
464
+ "notNull": true,
465
+ "autoincrement": false
466
+ },
467
+ "kind": {
468
+ "name": "kind",
469
+ "type": "text",
470
+ "primaryKey": false,
471
+ "notNull": true,
472
+ "autoincrement": false
473
+ },
474
+ "auth_mac": {
475
+ "name": "auth_mac",
476
+ "type": "blob",
477
+ "primaryKey": false,
478
+ "notNull": true,
479
+ "autoincrement": false
480
+ },
481
+ "token_hash": {
482
+ "name": "token_hash",
483
+ "type": "blob",
484
+ "primaryKey": false,
485
+ "notNull": true,
486
+ "autoincrement": false
487
+ },
488
+ "token_hint": {
489
+ "name": "token_hint",
490
+ "type": "text",
491
+ "primaryKey": false,
492
+ "notNull": true,
493
+ "autoincrement": false
494
+ },
495
+ "generation": {
496
+ "name": "generation",
497
+ "type": "integer",
498
+ "primaryKey": false,
499
+ "notNull": true,
500
+ "autoincrement": false
501
+ },
502
+ "principal": {
503
+ "name": "principal",
504
+ "type": "text",
505
+ "primaryKey": false,
506
+ "notNull": true,
507
+ "autoincrement": false
508
+ },
509
+ "identity_id": {
510
+ "name": "identity_id",
511
+ "type": "text",
512
+ "primaryKey": false,
513
+ "notNull": false,
514
+ "autoincrement": false
515
+ },
516
+ "scope": {
517
+ "name": "scope",
518
+ "type": "text",
519
+ "primaryKey": false,
520
+ "notNull": false,
521
+ "autoincrement": false
522
+ },
523
+ "label": {
524
+ "name": "label",
525
+ "type": "text",
526
+ "primaryKey": false,
527
+ "notNull": false,
528
+ "autoincrement": false
529
+ },
530
+ "created_at": {
531
+ "name": "created_at",
532
+ "type": "integer",
533
+ "primaryKey": false,
534
+ "notNull": true,
535
+ "autoincrement": false,
536
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
537
+ },
538
+ "created_by": {
539
+ "name": "created_by",
540
+ "type": "text",
541
+ "primaryKey": false,
542
+ "notNull": true,
543
+ "autoincrement": false
544
+ },
545
+ "expires_at": {
546
+ "name": "expires_at",
547
+ "type": "integer",
548
+ "primaryKey": false,
549
+ "notNull": true,
550
+ "autoincrement": false
551
+ },
552
+ "last_used_at": {
553
+ "name": "last_used_at",
554
+ "type": "integer",
555
+ "primaryKey": false,
556
+ "notNull": false,
557
+ "autoincrement": false
558
+ },
559
+ "last_used_ip": {
560
+ "name": "last_used_ip",
561
+ "type": "text",
562
+ "primaryKey": false,
563
+ "notNull": false,
564
+ "autoincrement": false
565
+ },
566
+ "revoked_at": {
567
+ "name": "revoked_at",
568
+ "type": "integer",
569
+ "primaryKey": false,
570
+ "notNull": false,
571
+ "autoincrement": false
572
+ },
573
+ "revoked_by": {
574
+ "name": "revoked_by",
575
+ "type": "text",
576
+ "primaryKey": false,
577
+ "notNull": false,
578
+ "autoincrement": false
579
+ }
580
+ },
581
+ "indexes": {
582
+ "credentials_principal_idx": {
583
+ "name": "credentials_principal_idx",
584
+ "columns": [
585
+ "principal",
586
+ "generation"
587
+ ],
588
+ "isUnique": false
589
+ },
590
+ "credentials_live_idx": {
591
+ "name": "credentials_live_idx",
592
+ "columns": [
593
+ "principal",
594
+ "expires_at"
595
+ ],
596
+ "isUnique": false,
597
+ "where": "\"credentials\".\"revoked_at\" IS NULL"
598
+ },
599
+ "credentials_issued_by_idx": {
600
+ "name": "credentials_issued_by_idx",
601
+ "columns": [
602
+ "principal",
603
+ "created_by",
604
+ "created_at"
605
+ ],
606
+ "isUnique": false
607
+ },
608
+ "credentials_token_hash_key": {
609
+ "name": "credentials_token_hash_key",
610
+ "columns": [
611
+ "token_hash"
612
+ ],
613
+ "isUnique": true
614
+ }
615
+ },
616
+ "foreignKeys": {
617
+ "credentials_principal_fkey": {
618
+ "name": "credentials_principal_fkey",
619
+ "tableFrom": "credentials",
620
+ "tableTo": "vault_members",
621
+ "columnsFrom": [
622
+ "principal"
623
+ ],
624
+ "columnsTo": [
625
+ "principal"
626
+ ],
627
+ "onDelete": "restrict",
628
+ "onUpdate": "no action"
629
+ },
630
+ "credentials_identity_id_fkey": {
631
+ "name": "credentials_identity_id_fkey",
632
+ "tableFrom": "credentials",
633
+ "tableTo": "identities",
634
+ "columnsFrom": [
635
+ "identity_id",
636
+ "principal",
637
+ "generation"
638
+ ],
639
+ "columnsTo": [
640
+ "id",
641
+ "principal",
642
+ "generation"
643
+ ],
644
+ "onDelete": "restrict",
645
+ "onUpdate": "no action"
646
+ }
647
+ },
648
+ "compositePrimaryKeys": {},
649
+ "uniqueConstraints": {},
650
+ "checkConstraints": {
651
+ "credentials_kind_check": {
652
+ "name": "credentials_kind_check",
653
+ "value": "\"credentials\".\"kind\" IN ('browser', 'cli', 'service')"
654
+ },
655
+ "credentials_principal_check": {
656
+ "name": "credentials_principal_check",
657
+ "value": "\"credentials\".\"principal\" LIKE 'user:%' OR \"credentials\".\"principal\" LIKE 'token:%'"
658
+ },
659
+ "credentials_kind_matches_principal": {
660
+ "name": "credentials_kind_matches_principal",
661
+ "value": "(\"credentials\".\"kind\" = 'service') = (\"credentials\".\"principal\" LIKE 'token:%')"
662
+ },
663
+ "credentials_token_hash_check": {
664
+ "name": "credentials_token_hash_check",
665
+ "value": "octet_length(\"credentials\".\"token_hash\") = 32"
666
+ },
667
+ "credentials_auth_mac_check": {
668
+ "name": "credentials_auth_mac_check",
669
+ "value": "octet_length(\"credentials\".\"auth_mac\") = 32"
670
+ }
671
+ }
672
+ },
673
+ "device_authorizations": {
674
+ "name": "device_authorizations",
675
+ "columns": {
676
+ "id": {
677
+ "name": "id",
678
+ "type": "text",
679
+ "primaryKey": true,
680
+ "notNull": true,
681
+ "autoincrement": false
682
+ },
683
+ "device_code_hash": {
684
+ "name": "device_code_hash",
685
+ "type": "blob",
686
+ "primaryKey": false,
687
+ "notNull": true,
688
+ "autoincrement": false
689
+ },
690
+ "auth_mac": {
691
+ "name": "auth_mac",
692
+ "type": "blob",
693
+ "primaryKey": false,
694
+ "notNull": true,
695
+ "autoincrement": false
696
+ },
697
+ "user_code": {
698
+ "name": "user_code",
699
+ "type": "text",
700
+ "primaryKey": false,
701
+ "notNull": true,
702
+ "autoincrement": false
703
+ },
704
+ "client_label": {
705
+ "name": "client_label",
706
+ "type": "text",
707
+ "primaryKey": false,
708
+ "notNull": false,
709
+ "autoincrement": false
710
+ },
711
+ "client_ip": {
712
+ "name": "client_ip",
713
+ "type": "text",
714
+ "primaryKey": false,
715
+ "notNull": false,
716
+ "autoincrement": false
717
+ },
718
+ "created_at": {
719
+ "name": "created_at",
720
+ "type": "integer",
721
+ "primaryKey": false,
722
+ "notNull": true,
723
+ "autoincrement": false,
724
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
725
+ },
726
+ "expires_at": {
727
+ "name": "expires_at",
728
+ "type": "integer",
729
+ "primaryKey": false,
730
+ "notNull": true,
731
+ "autoincrement": false
732
+ },
733
+ "decided_at": {
734
+ "name": "decided_at",
735
+ "type": "integer",
736
+ "primaryKey": false,
737
+ "notNull": false,
738
+ "autoincrement": false
739
+ },
740
+ "decision": {
741
+ "name": "decision",
742
+ "type": "text",
743
+ "primaryKey": false,
744
+ "notNull": false,
745
+ "autoincrement": false
746
+ },
747
+ "generation": {
748
+ "name": "generation",
749
+ "type": "integer",
750
+ "primaryKey": false,
751
+ "notNull": true,
752
+ "autoincrement": false,
753
+ "default": 0
754
+ },
755
+ "principal": {
756
+ "name": "principal",
757
+ "type": "text",
758
+ "primaryKey": false,
759
+ "notNull": false,
760
+ "autoincrement": false
761
+ },
762
+ "consumed_at": {
763
+ "name": "consumed_at",
764
+ "type": "integer",
765
+ "primaryKey": false,
766
+ "notNull": false,
767
+ "autoincrement": false
768
+ }
769
+ },
770
+ "indexes": {
771
+ "device_authorizations_device_code_hash_key": {
772
+ "name": "device_authorizations_device_code_hash_key",
773
+ "columns": [
774
+ "device_code_hash"
775
+ ],
776
+ "isUnique": true
777
+ },
778
+ "device_authorizations_user_code_key": {
779
+ "name": "device_authorizations_user_code_key",
780
+ "columns": [
781
+ "user_code"
782
+ ],
783
+ "isUnique": true
784
+ }
785
+ },
786
+ "foreignKeys": {
787
+ "device_authorizations_principal_fkey": {
788
+ "name": "device_authorizations_principal_fkey",
789
+ "tableFrom": "device_authorizations",
790
+ "tableTo": "vault_members",
791
+ "columnsFrom": [
792
+ "principal"
793
+ ],
794
+ "columnsTo": [
795
+ "principal"
796
+ ],
797
+ "onDelete": "restrict",
798
+ "onUpdate": "no action"
799
+ }
800
+ },
801
+ "compositePrimaryKeys": {},
802
+ "uniqueConstraints": {},
803
+ "checkConstraints": {
804
+ "device_authorizations_auth_mac_check": {
805
+ "name": "device_authorizations_auth_mac_check",
806
+ "value": "octet_length(\"device_authorizations\".\"auth_mac\") = 32"
807
+ },
808
+ "device_authorizations_decision_check": {
809
+ "name": "device_authorizations_decision_check",
810
+ "value": "\"device_authorizations\".\"decision\" IS NULL OR \"device_authorizations\".\"decision\" IN ('approved', 'denied')"
811
+ },
812
+ "device_authorizations_approval_names_principal": {
813
+ "name": "device_authorizations_approval_names_principal",
814
+ "value": "(\"device_authorizations\".\"decision\" IS NULL AND \"device_authorizations\".\"decided_at\" IS NULL AND \"device_authorizations\".\"principal\" IS NULL AND \"device_authorizations\".\"generation\" = 0 AND \"device_authorizations\".\"consumed_at\" IS NULL)\n OR (\"device_authorizations\".\"decision\" IS NOT NULL AND \"device_authorizations\".\"decided_at\" IS NOT NULL AND (\n (\"device_authorizations\".\"decision\" = 'denied' AND \"device_authorizations\".\"principal\" IS NULL AND \"device_authorizations\".\"generation\" = 0 AND \"device_authorizations\".\"consumed_at\" IS NULL)\n OR (\"device_authorizations\".\"decision\" = 'approved' AND \"device_authorizations\".\"principal\" IS NOT NULL AND \"device_authorizations\".\"principal\" LIKE 'user:%')\n ))"
815
+ }
816
+ }
817
+ },
818
+ "dismissed_keys": {
819
+ "name": "dismissed_keys",
820
+ "columns": {
821
+ "environment_id": {
822
+ "name": "environment_id",
823
+ "type": "text",
824
+ "primaryKey": false,
825
+ "notNull": true,
826
+ "autoincrement": false
827
+ },
828
+ "key": {
829
+ "name": "key",
830
+ "type": "text",
831
+ "primaryKey": false,
832
+ "notNull": true,
833
+ "autoincrement": false
834
+ },
835
+ "dismissed_at": {
836
+ "name": "dismissed_at",
837
+ "type": "integer",
838
+ "primaryKey": false,
839
+ "notNull": true,
840
+ "autoincrement": false,
841
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
842
+ },
843
+ "dismissed_by": {
844
+ "name": "dismissed_by",
845
+ "type": "text",
846
+ "primaryKey": false,
847
+ "notNull": true,
848
+ "autoincrement": false
849
+ },
850
+ "restored_at": {
851
+ "name": "restored_at",
852
+ "type": "integer",
853
+ "primaryKey": false,
854
+ "notNull": false,
855
+ "autoincrement": false
856
+ },
857
+ "restored_by": {
858
+ "name": "restored_by",
859
+ "type": "text",
860
+ "primaryKey": false,
861
+ "notNull": false,
862
+ "autoincrement": false
863
+ }
864
+ },
865
+ "indexes": {},
866
+ "foreignKeys": {
867
+ "dismissed_keys_environment_id_fkey": {
868
+ "name": "dismissed_keys_environment_id_fkey",
869
+ "tableFrom": "dismissed_keys",
870
+ "tableTo": "environments",
871
+ "columnsFrom": [
872
+ "environment_id"
873
+ ],
874
+ "columnsTo": [
875
+ "id"
876
+ ],
877
+ "onDelete": "restrict",
878
+ "onUpdate": "no action"
879
+ }
880
+ },
881
+ "compositePrimaryKeys": {
882
+ "dismissed_keys_pkey": {
883
+ "columns": [
884
+ "environment_id",
885
+ "key"
886
+ ],
887
+ "name": "dismissed_keys_pkey"
888
+ }
889
+ },
890
+ "uniqueConstraints": {},
891
+ "checkConstraints": {
892
+ "dismissed_keys_key_check": {
893
+ "name": "dismissed_keys_key_check",
894
+ "value": "length(\"dismissed_keys\".\"key\") BETWEEN 1 AND 128 AND \"dismissed_keys\".\"key\" GLOB '[A-Za-z_]*' AND \"dismissed_keys\".\"key\" NOT GLOB '*[^A-Za-z0-9_]*'"
895
+ }
896
+ }
897
+ },
898
+ "environments": {
899
+ "name": "environments",
900
+ "columns": {
901
+ "id": {
902
+ "name": "id",
903
+ "type": "text",
904
+ "primaryKey": true,
905
+ "notNull": true,
906
+ "autoincrement": false
907
+ },
908
+ "project_id": {
909
+ "name": "project_id",
910
+ "type": "text",
911
+ "primaryKey": false,
912
+ "notNull": true,
913
+ "autoincrement": false
914
+ },
915
+ "slug": {
916
+ "name": "slug",
917
+ "type": "text",
918
+ "primaryKey": false,
919
+ "notNull": true,
920
+ "autoincrement": false
921
+ },
922
+ "name": {
923
+ "name": "name",
924
+ "type": "text",
925
+ "primaryKey": false,
926
+ "notNull": true,
927
+ "autoincrement": false
928
+ },
929
+ "created_at": {
930
+ "name": "created_at",
931
+ "type": "integer",
932
+ "primaryKey": false,
933
+ "notNull": true,
934
+ "autoincrement": false,
935
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
936
+ },
937
+ "archived_at": {
938
+ "name": "archived_at",
939
+ "type": "integer",
940
+ "primaryKey": false,
941
+ "notNull": false,
942
+ "autoincrement": false
943
+ },
944
+ "parent_id": {
945
+ "name": "parent_id",
946
+ "type": "text",
947
+ "primaryKey": false,
948
+ "notNull": false,
949
+ "autoincrement": false
950
+ }
951
+ },
952
+ "indexes": {
953
+ "environments_parent_idx": {
954
+ "name": "environments_parent_idx",
955
+ "columns": [
956
+ "parent_id"
957
+ ],
958
+ "isUnique": false
959
+ },
960
+ "environments_project_id_slug_key": {
961
+ "name": "environments_project_id_slug_key",
962
+ "columns": [
963
+ "project_id",
964
+ "slug"
965
+ ],
966
+ "isUnique": true
967
+ },
968
+ "environments_project_scoped": {
969
+ "name": "environments_project_scoped",
970
+ "columns": [
971
+ "id",
972
+ "project_id"
973
+ ],
974
+ "isUnique": true
975
+ }
976
+ },
977
+ "foreignKeys": {
978
+ "environments_project_id_fkey": {
979
+ "name": "environments_project_id_fkey",
980
+ "tableFrom": "environments",
981
+ "tableTo": "projects",
982
+ "columnsFrom": [
983
+ "project_id"
984
+ ],
985
+ "columnsTo": [
986
+ "id"
987
+ ],
988
+ "onDelete": "restrict",
989
+ "onUpdate": "no action"
990
+ },
991
+ "environments_parent_in_project": {
992
+ "name": "environments_parent_in_project",
993
+ "tableFrom": "environments",
994
+ "tableTo": "environments",
995
+ "columnsFrom": [
996
+ "parent_id",
997
+ "project_id"
998
+ ],
999
+ "columnsTo": [
1000
+ "id",
1001
+ "project_id"
1002
+ ],
1003
+ "onDelete": "no action",
1004
+ "onUpdate": "no action"
1005
+ }
1006
+ },
1007
+ "compositePrimaryKeys": {},
1008
+ "uniqueConstraints": {},
1009
+ "checkConstraints": {
1010
+ "environments_slug_check": {
1011
+ "name": "environments_slug_check",
1012
+ "value": "(length(\"environments\".\"slug\") BETWEEN 1 AND 63 AND \"environments\".\"slug\" GLOB '[a-z0-9]*' AND \"environments\".\"slug\" NOT GLOB '*[^a-z0-9-]*') OR (instr(\"environments\".\"slug\", '~') BETWEEN 2 AND 64 AND substr(\"environments\".\"slug\", 1, instr(\"environments\".\"slug\", '~') - 1) GLOB '[a-z0-9]*' AND substr(\"environments\".\"slug\", 1, instr(\"environments\".\"slug\", '~') - 1) NOT GLOB '*[^a-z0-9-]*' AND length(substr(\"environments\".\"slug\", instr(\"environments\".\"slug\", '~') + 1)) BETWEEN 1 AND 40 AND substr(\"environments\".\"slug\", instr(\"environments\".\"slug\", '~') + 1) NOT GLOB '*[^a-z0-9-]*')"
1013
+ },
1014
+ "environments_parent_check": {
1015
+ "name": "environments_parent_check",
1016
+ "value": "\"environments\".\"parent_id\" IS NULL OR \"environments\".\"parent_id\" <> \"environments\".\"id\""
1017
+ }
1018
+ }
1019
+ },
1020
+ "identities": {
1021
+ "name": "identities",
1022
+ "columns": {
1023
+ "id": {
1024
+ "name": "id",
1025
+ "type": "text",
1026
+ "primaryKey": true,
1027
+ "notNull": true,
1028
+ "autoincrement": false
1029
+ },
1030
+ "provider": {
1031
+ "name": "provider",
1032
+ "type": "text",
1033
+ "primaryKey": false,
1034
+ "notNull": true,
1035
+ "autoincrement": false
1036
+ },
1037
+ "auth_mac": {
1038
+ "name": "auth_mac",
1039
+ "type": "blob",
1040
+ "primaryKey": false,
1041
+ "notNull": true,
1042
+ "autoincrement": false
1043
+ },
1044
+ "subject": {
1045
+ "name": "subject",
1046
+ "type": "text",
1047
+ "primaryKey": false,
1048
+ "notNull": true,
1049
+ "autoincrement": false
1050
+ },
1051
+ "issuer_hash": {
1052
+ "name": "issuer_hash",
1053
+ "type": "text",
1054
+ "primaryKey": false,
1055
+ "notNull": true,
1056
+ "autoincrement": false
1057
+ },
1058
+ "generation": {
1059
+ "name": "generation",
1060
+ "type": "integer",
1061
+ "primaryKey": false,
1062
+ "notNull": true,
1063
+ "autoincrement": false
1064
+ },
1065
+ "principal": {
1066
+ "name": "principal",
1067
+ "type": "text",
1068
+ "primaryKey": false,
1069
+ "notNull": true,
1070
+ "autoincrement": false
1071
+ },
1072
+ "email": {
1073
+ "name": "email",
1074
+ "type": "text",
1075
+ "primaryKey": false,
1076
+ "notNull": false,
1077
+ "autoincrement": false
1078
+ },
1079
+ "created_at": {
1080
+ "name": "created_at",
1081
+ "type": "integer",
1082
+ "primaryKey": false,
1083
+ "notNull": true,
1084
+ "autoincrement": false,
1085
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1086
+ },
1087
+ "created_by": {
1088
+ "name": "created_by",
1089
+ "type": "text",
1090
+ "primaryKey": false,
1091
+ "notNull": true,
1092
+ "autoincrement": false
1093
+ },
1094
+ "last_sign_in_at": {
1095
+ "name": "last_sign_in_at",
1096
+ "type": "integer",
1097
+ "primaryKey": false,
1098
+ "notNull": false,
1099
+ "autoincrement": false
1100
+ },
1101
+ "revoked_at": {
1102
+ "name": "revoked_at",
1103
+ "type": "integer",
1104
+ "primaryKey": false,
1105
+ "notNull": false,
1106
+ "autoincrement": false
1107
+ },
1108
+ "revoked_by": {
1109
+ "name": "revoked_by",
1110
+ "type": "text",
1111
+ "primaryKey": false,
1112
+ "notNull": false,
1113
+ "autoincrement": false
1114
+ },
1115
+ "active_subject": {
1116
+ "name": "active_subject",
1117
+ "type": "text",
1118
+ "primaryKey": false,
1119
+ "notNull": false,
1120
+ "autoincrement": false,
1121
+ "generated": {
1122
+ "as": "(CASE WHEN revoked_at IS NULL THEN subject END)",
1123
+ "type": "stored"
1124
+ }
1125
+ }
1126
+ },
1127
+ "indexes": {
1128
+ "identities_active_subject": {
1129
+ "name": "identities_active_subject",
1130
+ "columns": [
1131
+ "provider",
1132
+ "issuer_hash",
1133
+ "active_subject"
1134
+ ],
1135
+ "isUnique": true
1136
+ },
1137
+ "identities_principal_idx": {
1138
+ "name": "identities_principal_idx",
1139
+ "columns": [
1140
+ "principal",
1141
+ "generation"
1142
+ ],
1143
+ "isUnique": false
1144
+ },
1145
+ "identities_member_generation_key": {
1146
+ "name": "identities_member_generation_key",
1147
+ "columns": [
1148
+ "id",
1149
+ "principal",
1150
+ "generation"
1151
+ ],
1152
+ "isUnique": true
1153
+ }
1154
+ },
1155
+ "foreignKeys": {
1156
+ "identities_principal_fkey": {
1157
+ "name": "identities_principal_fkey",
1158
+ "tableFrom": "identities",
1159
+ "tableTo": "vault_members",
1160
+ "columnsFrom": [
1161
+ "principal"
1162
+ ],
1163
+ "columnsTo": [
1164
+ "principal"
1165
+ ],
1166
+ "onDelete": "restrict",
1167
+ "onUpdate": "no action"
1168
+ }
1169
+ },
1170
+ "compositePrimaryKeys": {},
1171
+ "uniqueConstraints": {},
1172
+ "checkConstraints": {
1173
+ "identities_principal_check": {
1174
+ "name": "identities_principal_check",
1175
+ "value": "\"identities\".\"principal\" LIKE 'user:%'"
1176
+ },
1177
+ "identities_provider_check": {
1178
+ "name": "identities_provider_check",
1179
+ "value": "length(\"identities\".\"provider\") BETWEEN 1 AND 32 AND \"identities\".\"provider\" GLOB '[a-z0-9]*' AND \"identities\".\"provider\" NOT GLOB '*[^a-z0-9-]*'"
1180
+ },
1181
+ "identities_auth_mac_check": {
1182
+ "name": "identities_auth_mac_check",
1183
+ "value": "octet_length(\"identities\".\"auth_mac\") = 32"
1184
+ }
1185
+ }
1186
+ },
1187
+ "mcp_approvals": {
1188
+ "name": "mcp_approvals",
1189
+ "columns": {
1190
+ "id": {
1191
+ "name": "id",
1192
+ "type": "text",
1193
+ "primaryKey": true,
1194
+ "notNull": true,
1195
+ "autoincrement": false
1196
+ },
1197
+ "connection_id": {
1198
+ "name": "connection_id",
1199
+ "type": "text",
1200
+ "primaryKey": false,
1201
+ "notNull": true,
1202
+ "autoincrement": false
1203
+ },
1204
+ "tool": {
1205
+ "name": "tool",
1206
+ "type": "text",
1207
+ "primaryKey": false,
1208
+ "notNull": true,
1209
+ "autoincrement": false
1210
+ },
1211
+ "arguments": {
1212
+ "name": "arguments",
1213
+ "type": "text",
1214
+ "primaryKey": false,
1215
+ "notNull": true,
1216
+ "autoincrement": false
1217
+ },
1218
+ "digest": {
1219
+ "name": "digest",
1220
+ "type": "blob",
1221
+ "primaryKey": false,
1222
+ "notNull": true,
1223
+ "autoincrement": false
1224
+ },
1225
+ "status": {
1226
+ "name": "status",
1227
+ "type": "text",
1228
+ "primaryKey": false,
1229
+ "notNull": true,
1230
+ "autoincrement": false,
1231
+ "default": "'pending'"
1232
+ },
1233
+ "outcome": {
1234
+ "name": "outcome",
1235
+ "type": "text",
1236
+ "primaryKey": false,
1237
+ "notNull": false,
1238
+ "autoincrement": false
1239
+ },
1240
+ "created_at": {
1241
+ "name": "created_at",
1242
+ "type": "integer",
1243
+ "primaryKey": false,
1244
+ "notNull": true,
1245
+ "autoincrement": false,
1246
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1247
+ },
1248
+ "expires_at": {
1249
+ "name": "expires_at",
1250
+ "type": "integer",
1251
+ "primaryKey": false,
1252
+ "notNull": true,
1253
+ "autoincrement": false
1254
+ },
1255
+ "decided_at": {
1256
+ "name": "decided_at",
1257
+ "type": "integer",
1258
+ "primaryKey": false,
1259
+ "notNull": false,
1260
+ "autoincrement": false
1261
+ },
1262
+ "reported_at": {
1263
+ "name": "reported_at",
1264
+ "type": "integer",
1265
+ "primaryKey": false,
1266
+ "notNull": false,
1267
+ "autoincrement": false
1268
+ }
1269
+ },
1270
+ "indexes": {
1271
+ "mcp_approvals_open_idx": {
1272
+ "name": "mcp_approvals_open_idx",
1273
+ "columns": [
1274
+ "connection_id",
1275
+ "digest"
1276
+ ],
1277
+ "isUnique": false,
1278
+ "where": "\"mcp_approvals\".\"reported_at\" IS NULL"
1279
+ }
1280
+ },
1281
+ "foreignKeys": {
1282
+ "mcp_approvals_connection_fkey": {
1283
+ "name": "mcp_approvals_connection_fkey",
1284
+ "tableFrom": "mcp_approvals",
1285
+ "tableTo": "mcp_connections",
1286
+ "columnsFrom": [
1287
+ "connection_id"
1288
+ ],
1289
+ "columnsTo": [
1290
+ "id"
1291
+ ],
1292
+ "onDelete": "restrict",
1293
+ "onUpdate": "no action"
1294
+ }
1295
+ },
1296
+ "compositePrimaryKeys": {},
1297
+ "uniqueConstraints": {},
1298
+ "checkConstraints": {
1299
+ "mcp_approvals_status_check": {
1300
+ "name": "mcp_approvals_status_check",
1301
+ "value": "\"mcp_approvals\".\"status\" IN ('pending', 'approved', 'denied', 'cancelled', 'failed')"
1302
+ },
1303
+ "mcp_approvals_digest_check": {
1304
+ "name": "mcp_approvals_digest_check",
1305
+ "value": "octet_length(\"mcp_approvals\".\"digest\") = 32"
1306
+ },
1307
+ "mcp_approvals_arguments_check": {
1308
+ "name": "mcp_approvals_arguments_check",
1309
+ "value": "json_valid(\"mcp_approvals\".\"arguments\")"
1310
+ }
1311
+ }
1312
+ },
1313
+ "mcp_connections": {
1314
+ "name": "mcp_connections",
1315
+ "columns": {
1316
+ "id": {
1317
+ "name": "id",
1318
+ "type": "text",
1319
+ "primaryKey": true,
1320
+ "notNull": true,
1321
+ "autoincrement": false
1322
+ },
1323
+ "auth_mac": {
1324
+ "name": "auth_mac",
1325
+ "type": "blob",
1326
+ "primaryKey": false,
1327
+ "notNull": true,
1328
+ "autoincrement": false
1329
+ },
1330
+ "principal": {
1331
+ "name": "principal",
1332
+ "type": "text",
1333
+ "primaryKey": false,
1334
+ "notNull": true,
1335
+ "autoincrement": false
1336
+ },
1337
+ "generation": {
1338
+ "name": "generation",
1339
+ "type": "integer",
1340
+ "primaryKey": false,
1341
+ "notNull": true,
1342
+ "autoincrement": false
1343
+ },
1344
+ "client_id": {
1345
+ "name": "client_id",
1346
+ "type": "text",
1347
+ "primaryKey": false,
1348
+ "notNull": true,
1349
+ "autoincrement": false
1350
+ },
1351
+ "client_name": {
1352
+ "name": "client_name",
1353
+ "type": "text",
1354
+ "primaryKey": false,
1355
+ "notNull": true,
1356
+ "autoincrement": false
1357
+ },
1358
+ "client_host": {
1359
+ "name": "client_host",
1360
+ "type": "text",
1361
+ "primaryKey": false,
1362
+ "notNull": false,
1363
+ "autoincrement": false
1364
+ },
1365
+ "registration": {
1366
+ "name": "registration",
1367
+ "type": "text",
1368
+ "primaryKey": false,
1369
+ "notNull": true,
1370
+ "autoincrement": false
1371
+ },
1372
+ "scopes": {
1373
+ "name": "scopes",
1374
+ "type": "text",
1375
+ "primaryKey": false,
1376
+ "notNull": true,
1377
+ "autoincrement": false
1378
+ },
1379
+ "redirect_uri": {
1380
+ "name": "redirect_uri",
1381
+ "type": "text",
1382
+ "primaryKey": false,
1383
+ "notNull": true,
1384
+ "autoincrement": false
1385
+ },
1386
+ "code_hash": {
1387
+ "name": "code_hash",
1388
+ "type": "blob",
1389
+ "primaryKey": false,
1390
+ "notNull": false,
1391
+ "autoincrement": false
1392
+ },
1393
+ "code_challenge": {
1394
+ "name": "code_challenge",
1395
+ "type": "text",
1396
+ "primaryKey": false,
1397
+ "notNull": false,
1398
+ "autoincrement": false
1399
+ },
1400
+ "code_expires_at": {
1401
+ "name": "code_expires_at",
1402
+ "type": "integer",
1403
+ "primaryKey": false,
1404
+ "notNull": false,
1405
+ "autoincrement": false
1406
+ },
1407
+ "refresh_hash": {
1408
+ "name": "refresh_hash",
1409
+ "type": "blob",
1410
+ "primaryKey": false,
1411
+ "notNull": false,
1412
+ "autoincrement": false
1413
+ },
1414
+ "refresh_previous_hash": {
1415
+ "name": "refresh_previous_hash",
1416
+ "type": "blob",
1417
+ "primaryKey": false,
1418
+ "notNull": false,
1419
+ "autoincrement": false
1420
+ },
1421
+ "expires_at": {
1422
+ "name": "expires_at",
1423
+ "type": "integer",
1424
+ "primaryKey": false,
1425
+ "notNull": true,
1426
+ "autoincrement": false
1427
+ },
1428
+ "created_at": {
1429
+ "name": "created_at",
1430
+ "type": "integer",
1431
+ "primaryKey": false,
1432
+ "notNull": true,
1433
+ "autoincrement": false,
1434
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1435
+ },
1436
+ "last_used_at": {
1437
+ "name": "last_used_at",
1438
+ "type": "integer",
1439
+ "primaryKey": false,
1440
+ "notNull": false,
1441
+ "autoincrement": false
1442
+ },
1443
+ "last_used_ip": {
1444
+ "name": "last_used_ip",
1445
+ "type": "text",
1446
+ "primaryKey": false,
1447
+ "notNull": false,
1448
+ "autoincrement": false
1449
+ },
1450
+ "revoked_at": {
1451
+ "name": "revoked_at",
1452
+ "type": "integer",
1453
+ "primaryKey": false,
1454
+ "notNull": false,
1455
+ "autoincrement": false
1456
+ },
1457
+ "revoked_by": {
1458
+ "name": "revoked_by",
1459
+ "type": "text",
1460
+ "primaryKey": false,
1461
+ "notNull": false,
1462
+ "autoincrement": false
1463
+ }
1464
+ },
1465
+ "indexes": {
1466
+ "mcp_connections_refresh_previous_idx": {
1467
+ "name": "mcp_connections_refresh_previous_idx",
1468
+ "columns": [
1469
+ "refresh_previous_hash"
1470
+ ],
1471
+ "isUnique": false
1472
+ },
1473
+ "mcp_connections_live_idx": {
1474
+ "name": "mcp_connections_live_idx",
1475
+ "columns": [
1476
+ "principal",
1477
+ "expires_at"
1478
+ ],
1479
+ "isUnique": false,
1480
+ "where": "\"mcp_connections\".\"revoked_at\" IS NULL"
1481
+ },
1482
+ "mcp_connections_code_hash_key": {
1483
+ "name": "mcp_connections_code_hash_key",
1484
+ "columns": [
1485
+ "code_hash"
1486
+ ],
1487
+ "isUnique": true
1488
+ },
1489
+ "mcp_connections_refresh_hash_key": {
1490
+ "name": "mcp_connections_refresh_hash_key",
1491
+ "columns": [
1492
+ "refresh_hash"
1493
+ ],
1494
+ "isUnique": true
1495
+ }
1496
+ },
1497
+ "foreignKeys": {
1498
+ "mcp_connections_principal_fkey": {
1499
+ "name": "mcp_connections_principal_fkey",
1500
+ "tableFrom": "mcp_connections",
1501
+ "tableTo": "vault_members",
1502
+ "columnsFrom": [
1503
+ "principal"
1504
+ ],
1505
+ "columnsTo": [
1506
+ "principal"
1507
+ ],
1508
+ "onDelete": "restrict",
1509
+ "onUpdate": "no action"
1510
+ }
1511
+ },
1512
+ "compositePrimaryKeys": {},
1513
+ "uniqueConstraints": {},
1514
+ "checkConstraints": {
1515
+ "mcp_connections_principal_check": {
1516
+ "name": "mcp_connections_principal_check",
1517
+ "value": "\"mcp_connections\".\"principal\" LIKE 'user:%'"
1518
+ },
1519
+ "mcp_connections_registration_check": {
1520
+ "name": "mcp_connections_registration_check",
1521
+ "value": "\"mcp_connections\".\"registration\" IN ('cimd', 'dcr')"
1522
+ },
1523
+ "mcp_connections_auth_mac_check": {
1524
+ "name": "mcp_connections_auth_mac_check",
1525
+ "value": "octet_length(\"mcp_connections\".\"auth_mac\") = 32"
1526
+ },
1527
+ "mcp_connections_code_hash_check": {
1528
+ "name": "mcp_connections_code_hash_check",
1529
+ "value": "\"mcp_connections\".\"code_hash\" IS NULL OR octet_length(\"mcp_connections\".\"code_hash\") = 32"
1530
+ },
1531
+ "mcp_connections_refresh_hash_check": {
1532
+ "name": "mcp_connections_refresh_hash_check",
1533
+ "value": "\"mcp_connections\".\"refresh_hash\" IS NULL OR octet_length(\"mcp_connections\".\"refresh_hash\") = 32"
1534
+ }
1535
+ }
1536
+ },
1537
+ "oauth_clients": {
1538
+ "name": "oauth_clients",
1539
+ "columns": {
1540
+ "id": {
1541
+ "name": "id",
1542
+ "type": "text",
1543
+ "primaryKey": true,
1544
+ "notNull": true,
1545
+ "autoincrement": false
1546
+ },
1547
+ "auth_mac": {
1548
+ "name": "auth_mac",
1549
+ "type": "blob",
1550
+ "primaryKey": false,
1551
+ "notNull": true,
1552
+ "autoincrement": false
1553
+ },
1554
+ "name": {
1555
+ "name": "name",
1556
+ "type": "text",
1557
+ "primaryKey": false,
1558
+ "notNull": true,
1559
+ "autoincrement": false
1560
+ },
1561
+ "redirect_uris": {
1562
+ "name": "redirect_uris",
1563
+ "type": "text",
1564
+ "primaryKey": false,
1565
+ "notNull": true,
1566
+ "autoincrement": false
1567
+ },
1568
+ "created_at": {
1569
+ "name": "created_at",
1570
+ "type": "integer",
1571
+ "primaryKey": false,
1572
+ "notNull": true,
1573
+ "autoincrement": false,
1574
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1575
+ },
1576
+ "created_ip": {
1577
+ "name": "created_ip",
1578
+ "type": "text",
1579
+ "primaryKey": false,
1580
+ "notNull": false,
1581
+ "autoincrement": false
1582
+ },
1583
+ "revoked_at": {
1584
+ "name": "revoked_at",
1585
+ "type": "integer",
1586
+ "primaryKey": false,
1587
+ "notNull": false,
1588
+ "autoincrement": false
1589
+ }
1590
+ },
1591
+ "indexes": {},
1592
+ "foreignKeys": {},
1593
+ "compositePrimaryKeys": {},
1594
+ "uniqueConstraints": {},
1595
+ "checkConstraints": {
1596
+ "oauth_clients_auth_mac_check": {
1597
+ "name": "oauth_clients_auth_mac_check",
1598
+ "value": "octet_length(\"oauth_clients\".\"auth_mac\") = 32"
1599
+ },
1600
+ "oauth_clients_redirect_uris_check": {
1601
+ "name": "oauth_clients_redirect_uris_check",
1602
+ "value": "json_valid(\"oauth_clients\".\"redirect_uris\")"
1603
+ }
1604
+ }
1605
+ },
1606
+ "projects": {
1607
+ "name": "projects",
1608
+ "columns": {
1609
+ "id": {
1610
+ "name": "id",
1611
+ "type": "text",
1612
+ "primaryKey": true,
1613
+ "notNull": true,
1614
+ "autoincrement": false
1615
+ },
1616
+ "slug": {
1617
+ "name": "slug",
1618
+ "type": "text",
1619
+ "primaryKey": false,
1620
+ "notNull": true,
1621
+ "autoincrement": false
1622
+ },
1623
+ "name": {
1624
+ "name": "name",
1625
+ "type": "text",
1626
+ "primaryKey": false,
1627
+ "notNull": true,
1628
+ "autoincrement": false
1629
+ },
1630
+ "created_at": {
1631
+ "name": "created_at",
1632
+ "type": "integer",
1633
+ "primaryKey": false,
1634
+ "notNull": true,
1635
+ "autoincrement": false,
1636
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1637
+ },
1638
+ "archived_at": {
1639
+ "name": "archived_at",
1640
+ "type": "integer",
1641
+ "primaryKey": false,
1642
+ "notNull": false,
1643
+ "autoincrement": false
1644
+ },
1645
+ "folder": {
1646
+ "name": "folder",
1647
+ "type": "text",
1648
+ "primaryKey": false,
1649
+ "notNull": false,
1650
+ "autoincrement": false
1651
+ }
1652
+ },
1653
+ "indexes": {
1654
+ "projects_slug_key": {
1655
+ "name": "projects_slug_key",
1656
+ "columns": [
1657
+ "slug"
1658
+ ],
1659
+ "isUnique": true
1660
+ }
1661
+ },
1662
+ "foreignKeys": {},
1663
+ "compositePrimaryKeys": {},
1664
+ "uniqueConstraints": {},
1665
+ "checkConstraints": {
1666
+ "projects_slug_check": {
1667
+ "name": "projects_slug_check",
1668
+ "value": "(length(\"projects\".\"slug\") BETWEEN 1 AND 63 AND \"projects\".\"slug\" GLOB '[a-z0-9]*' AND \"projects\".\"slug\" NOT GLOB '*[^a-z0-9-]*') OR (instr(\"projects\".\"slug\", '~') BETWEEN 2 AND 64 AND substr(\"projects\".\"slug\", 1, instr(\"projects\".\"slug\", '~') - 1) GLOB '[a-z0-9]*' AND substr(\"projects\".\"slug\", 1, instr(\"projects\".\"slug\", '~') - 1) NOT GLOB '*[^a-z0-9-]*' AND length(substr(\"projects\".\"slug\", instr(\"projects\".\"slug\", '~') + 1)) BETWEEN 1 AND 40 AND substr(\"projects\".\"slug\", instr(\"projects\".\"slug\", '~') + 1) NOT GLOB '*[^a-z0-9-]*')"
1669
+ },
1670
+ "projects_folder_check": {
1671
+ "name": "projects_folder_check",
1672
+ "value": "\"projects\".\"folder\" IS NULL OR (length(\"projects\".\"folder\") BETWEEN 1 AND 64 AND \"projects\".\"folder\" NOT GLOB '*/*' AND \"projects\".\"folder\" = trim(\"projects\".\"folder\"))"
1673
+ }
1674
+ }
1675
+ },
1676
+ "secret_references": {
1677
+ "name": "secret_references",
1678
+ "columns": {
1679
+ "id": {
1680
+ "name": "id",
1681
+ "type": "text",
1682
+ "primaryKey": true,
1683
+ "notNull": true,
1684
+ "autoincrement": false
1685
+ },
1686
+ "project_id": {
1687
+ "name": "project_id",
1688
+ "type": "text",
1689
+ "primaryKey": false,
1690
+ "notNull": true,
1691
+ "autoincrement": false
1692
+ },
1693
+ "environment_id": {
1694
+ "name": "environment_id",
1695
+ "type": "text",
1696
+ "primaryKey": false,
1697
+ "notNull": true,
1698
+ "autoincrement": false
1699
+ },
1700
+ "secret_id": {
1701
+ "name": "secret_id",
1702
+ "type": "text",
1703
+ "primaryKey": false,
1704
+ "notNull": true,
1705
+ "autoincrement": false
1706
+ },
1707
+ "source_project_id": {
1708
+ "name": "source_project_id",
1709
+ "type": "text",
1710
+ "primaryKey": false,
1711
+ "notNull": true,
1712
+ "autoincrement": false
1713
+ },
1714
+ "source_environment_id": {
1715
+ "name": "source_environment_id",
1716
+ "type": "text",
1717
+ "primaryKey": false,
1718
+ "notNull": true,
1719
+ "autoincrement": false
1720
+ },
1721
+ "source_secret_id": {
1722
+ "name": "source_secret_id",
1723
+ "type": "text",
1724
+ "primaryKey": false,
1725
+ "notNull": true,
1726
+ "autoincrement": false
1727
+ },
1728
+ "created_seq": {
1729
+ "name": "created_seq",
1730
+ "type": "integer",
1731
+ "primaryKey": false,
1732
+ "notNull": true,
1733
+ "autoincrement": false
1734
+ },
1735
+ "created_at": {
1736
+ "name": "created_at",
1737
+ "type": "integer",
1738
+ "primaryKey": false,
1739
+ "notNull": true,
1740
+ "autoincrement": false,
1741
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1742
+ },
1743
+ "created_by": {
1744
+ "name": "created_by",
1745
+ "type": "text",
1746
+ "primaryKey": false,
1747
+ "notNull": true,
1748
+ "autoincrement": false
1749
+ }
1750
+ },
1751
+ "indexes": {
1752
+ "secret_references_holder_idx": {
1753
+ "name": "secret_references_holder_idx",
1754
+ "columns": [
1755
+ "secret_id",
1756
+ "created_seq"
1757
+ ],
1758
+ "isUnique": false
1759
+ },
1760
+ "secret_references_source_idx": {
1761
+ "name": "secret_references_source_idx",
1762
+ "columns": [
1763
+ "source_secret_id"
1764
+ ],
1765
+ "isUnique": false
1766
+ },
1767
+ "secret_references_project_idx": {
1768
+ "name": "secret_references_project_idx",
1769
+ "columns": [
1770
+ "project_id"
1771
+ ],
1772
+ "isUnique": false
1773
+ },
1774
+ "secret_references_source_project_idx": {
1775
+ "name": "secret_references_source_project_idx",
1776
+ "columns": [
1777
+ "source_project_id"
1778
+ ],
1779
+ "isUnique": false
1780
+ },
1781
+ "secret_references_created_by_idx": {
1782
+ "name": "secret_references_created_by_idx",
1783
+ "columns": [
1784
+ "created_by"
1785
+ ],
1786
+ "isUnique": false
1787
+ },
1788
+ "secret_references_created_seq_key": {
1789
+ "name": "secret_references_created_seq_key",
1790
+ "columns": [
1791
+ "created_seq"
1792
+ ],
1793
+ "isUnique": true
1794
+ }
1795
+ },
1796
+ "foreignKeys": {
1797
+ "secret_references_secret_id_fkey": {
1798
+ "name": "secret_references_secret_id_fkey",
1799
+ "tableFrom": "secret_references",
1800
+ "tableTo": "secrets",
1801
+ "columnsFrom": [
1802
+ "secret_id"
1803
+ ],
1804
+ "columnsTo": [
1805
+ "id"
1806
+ ],
1807
+ "onDelete": "restrict",
1808
+ "onUpdate": "no action"
1809
+ },
1810
+ "secret_references_source_secret_id_fkey": {
1811
+ "name": "secret_references_source_secret_id_fkey",
1812
+ "tableFrom": "secret_references",
1813
+ "tableTo": "secrets",
1814
+ "columnsFrom": [
1815
+ "source_secret_id"
1816
+ ],
1817
+ "columnsTo": [
1818
+ "id"
1819
+ ],
1820
+ "onDelete": "restrict",
1821
+ "onUpdate": "no action"
1822
+ },
1823
+ "secret_references_created_seq_fkey": {
1824
+ "name": "secret_references_created_seq_fkey",
1825
+ "tableFrom": "secret_references",
1826
+ "tableTo": "audit_log",
1827
+ "columnsFrom": [
1828
+ "created_seq"
1829
+ ],
1830
+ "columnsTo": [
1831
+ "seq"
1832
+ ],
1833
+ "onDelete": "restrict",
1834
+ "onUpdate": "no action"
1835
+ }
1836
+ },
1837
+ "compositePrimaryKeys": {},
1838
+ "uniqueConstraints": {},
1839
+ "checkConstraints": {}
1840
+ },
1841
+ "secret_versions": {
1842
+ "name": "secret_versions",
1843
+ "columns": {
1844
+ "id": {
1845
+ "name": "id",
1846
+ "type": "text",
1847
+ "primaryKey": true,
1848
+ "notNull": true,
1849
+ "autoincrement": false
1850
+ },
1851
+ "secret_id": {
1852
+ "name": "secret_id",
1853
+ "type": "text",
1854
+ "primaryKey": false,
1855
+ "notNull": true,
1856
+ "autoincrement": false
1857
+ },
1858
+ "version": {
1859
+ "name": "version",
1860
+ "type": "integer",
1861
+ "primaryKey": false,
1862
+ "notNull": true,
1863
+ "autoincrement": false
1864
+ },
1865
+ "envelope_version": {
1866
+ "name": "envelope_version",
1867
+ "type": "integer",
1868
+ "primaryKey": false,
1869
+ "notNull": true,
1870
+ "autoincrement": false
1871
+ },
1872
+ "ciphertext": {
1873
+ "name": "ciphertext",
1874
+ "type": "blob",
1875
+ "primaryKey": false,
1876
+ "notNull": true,
1877
+ "autoincrement": false
1878
+ },
1879
+ "iv": {
1880
+ "name": "iv",
1881
+ "type": "blob",
1882
+ "primaryKey": false,
1883
+ "notNull": true,
1884
+ "autoincrement": false
1885
+ },
1886
+ "auth_tag": {
1887
+ "name": "auth_tag",
1888
+ "type": "blob",
1889
+ "primaryKey": false,
1890
+ "notNull": true,
1891
+ "autoincrement": false
1892
+ },
1893
+ "wrapped_dek": {
1894
+ "name": "wrapped_dek",
1895
+ "type": "blob",
1896
+ "primaryKey": false,
1897
+ "notNull": true,
1898
+ "autoincrement": false
1899
+ },
1900
+ "kek_provider": {
1901
+ "name": "kek_provider",
1902
+ "type": "text",
1903
+ "primaryKey": false,
1904
+ "notNull": true,
1905
+ "autoincrement": false
1906
+ },
1907
+ "kek_id": {
1908
+ "name": "kek_id",
1909
+ "type": "text",
1910
+ "primaryKey": false,
1911
+ "notNull": true,
1912
+ "autoincrement": false
1913
+ },
1914
+ "kek_version": {
1915
+ "name": "kek_version",
1916
+ "type": "text",
1917
+ "primaryKey": false,
1918
+ "notNull": true,
1919
+ "autoincrement": false
1920
+ },
1921
+ "created_at": {
1922
+ "name": "created_at",
1923
+ "type": "integer",
1924
+ "primaryKey": false,
1925
+ "notNull": true,
1926
+ "autoincrement": false,
1927
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1928
+ },
1929
+ "created_by": {
1930
+ "name": "created_by",
1931
+ "type": "text",
1932
+ "primaryKey": false,
1933
+ "notNull": true,
1934
+ "autoincrement": false
1935
+ }
1936
+ },
1937
+ "indexes": {
1938
+ "secret_versions_secret_idx": {
1939
+ "name": "secret_versions_secret_idx",
1940
+ "columns": [
1941
+ "secret_id",
1942
+ "version"
1943
+ ],
1944
+ "isUnique": false
1945
+ },
1946
+ "secret_versions_secret_id_version_key": {
1947
+ "name": "secret_versions_secret_id_version_key",
1948
+ "columns": [
1949
+ "secret_id",
1950
+ "version"
1951
+ ],
1952
+ "isUnique": true
1953
+ }
1954
+ },
1955
+ "foreignKeys": {
1956
+ "secret_versions_secret_id_fkey": {
1957
+ "name": "secret_versions_secret_id_fkey",
1958
+ "tableFrom": "secret_versions",
1959
+ "tableTo": "secrets",
1960
+ "columnsFrom": [
1961
+ "secret_id"
1962
+ ],
1963
+ "columnsTo": [
1964
+ "id"
1965
+ ],
1966
+ "onDelete": "restrict",
1967
+ "onUpdate": "no action"
1968
+ }
1969
+ },
1970
+ "compositePrimaryKeys": {},
1971
+ "uniqueConstraints": {},
1972
+ "checkConstraints": {
1973
+ "secret_versions_version_check": {
1974
+ "name": "secret_versions_version_check",
1975
+ "value": "\"secret_versions\".\"version\" > 0"
1976
+ },
1977
+ "secret_versions_iv_check": {
1978
+ "name": "secret_versions_iv_check",
1979
+ "value": "octet_length(\"secret_versions\".\"iv\") = 12"
1980
+ },
1981
+ "secret_versions_auth_tag_check": {
1982
+ "name": "secret_versions_auth_tag_check",
1983
+ "value": "octet_length(\"secret_versions\".\"auth_tag\") = 16"
1984
+ }
1985
+ }
1986
+ },
1987
+ "secrets": {
1988
+ "name": "secrets",
1989
+ "columns": {
1990
+ "id": {
1991
+ "name": "id",
1992
+ "type": "text",
1993
+ "primaryKey": true,
1994
+ "notNull": true,
1995
+ "autoincrement": false
1996
+ },
1997
+ "project_id": {
1998
+ "name": "project_id",
1999
+ "type": "text",
2000
+ "primaryKey": false,
2001
+ "notNull": true,
2002
+ "autoincrement": false
2003
+ },
2004
+ "environment_id": {
2005
+ "name": "environment_id",
2006
+ "type": "text",
2007
+ "primaryKey": false,
2008
+ "notNull": true,
2009
+ "autoincrement": false
2010
+ },
2011
+ "key": {
2012
+ "name": "key",
2013
+ "type": "text",
2014
+ "primaryKey": false,
2015
+ "notNull": true,
2016
+ "autoincrement": false
2017
+ },
2018
+ "created_at": {
2019
+ "name": "created_at",
2020
+ "type": "integer",
2021
+ "primaryKey": false,
2022
+ "notNull": true,
2023
+ "autoincrement": false,
2024
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
2025
+ },
2026
+ "updated_at": {
2027
+ "name": "updated_at",
2028
+ "type": "integer",
2029
+ "primaryKey": false,
2030
+ "notNull": true,
2031
+ "autoincrement": false,
2032
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
2033
+ },
2034
+ "current_version_id": {
2035
+ "name": "current_version_id",
2036
+ "type": "text",
2037
+ "primaryKey": false,
2038
+ "notNull": false,
2039
+ "autoincrement": false
2040
+ },
2041
+ "current_version": {
2042
+ "name": "current_version",
2043
+ "type": "integer",
2044
+ "primaryKey": false,
2045
+ "notNull": true,
2046
+ "autoincrement": false,
2047
+ "default": 0
2048
+ },
2049
+ "archived_at": {
2050
+ "name": "archived_at",
2051
+ "type": "integer",
2052
+ "primaryKey": false,
2053
+ "notNull": false,
2054
+ "autoincrement": false
2055
+ },
2056
+ "folder": {
2057
+ "name": "folder",
2058
+ "type": "text",
2059
+ "primaryKey": false,
2060
+ "notNull": false,
2061
+ "autoincrement": false
2062
+ }
2063
+ },
2064
+ "indexes": {
2065
+ "secrets_lookup_idx": {
2066
+ "name": "secrets_lookup_idx",
2067
+ "columns": [
2068
+ "project_id",
2069
+ "environment_id",
2070
+ "key"
2071
+ ],
2072
+ "isUnique": false
2073
+ },
2074
+ "secrets_project_id_environment_id_key_key": {
2075
+ "name": "secrets_project_id_environment_id_key_key",
2076
+ "columns": [
2077
+ "project_id",
2078
+ "environment_id",
2079
+ "key"
2080
+ ],
2081
+ "isUnique": true
2082
+ }
2083
+ },
2084
+ "foreignKeys": {
2085
+ "secrets_current_version_id_secret_versions_id_fk": {
2086
+ "name": "secrets_current_version_id_secret_versions_id_fk",
2087
+ "tableFrom": "secrets",
2088
+ "tableTo": "secret_versions",
2089
+ "columnsFrom": [
2090
+ "current_version_id"
2091
+ ],
2092
+ "columnsTo": [
2093
+ "id"
2094
+ ],
2095
+ "onDelete": "no action",
2096
+ "onUpdate": "no action"
2097
+ },
2098
+ "secrets_project_id_fkey": {
2099
+ "name": "secrets_project_id_fkey",
2100
+ "tableFrom": "secrets",
2101
+ "tableTo": "projects",
2102
+ "columnsFrom": [
2103
+ "project_id"
2104
+ ],
2105
+ "columnsTo": [
2106
+ "id"
2107
+ ],
2108
+ "onDelete": "restrict",
2109
+ "onUpdate": "no action"
2110
+ },
2111
+ "secrets_environment_id_fkey": {
2112
+ "name": "secrets_environment_id_fkey",
2113
+ "tableFrom": "secrets",
2114
+ "tableTo": "environments",
2115
+ "columnsFrom": [
2116
+ "environment_id"
2117
+ ],
2118
+ "columnsTo": [
2119
+ "id"
2120
+ ],
2121
+ "onDelete": "restrict",
2122
+ "onUpdate": "no action"
2123
+ },
2124
+ "secrets_environment_in_project": {
2125
+ "name": "secrets_environment_in_project",
2126
+ "tableFrom": "secrets",
2127
+ "tableTo": "environments",
2128
+ "columnsFrom": [
2129
+ "environment_id",
2130
+ "project_id"
2131
+ ],
2132
+ "columnsTo": [
2133
+ "id",
2134
+ "project_id"
2135
+ ],
2136
+ "onDelete": "no action",
2137
+ "onUpdate": "no action"
2138
+ }
2139
+ },
2140
+ "compositePrimaryKeys": {},
2141
+ "uniqueConstraints": {},
2142
+ "checkConstraints": {
2143
+ "secrets_key_check": {
2144
+ "name": "secrets_key_check",
2145
+ "value": "length(\"secrets\".\"key\") BETWEEN 1 AND 128 AND \"secrets\".\"key\" GLOB '[A-Za-z_]*' AND \"secrets\".\"key\" NOT GLOB '*[^A-Za-z0-9_]*'"
2146
+ },
2147
+ "secrets_folder_check": {
2148
+ "name": "secrets_folder_check",
2149
+ "value": "\"secrets\".\"folder\" IS NULL OR (length(\"secrets\".\"folder\") BETWEEN 1 AND 64 AND \"secrets\".\"folder\" NOT GLOB '*/*' AND \"secrets\".\"folder\" = trim(\"secrets\".\"folder\"))"
2150
+ }
2151
+ }
2152
+ },
2153
+ "service_bindings": {
2154
+ "name": "service_bindings",
2155
+ "columns": {
2156
+ "id": {
2157
+ "name": "id",
2158
+ "type": "text",
2159
+ "primaryKey": true,
2160
+ "notNull": true,
2161
+ "autoincrement": false
2162
+ },
2163
+ "auth_mac": {
2164
+ "name": "auth_mac",
2165
+ "type": "blob",
2166
+ "primaryKey": false,
2167
+ "notNull": true,
2168
+ "autoincrement": false
2169
+ },
2170
+ "principal": {
2171
+ "name": "principal",
2172
+ "type": "text",
2173
+ "primaryKey": false,
2174
+ "notNull": true,
2175
+ "autoincrement": false
2176
+ },
2177
+ "generation": {
2178
+ "name": "generation",
2179
+ "type": "integer",
2180
+ "primaryKey": false,
2181
+ "notNull": true,
2182
+ "autoincrement": false
2183
+ },
2184
+ "profile": {
2185
+ "name": "profile",
2186
+ "type": "text",
2187
+ "primaryKey": false,
2188
+ "notNull": true,
2189
+ "autoincrement": false
2190
+ },
2191
+ "issuer": {
2192
+ "name": "issuer",
2193
+ "type": "text",
2194
+ "primaryKey": false,
2195
+ "notNull": true,
2196
+ "autoincrement": false
2197
+ },
2198
+ "jwks_uri": {
2199
+ "name": "jwks_uri",
2200
+ "type": "text",
2201
+ "primaryKey": false,
2202
+ "notNull": true,
2203
+ "autoincrement": false
2204
+ },
2205
+ "claims": {
2206
+ "name": "claims",
2207
+ "type": "text",
2208
+ "primaryKey": false,
2209
+ "notNull": true,
2210
+ "autoincrement": false
2211
+ },
2212
+ "scope": {
2213
+ "name": "scope",
2214
+ "type": "text",
2215
+ "primaryKey": false,
2216
+ "notNull": false,
2217
+ "autoincrement": false
2218
+ },
2219
+ "label": {
2220
+ "name": "label",
2221
+ "type": "text",
2222
+ "primaryKey": false,
2223
+ "notNull": false,
2224
+ "autoincrement": false
2225
+ },
2226
+ "created_at": {
2227
+ "name": "created_at",
2228
+ "type": "integer",
2229
+ "primaryKey": false,
2230
+ "notNull": true,
2231
+ "autoincrement": false,
2232
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
2233
+ },
2234
+ "created_by": {
2235
+ "name": "created_by",
2236
+ "type": "text",
2237
+ "primaryKey": false,
2238
+ "notNull": true,
2239
+ "autoincrement": false
2240
+ },
2241
+ "last_used_at": {
2242
+ "name": "last_used_at",
2243
+ "type": "integer",
2244
+ "primaryKey": false,
2245
+ "notNull": false,
2246
+ "autoincrement": false
2247
+ },
2248
+ "revoked_at": {
2249
+ "name": "revoked_at",
2250
+ "type": "integer",
2251
+ "primaryKey": false,
2252
+ "notNull": false,
2253
+ "autoincrement": false
2254
+ },
2255
+ "revoked_by": {
2256
+ "name": "revoked_by",
2257
+ "type": "text",
2258
+ "primaryKey": false,
2259
+ "notNull": false,
2260
+ "autoincrement": false
2261
+ }
2262
+ },
2263
+ "indexes": {
2264
+ "service_bindings_principal_idx": {
2265
+ "name": "service_bindings_principal_idx",
2266
+ "columns": [
2267
+ "principal",
2268
+ "issuer"
2269
+ ],
2270
+ "isUnique": false
2271
+ },
2272
+ "service_bindings_live_idx": {
2273
+ "name": "service_bindings_live_idx",
2274
+ "columns": [
2275
+ "principal",
2276
+ "issuer",
2277
+ "generation",
2278
+ "created_at",
2279
+ "id"
2280
+ ],
2281
+ "isUnique": false,
2282
+ "where": "\"service_bindings\".\"revoked_at\" IS NULL"
2283
+ }
2284
+ },
2285
+ "foreignKeys": {
2286
+ "service_bindings_principal_fkey": {
2287
+ "name": "service_bindings_principal_fkey",
2288
+ "tableFrom": "service_bindings",
2289
+ "tableTo": "vault_members",
2290
+ "columnsFrom": [
2291
+ "principal"
2292
+ ],
2293
+ "columnsTo": [
2294
+ "principal"
2295
+ ],
2296
+ "onDelete": "restrict",
2297
+ "onUpdate": "no action"
2298
+ }
2299
+ },
2300
+ "compositePrimaryKeys": {},
2301
+ "uniqueConstraints": {},
2302
+ "checkConstraints": {
2303
+ "service_bindings_principal_check": {
2304
+ "name": "service_bindings_principal_check",
2305
+ "value": "\"service_bindings\".\"principal\" LIKE 'token:%'"
2306
+ },
2307
+ "service_bindings_auth_mac_check": {
2308
+ "name": "service_bindings_auth_mac_check",
2309
+ "value": "octet_length(\"service_bindings\".\"auth_mac\") = 32"
2310
+ },
2311
+ "service_bindings_claims_check": {
2312
+ "name": "service_bindings_claims_check",
2313
+ "value": "json_valid(\"service_bindings\".\"claims\")"
2314
+ }
2315
+ }
2316
+ },
2317
+ "vault_grants": {
2318
+ "name": "vault_grants",
2319
+ "columns": {
2320
+ "principal": {
2321
+ "name": "principal",
2322
+ "type": "text",
2323
+ "primaryKey": false,
2324
+ "notNull": true,
2325
+ "autoincrement": false
2326
+ },
2327
+ "project_id": {
2328
+ "name": "project_id",
2329
+ "type": "text",
2330
+ "primaryKey": false,
2331
+ "notNull": false,
2332
+ "autoincrement": false
2333
+ },
2334
+ "environment_id": {
2335
+ "name": "environment_id",
2336
+ "type": "text",
2337
+ "primaryKey": false,
2338
+ "notNull": false,
2339
+ "autoincrement": false
2340
+ },
2341
+ "environment_slug": {
2342
+ "name": "environment_slug",
2343
+ "type": "text",
2344
+ "primaryKey": false,
2345
+ "notNull": false,
2346
+ "autoincrement": false
2347
+ },
2348
+ "role": {
2349
+ "name": "role",
2350
+ "type": "text",
2351
+ "primaryKey": false,
2352
+ "notNull": true,
2353
+ "autoincrement": false
2354
+ },
2355
+ "expires_at": {
2356
+ "name": "expires_at",
2357
+ "type": "integer",
2358
+ "primaryKey": false,
2359
+ "notNull": false,
2360
+ "autoincrement": false
2361
+ },
2362
+ "granted_at": {
2363
+ "name": "granted_at",
2364
+ "type": "integer",
2365
+ "primaryKey": false,
2366
+ "notNull": true,
2367
+ "autoincrement": false
2368
+ },
2369
+ "granted_by": {
2370
+ "name": "granted_by",
2371
+ "type": "text",
2372
+ "primaryKey": false,
2373
+ "notNull": true,
2374
+ "autoincrement": false
2375
+ }
2376
+ },
2377
+ "indexes": {
2378
+ "vault_grants_on_every_project": {
2379
+ "name": "vault_grants_on_every_project",
2380
+ "columns": [
2381
+ "principal"
2382
+ ],
2383
+ "isUnique": true,
2384
+ "where": "\"vault_grants\".\"project_id\" IS NULL AND \"vault_grants\".\"environment_id\" IS NULL AND \"vault_grants\".\"environment_slug\" IS NULL"
2385
+ },
2386
+ "vault_grants_on_project": {
2387
+ "name": "vault_grants_on_project",
2388
+ "columns": [
2389
+ "principal",
2390
+ "project_id"
2391
+ ],
2392
+ "isUnique": true
2393
+ },
2394
+ "vault_grants_on_environment": {
2395
+ "name": "vault_grants_on_environment",
2396
+ "columns": [
2397
+ "principal",
2398
+ "environment_id"
2399
+ ],
2400
+ "isUnique": true
2401
+ },
2402
+ "vault_grants_on_environment_slug": {
2403
+ "name": "vault_grants_on_environment_slug",
2404
+ "columns": [
2405
+ "principal",
2406
+ "environment_slug"
2407
+ ],
2408
+ "isUnique": true
2409
+ }
2410
+ },
2411
+ "foreignKeys": {
2412
+ "vault_grants_principal_fkey": {
2413
+ "name": "vault_grants_principal_fkey",
2414
+ "tableFrom": "vault_grants",
2415
+ "tableTo": "vault_members",
2416
+ "columnsFrom": [
2417
+ "principal"
2418
+ ],
2419
+ "columnsTo": [
2420
+ "principal"
2421
+ ],
2422
+ "onDelete": "restrict",
2423
+ "onUpdate": "no action"
2424
+ },
2425
+ "vault_grants_project_id_fkey": {
2426
+ "name": "vault_grants_project_id_fkey",
2427
+ "tableFrom": "vault_grants",
2428
+ "tableTo": "projects",
2429
+ "columnsFrom": [
2430
+ "project_id"
2431
+ ],
2432
+ "columnsTo": [
2433
+ "id"
2434
+ ],
2435
+ "onDelete": "restrict",
2436
+ "onUpdate": "no action"
2437
+ },
2438
+ "vault_grants_environment_id_fkey": {
2439
+ "name": "vault_grants_environment_id_fkey",
2440
+ "tableFrom": "vault_grants",
2441
+ "tableTo": "environments",
2442
+ "columnsFrom": [
2443
+ "environment_id"
2444
+ ],
2445
+ "columnsTo": [
2446
+ "id"
2447
+ ],
2448
+ "onDelete": "restrict",
2449
+ "onUpdate": "no action"
2450
+ }
2451
+ },
2452
+ "compositePrimaryKeys": {},
2453
+ "uniqueConstraints": {},
2454
+ "checkConstraints": {
2455
+ "vault_grants_one_place": {
2456
+ "name": "vault_grants_one_place",
2457
+ "value": "((\"vault_grants\".\"project_id\" IS NULL) <> (\"vault_grants\".\"environment_id\" IS NULL) AND \"vault_grants\".\"environment_slug\" IS NULL) OR (\"vault_grants\".\"project_id\" IS NULL AND \"vault_grants\".\"environment_id\" IS NULL)"
2458
+ },
2459
+ "vault_grants_environment_slug_check": {
2460
+ "name": "vault_grants_environment_slug_check",
2461
+ "value": "\"vault_grants\".\"environment_slug\" IS NULL OR (length(\"vault_grants\".\"environment_slug\") BETWEEN 1 AND 63 AND \"vault_grants\".\"environment_slug\" GLOB '[a-z0-9]*' AND \"vault_grants\".\"environment_slug\" NOT GLOB '*[^a-z0-9-]*')"
2462
+ },
2463
+ "vault_grants_role_check": {
2464
+ "name": "vault_grants_role_check",
2465
+ "value": "\"vault_grants\".\"role\" IN ('viewer', 'developer', 'maintainer', 'access-manager', 'auditor', 'owner')"
2466
+ },
2467
+ "vault_grants_environment_role_check": {
2468
+ "name": "vault_grants_environment_role_check",
2469
+ "value": "(\"vault_grants\".\"environment_id\" IS NULL AND \"vault_grants\".\"environment_slug\" IS NULL) OR \"vault_grants\".\"role\" IN ('viewer', 'developer', 'auditor')"
2470
+ }
2471
+ }
2472
+ },
2473
+ "vault_members": {
2474
+ "name": "vault_members",
2475
+ "columns": {
2476
+ "principal": {
2477
+ "name": "principal",
2478
+ "type": "text",
2479
+ "primaryKey": true,
2480
+ "notNull": true,
2481
+ "autoincrement": false
2482
+ },
2483
+ "status": {
2484
+ "name": "status",
2485
+ "type": "text",
2486
+ "primaryKey": false,
2487
+ "notNull": true,
2488
+ "autoincrement": false
2489
+ },
2490
+ "owner": {
2491
+ "name": "owner",
2492
+ "type": "integer",
2493
+ "primaryKey": false,
2494
+ "notNull": true,
2495
+ "autoincrement": false,
2496
+ "default": false
2497
+ },
2498
+ "role": {
2499
+ "name": "role",
2500
+ "type": "text",
2501
+ "primaryKey": false,
2502
+ "notNull": false,
2503
+ "autoincrement": false
2504
+ },
2505
+ "scope": {
2506
+ "name": "scope",
2507
+ "type": "text",
2508
+ "primaryKey": false,
2509
+ "notNull": false,
2510
+ "autoincrement": false
2511
+ },
2512
+ "generation": {
2513
+ "name": "generation",
2514
+ "type": "integer",
2515
+ "primaryKey": false,
2516
+ "notNull": true,
2517
+ "autoincrement": false,
2518
+ "default": 0
2519
+ },
2520
+ "created_at": {
2521
+ "name": "created_at",
2522
+ "type": "integer",
2523
+ "primaryKey": false,
2524
+ "notNull": true,
2525
+ "autoincrement": false
2526
+ },
2527
+ "created_by": {
2528
+ "name": "created_by",
2529
+ "type": "text",
2530
+ "primaryKey": false,
2531
+ "notNull": true,
2532
+ "autoincrement": false
2533
+ },
2534
+ "status_changed_at": {
2535
+ "name": "status_changed_at",
2536
+ "type": "integer",
2537
+ "primaryKey": false,
2538
+ "notNull": true,
2539
+ "autoincrement": false
2540
+ },
2541
+ "status_changed_by": {
2542
+ "name": "status_changed_by",
2543
+ "type": "text",
2544
+ "primaryKey": false,
2545
+ "notNull": true,
2546
+ "autoincrement": false
2547
+ },
2548
+ "access_seq": {
2549
+ "name": "access_seq",
2550
+ "type": "integer",
2551
+ "primaryKey": false,
2552
+ "notNull": true,
2553
+ "autoincrement": false
2554
+ },
2555
+ "mac": {
2556
+ "name": "mac",
2557
+ "type": "blob",
2558
+ "primaryKey": false,
2559
+ "notNull": true,
2560
+ "autoincrement": false
2561
+ }
2562
+ },
2563
+ "indexes": {},
2564
+ "foreignKeys": {},
2565
+ "compositePrimaryKeys": {},
2566
+ "uniqueConstraints": {},
2567
+ "checkConstraints": {
2568
+ "vault_members_mac_check": {
2569
+ "name": "vault_members_mac_check",
2570
+ "value": "octet_length(\"vault_members\".\"mac\") = 32"
2571
+ },
2572
+ "vault_members_principal_check": {
2573
+ "name": "vault_members_principal_check",
2574
+ "value": "(\"vault_members\".\"principal\" GLOB 'user:?*' OR \"vault_members\".\"principal\" GLOB 'token:?*')\n AND substr(\"vault_members\".\"principal\", instr(\"vault_members\".\"principal\", ':') + 1, 1) <> ':'\n AND instr(\"vault_members\".\"principal\", ' ') = 0 AND instr(\"vault_members\".\"principal\", char(9)) = 0\n AND instr(\"vault_members\".\"principal\", char(10)) = 0 AND instr(\"vault_members\".\"principal\", char(13)) = 0"
2575
+ },
2576
+ "vault_members_user_lowercase": {
2577
+ "name": "vault_members_user_lowercase",
2578
+ "value": "\"vault_members\".\"principal\" NOT LIKE 'user:%' OR \"vault_members\".\"principal\" = lower(\"vault_members\".\"principal\")"
2579
+ },
2580
+ "vault_members_status_check": {
2581
+ "name": "vault_members_status_check",
2582
+ "value": "\"vault_members\".\"status\" IN ('active', 'removed')"
2583
+ },
2584
+ "vault_members_owner_check": {
2585
+ "name": "vault_members_owner_check",
2586
+ "value": "NOT \"vault_members\".\"owner\" OR (\"vault_members\".\"status\" = 'active' AND \"vault_members\".\"principal\" LIKE 'user:%')"
2587
+ },
2588
+ "vault_members_generation_check": {
2589
+ "name": "vault_members_generation_check",
2590
+ "value": "\"vault_members\".\"generation\" >= 0"
2591
+ }
2592
+ }
2593
+ }
2594
+ },
2595
+ "views": {},
2596
+ "enums": {},
2597
+ "_meta": {
2598
+ "schemas": {},
2599
+ "tables": {},
2600
+ "columns": {}
2601
+ },
2602
+ "internal": {
2603
+ "indexes": {
2604
+ "audit_log_unbind_idx": {
2605
+ "columns": {
2606
+ "json_extract(\"metadata\", '$.bindingId')": {
2607
+ "isExpression": true
2608
+ }
2609
+ }
2610
+ },
2611
+ "audit_log_exchange_idx": {
2612
+ "columns": {
2613
+ "json_extract(\"metadata\", '$.credentialId')": {
2614
+ "isExpression": true
2615
+ }
2616
+ }
2617
+ },
2618
+ "audit_log_also_project_idx": {
2619
+ "columns": {
2620
+ "json_extract(\"metadata\", '$.also.projectId')": {
2621
+ "isExpression": true
2622
+ }
2623
+ }
2624
+ },
2625
+ "audit_log_also_environment_idx": {
2626
+ "columns": {
2627
+ "json_extract(\"metadata\", '$.also.environmentId')": {
2628
+ "isExpression": true
2629
+ }
2630
+ }
2631
+ },
2632
+ "audit_log_also_secret_idx": {
2633
+ "columns": {
2634
+ "json_extract(\"metadata\", '$.also.secretId')": {
2635
+ "isExpression": true
2636
+ }
2637
+ }
2638
+ }
2639
+ }
2640
+ }
2641
+ }