@coffre/db 0.4.6 → 0.5.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 (42) hide show
  1. package/dist/connect.d.ts +1 -1
  2. package/dist/{database-edkMkG02.d.ts → database-C63WjCrC.d.ts} +1 -1
  3. package/dist/dialect.d.ts +1 -1
  4. package/dist/grants.d.ts +105 -10
  5. package/dist/grants.js +207 -7
  6. package/dist/hyperdrive.d.ts +1 -1
  7. package/dist/index.d.ts +2 -2
  8. package/dist/log.d.ts +392 -2
  9. package/dist/log.js +53 -1
  10. package/dist/migrations/postgres/0002_instance_roles.sql +4 -0
  11. package/dist/migrations/postgres/0003_credential_scopes.sql +4 -0
  12. package/dist/migrations/postgres/meta/0002_snapshot.json +2860 -0
  13. package/dist/migrations/postgres/meta/0003_snapshot.json +2872 -0
  14. package/dist/migrations/postgres/meta/_journal.json +14 -0
  15. package/dist/migrations/sqlite/0002_instance_roles.sql +2 -0
  16. package/dist/migrations/sqlite/0003_credential_scopes.sql +2 -0
  17. package/dist/migrations/sqlite/meta/0002_snapshot.json +2594 -0
  18. package/dist/migrations/sqlite/meta/0003_snapshot.json +2608 -0
  19. package/dist/migrations/sqlite/meta/_journal.json +14 -0
  20. package/dist/portable.d.ts +2 -2
  21. package/dist/{schema-BqCB3XFm.d.ts → schema-a7PkFgea.d.ts} +68 -0
  22. package/dist/schema-sqlite.d.ts +76 -0
  23. package/dist/schema-sqlite.js +4 -0
  24. package/dist/schema-version.d.ts +1 -1
  25. package/dist/schema-version.js +60 -26
  26. package/dist/schema.d.ts +1 -1
  27. package/dist/schema.js +4 -0
  28. package/package.json +2 -2
  29. package/src/grants.ts +272 -11
  30. package/src/log.ts +66 -2
  31. package/src/migrations/postgres/0002_instance_roles.sql +4 -0
  32. package/src/migrations/postgres/0003_credential_scopes.sql +4 -0
  33. package/src/migrations/postgres/meta/0002_snapshot.json +2860 -0
  34. package/src/migrations/postgres/meta/0003_snapshot.json +2872 -0
  35. package/src/migrations/postgres/meta/_journal.json +14 -0
  36. package/src/migrations/sqlite/0002_instance_roles.sql +2 -0
  37. package/src/migrations/sqlite/0003_credential_scopes.sql +2 -0
  38. package/src/migrations/sqlite/meta/0002_snapshot.json +2594 -0
  39. package/src/migrations/sqlite/meta/0003_snapshot.json +2608 -0
  40. package/src/migrations/sqlite/meta/_journal.json +14 -0
  41. package/src/schema.sqlite.ts +6 -0
  42. package/src/schema.ts +11 -1
@@ -0,0 +1,2594 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "583d0c84-fcb4-412c-9862-dc67b3a018ee",
5
+ "prevId": "703bfb7b-6231-4857-b4ba-7dc8ffdb4753",
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
+ "label": {
517
+ "name": "label",
518
+ "type": "text",
519
+ "primaryKey": false,
520
+ "notNull": false,
521
+ "autoincrement": false
522
+ },
523
+ "created_at": {
524
+ "name": "created_at",
525
+ "type": "integer",
526
+ "primaryKey": false,
527
+ "notNull": true,
528
+ "autoincrement": false,
529
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
530
+ },
531
+ "created_by": {
532
+ "name": "created_by",
533
+ "type": "text",
534
+ "primaryKey": false,
535
+ "notNull": true,
536
+ "autoincrement": false
537
+ },
538
+ "expires_at": {
539
+ "name": "expires_at",
540
+ "type": "integer",
541
+ "primaryKey": false,
542
+ "notNull": true,
543
+ "autoincrement": false
544
+ },
545
+ "last_used_at": {
546
+ "name": "last_used_at",
547
+ "type": "integer",
548
+ "primaryKey": false,
549
+ "notNull": false,
550
+ "autoincrement": false
551
+ },
552
+ "last_used_ip": {
553
+ "name": "last_used_ip",
554
+ "type": "text",
555
+ "primaryKey": false,
556
+ "notNull": false,
557
+ "autoincrement": false
558
+ },
559
+ "revoked_at": {
560
+ "name": "revoked_at",
561
+ "type": "integer",
562
+ "primaryKey": false,
563
+ "notNull": false,
564
+ "autoincrement": false
565
+ },
566
+ "revoked_by": {
567
+ "name": "revoked_by",
568
+ "type": "text",
569
+ "primaryKey": false,
570
+ "notNull": false,
571
+ "autoincrement": false
572
+ }
573
+ },
574
+ "indexes": {
575
+ "credentials_principal_idx": {
576
+ "name": "credentials_principal_idx",
577
+ "columns": [
578
+ "principal",
579
+ "generation"
580
+ ],
581
+ "isUnique": false
582
+ },
583
+ "credentials_live_idx": {
584
+ "name": "credentials_live_idx",
585
+ "columns": [
586
+ "principal",
587
+ "expires_at"
588
+ ],
589
+ "isUnique": false,
590
+ "where": "\"credentials\".\"revoked_at\" IS NULL"
591
+ },
592
+ "credentials_issued_by_idx": {
593
+ "name": "credentials_issued_by_idx",
594
+ "columns": [
595
+ "principal",
596
+ "created_by",
597
+ "created_at"
598
+ ],
599
+ "isUnique": false
600
+ },
601
+ "credentials_token_hash_key": {
602
+ "name": "credentials_token_hash_key",
603
+ "columns": [
604
+ "token_hash"
605
+ ],
606
+ "isUnique": true
607
+ }
608
+ },
609
+ "foreignKeys": {
610
+ "credentials_principal_fkey": {
611
+ "name": "credentials_principal_fkey",
612
+ "tableFrom": "credentials",
613
+ "tableTo": "vault_members",
614
+ "columnsFrom": [
615
+ "principal"
616
+ ],
617
+ "columnsTo": [
618
+ "principal"
619
+ ],
620
+ "onDelete": "restrict",
621
+ "onUpdate": "no action"
622
+ },
623
+ "credentials_identity_id_fkey": {
624
+ "name": "credentials_identity_id_fkey",
625
+ "tableFrom": "credentials",
626
+ "tableTo": "identities",
627
+ "columnsFrom": [
628
+ "identity_id",
629
+ "principal",
630
+ "generation"
631
+ ],
632
+ "columnsTo": [
633
+ "id",
634
+ "principal",
635
+ "generation"
636
+ ],
637
+ "onDelete": "restrict",
638
+ "onUpdate": "no action"
639
+ }
640
+ },
641
+ "compositePrimaryKeys": {},
642
+ "uniqueConstraints": {},
643
+ "checkConstraints": {
644
+ "credentials_kind_check": {
645
+ "name": "credentials_kind_check",
646
+ "value": "\"credentials\".\"kind\" IN ('browser', 'cli', 'service')"
647
+ },
648
+ "credentials_principal_check": {
649
+ "name": "credentials_principal_check",
650
+ "value": "\"credentials\".\"principal\" LIKE 'user:%' OR \"credentials\".\"principal\" LIKE 'token:%'"
651
+ },
652
+ "credentials_kind_matches_principal": {
653
+ "name": "credentials_kind_matches_principal",
654
+ "value": "(\"credentials\".\"kind\" = 'service') = (\"credentials\".\"principal\" LIKE 'token:%')"
655
+ },
656
+ "credentials_token_hash_check": {
657
+ "name": "credentials_token_hash_check",
658
+ "value": "octet_length(\"credentials\".\"token_hash\") = 32"
659
+ },
660
+ "credentials_auth_mac_check": {
661
+ "name": "credentials_auth_mac_check",
662
+ "value": "octet_length(\"credentials\".\"auth_mac\") = 32"
663
+ }
664
+ }
665
+ },
666
+ "device_authorizations": {
667
+ "name": "device_authorizations",
668
+ "columns": {
669
+ "id": {
670
+ "name": "id",
671
+ "type": "text",
672
+ "primaryKey": true,
673
+ "notNull": true,
674
+ "autoincrement": false
675
+ },
676
+ "device_code_hash": {
677
+ "name": "device_code_hash",
678
+ "type": "blob",
679
+ "primaryKey": false,
680
+ "notNull": true,
681
+ "autoincrement": false
682
+ },
683
+ "auth_mac": {
684
+ "name": "auth_mac",
685
+ "type": "blob",
686
+ "primaryKey": false,
687
+ "notNull": true,
688
+ "autoincrement": false
689
+ },
690
+ "user_code": {
691
+ "name": "user_code",
692
+ "type": "text",
693
+ "primaryKey": false,
694
+ "notNull": true,
695
+ "autoincrement": false
696
+ },
697
+ "client_label": {
698
+ "name": "client_label",
699
+ "type": "text",
700
+ "primaryKey": false,
701
+ "notNull": false,
702
+ "autoincrement": false
703
+ },
704
+ "client_ip": {
705
+ "name": "client_ip",
706
+ "type": "text",
707
+ "primaryKey": false,
708
+ "notNull": false,
709
+ "autoincrement": false
710
+ },
711
+ "created_at": {
712
+ "name": "created_at",
713
+ "type": "integer",
714
+ "primaryKey": false,
715
+ "notNull": true,
716
+ "autoincrement": false,
717
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
718
+ },
719
+ "expires_at": {
720
+ "name": "expires_at",
721
+ "type": "integer",
722
+ "primaryKey": false,
723
+ "notNull": true,
724
+ "autoincrement": false
725
+ },
726
+ "decided_at": {
727
+ "name": "decided_at",
728
+ "type": "integer",
729
+ "primaryKey": false,
730
+ "notNull": false,
731
+ "autoincrement": false
732
+ },
733
+ "decision": {
734
+ "name": "decision",
735
+ "type": "text",
736
+ "primaryKey": false,
737
+ "notNull": false,
738
+ "autoincrement": false
739
+ },
740
+ "generation": {
741
+ "name": "generation",
742
+ "type": "integer",
743
+ "primaryKey": false,
744
+ "notNull": true,
745
+ "autoincrement": false,
746
+ "default": 0
747
+ },
748
+ "principal": {
749
+ "name": "principal",
750
+ "type": "text",
751
+ "primaryKey": false,
752
+ "notNull": false,
753
+ "autoincrement": false
754
+ },
755
+ "consumed_at": {
756
+ "name": "consumed_at",
757
+ "type": "integer",
758
+ "primaryKey": false,
759
+ "notNull": false,
760
+ "autoincrement": false
761
+ }
762
+ },
763
+ "indexes": {
764
+ "device_authorizations_device_code_hash_key": {
765
+ "name": "device_authorizations_device_code_hash_key",
766
+ "columns": [
767
+ "device_code_hash"
768
+ ],
769
+ "isUnique": true
770
+ },
771
+ "device_authorizations_user_code_key": {
772
+ "name": "device_authorizations_user_code_key",
773
+ "columns": [
774
+ "user_code"
775
+ ],
776
+ "isUnique": true
777
+ }
778
+ },
779
+ "foreignKeys": {
780
+ "device_authorizations_principal_fkey": {
781
+ "name": "device_authorizations_principal_fkey",
782
+ "tableFrom": "device_authorizations",
783
+ "tableTo": "vault_members",
784
+ "columnsFrom": [
785
+ "principal"
786
+ ],
787
+ "columnsTo": [
788
+ "principal"
789
+ ],
790
+ "onDelete": "restrict",
791
+ "onUpdate": "no action"
792
+ }
793
+ },
794
+ "compositePrimaryKeys": {},
795
+ "uniqueConstraints": {},
796
+ "checkConstraints": {
797
+ "device_authorizations_auth_mac_check": {
798
+ "name": "device_authorizations_auth_mac_check",
799
+ "value": "octet_length(\"device_authorizations\".\"auth_mac\") = 32"
800
+ },
801
+ "device_authorizations_decision_check": {
802
+ "name": "device_authorizations_decision_check",
803
+ "value": "\"device_authorizations\".\"decision\" IS NULL OR \"device_authorizations\".\"decision\" IN ('approved', 'denied')"
804
+ },
805
+ "device_authorizations_approval_names_principal": {
806
+ "name": "device_authorizations_approval_names_principal",
807
+ "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 ))"
808
+ }
809
+ }
810
+ },
811
+ "dismissed_keys": {
812
+ "name": "dismissed_keys",
813
+ "columns": {
814
+ "environment_id": {
815
+ "name": "environment_id",
816
+ "type": "text",
817
+ "primaryKey": false,
818
+ "notNull": true,
819
+ "autoincrement": false
820
+ },
821
+ "key": {
822
+ "name": "key",
823
+ "type": "text",
824
+ "primaryKey": false,
825
+ "notNull": true,
826
+ "autoincrement": false
827
+ },
828
+ "dismissed_at": {
829
+ "name": "dismissed_at",
830
+ "type": "integer",
831
+ "primaryKey": false,
832
+ "notNull": true,
833
+ "autoincrement": false,
834
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
835
+ },
836
+ "dismissed_by": {
837
+ "name": "dismissed_by",
838
+ "type": "text",
839
+ "primaryKey": false,
840
+ "notNull": true,
841
+ "autoincrement": false
842
+ },
843
+ "restored_at": {
844
+ "name": "restored_at",
845
+ "type": "integer",
846
+ "primaryKey": false,
847
+ "notNull": false,
848
+ "autoincrement": false
849
+ },
850
+ "restored_by": {
851
+ "name": "restored_by",
852
+ "type": "text",
853
+ "primaryKey": false,
854
+ "notNull": false,
855
+ "autoincrement": false
856
+ }
857
+ },
858
+ "indexes": {},
859
+ "foreignKeys": {
860
+ "dismissed_keys_environment_id_fkey": {
861
+ "name": "dismissed_keys_environment_id_fkey",
862
+ "tableFrom": "dismissed_keys",
863
+ "tableTo": "environments",
864
+ "columnsFrom": [
865
+ "environment_id"
866
+ ],
867
+ "columnsTo": [
868
+ "id"
869
+ ],
870
+ "onDelete": "restrict",
871
+ "onUpdate": "no action"
872
+ }
873
+ },
874
+ "compositePrimaryKeys": {
875
+ "dismissed_keys_pkey": {
876
+ "columns": [
877
+ "environment_id",
878
+ "key"
879
+ ],
880
+ "name": "dismissed_keys_pkey"
881
+ }
882
+ },
883
+ "uniqueConstraints": {},
884
+ "checkConstraints": {
885
+ "dismissed_keys_key_check": {
886
+ "name": "dismissed_keys_key_check",
887
+ "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_]*'"
888
+ }
889
+ }
890
+ },
891
+ "environments": {
892
+ "name": "environments",
893
+ "columns": {
894
+ "id": {
895
+ "name": "id",
896
+ "type": "text",
897
+ "primaryKey": true,
898
+ "notNull": true,
899
+ "autoincrement": false
900
+ },
901
+ "project_id": {
902
+ "name": "project_id",
903
+ "type": "text",
904
+ "primaryKey": false,
905
+ "notNull": true,
906
+ "autoincrement": false
907
+ },
908
+ "slug": {
909
+ "name": "slug",
910
+ "type": "text",
911
+ "primaryKey": false,
912
+ "notNull": true,
913
+ "autoincrement": false
914
+ },
915
+ "name": {
916
+ "name": "name",
917
+ "type": "text",
918
+ "primaryKey": false,
919
+ "notNull": true,
920
+ "autoincrement": false
921
+ },
922
+ "created_at": {
923
+ "name": "created_at",
924
+ "type": "integer",
925
+ "primaryKey": false,
926
+ "notNull": true,
927
+ "autoincrement": false,
928
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
929
+ },
930
+ "archived_at": {
931
+ "name": "archived_at",
932
+ "type": "integer",
933
+ "primaryKey": false,
934
+ "notNull": false,
935
+ "autoincrement": false
936
+ }
937
+ },
938
+ "indexes": {
939
+ "environments_project_id_slug_key": {
940
+ "name": "environments_project_id_slug_key",
941
+ "columns": [
942
+ "project_id",
943
+ "slug"
944
+ ],
945
+ "isUnique": true
946
+ },
947
+ "environments_project_scoped": {
948
+ "name": "environments_project_scoped",
949
+ "columns": [
950
+ "id",
951
+ "project_id"
952
+ ],
953
+ "isUnique": true
954
+ }
955
+ },
956
+ "foreignKeys": {
957
+ "environments_project_id_fkey": {
958
+ "name": "environments_project_id_fkey",
959
+ "tableFrom": "environments",
960
+ "tableTo": "projects",
961
+ "columnsFrom": [
962
+ "project_id"
963
+ ],
964
+ "columnsTo": [
965
+ "id"
966
+ ],
967
+ "onDelete": "restrict",
968
+ "onUpdate": "no action"
969
+ }
970
+ },
971
+ "compositePrimaryKeys": {},
972
+ "uniqueConstraints": {},
973
+ "checkConstraints": {
974
+ "environments_slug_check": {
975
+ "name": "environments_slug_check",
976
+ "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-]*')"
977
+ }
978
+ }
979
+ },
980
+ "identities": {
981
+ "name": "identities",
982
+ "columns": {
983
+ "id": {
984
+ "name": "id",
985
+ "type": "text",
986
+ "primaryKey": true,
987
+ "notNull": true,
988
+ "autoincrement": false
989
+ },
990
+ "provider": {
991
+ "name": "provider",
992
+ "type": "text",
993
+ "primaryKey": false,
994
+ "notNull": true,
995
+ "autoincrement": false
996
+ },
997
+ "auth_mac": {
998
+ "name": "auth_mac",
999
+ "type": "blob",
1000
+ "primaryKey": false,
1001
+ "notNull": true,
1002
+ "autoincrement": false
1003
+ },
1004
+ "subject": {
1005
+ "name": "subject",
1006
+ "type": "text",
1007
+ "primaryKey": false,
1008
+ "notNull": true,
1009
+ "autoincrement": false
1010
+ },
1011
+ "issuer_hash": {
1012
+ "name": "issuer_hash",
1013
+ "type": "text",
1014
+ "primaryKey": false,
1015
+ "notNull": true,
1016
+ "autoincrement": false
1017
+ },
1018
+ "generation": {
1019
+ "name": "generation",
1020
+ "type": "integer",
1021
+ "primaryKey": false,
1022
+ "notNull": true,
1023
+ "autoincrement": false
1024
+ },
1025
+ "principal": {
1026
+ "name": "principal",
1027
+ "type": "text",
1028
+ "primaryKey": false,
1029
+ "notNull": true,
1030
+ "autoincrement": false
1031
+ },
1032
+ "email": {
1033
+ "name": "email",
1034
+ "type": "text",
1035
+ "primaryKey": false,
1036
+ "notNull": false,
1037
+ "autoincrement": false
1038
+ },
1039
+ "created_at": {
1040
+ "name": "created_at",
1041
+ "type": "integer",
1042
+ "primaryKey": false,
1043
+ "notNull": true,
1044
+ "autoincrement": false,
1045
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1046
+ },
1047
+ "created_by": {
1048
+ "name": "created_by",
1049
+ "type": "text",
1050
+ "primaryKey": false,
1051
+ "notNull": true,
1052
+ "autoincrement": false
1053
+ },
1054
+ "last_sign_in_at": {
1055
+ "name": "last_sign_in_at",
1056
+ "type": "integer",
1057
+ "primaryKey": false,
1058
+ "notNull": false,
1059
+ "autoincrement": false
1060
+ },
1061
+ "revoked_at": {
1062
+ "name": "revoked_at",
1063
+ "type": "integer",
1064
+ "primaryKey": false,
1065
+ "notNull": false,
1066
+ "autoincrement": false
1067
+ },
1068
+ "revoked_by": {
1069
+ "name": "revoked_by",
1070
+ "type": "text",
1071
+ "primaryKey": false,
1072
+ "notNull": false,
1073
+ "autoincrement": false
1074
+ },
1075
+ "active_subject": {
1076
+ "name": "active_subject",
1077
+ "type": "text",
1078
+ "primaryKey": false,
1079
+ "notNull": false,
1080
+ "autoincrement": false,
1081
+ "generated": {
1082
+ "as": "(CASE WHEN revoked_at IS NULL THEN subject END)",
1083
+ "type": "stored"
1084
+ }
1085
+ }
1086
+ },
1087
+ "indexes": {
1088
+ "identities_active_subject": {
1089
+ "name": "identities_active_subject",
1090
+ "columns": [
1091
+ "provider",
1092
+ "issuer_hash",
1093
+ "active_subject"
1094
+ ],
1095
+ "isUnique": true
1096
+ },
1097
+ "identities_principal_idx": {
1098
+ "name": "identities_principal_idx",
1099
+ "columns": [
1100
+ "principal",
1101
+ "generation"
1102
+ ],
1103
+ "isUnique": false
1104
+ },
1105
+ "identities_member_generation_key": {
1106
+ "name": "identities_member_generation_key",
1107
+ "columns": [
1108
+ "id",
1109
+ "principal",
1110
+ "generation"
1111
+ ],
1112
+ "isUnique": true
1113
+ }
1114
+ },
1115
+ "foreignKeys": {
1116
+ "identities_principal_fkey": {
1117
+ "name": "identities_principal_fkey",
1118
+ "tableFrom": "identities",
1119
+ "tableTo": "vault_members",
1120
+ "columnsFrom": [
1121
+ "principal"
1122
+ ],
1123
+ "columnsTo": [
1124
+ "principal"
1125
+ ],
1126
+ "onDelete": "restrict",
1127
+ "onUpdate": "no action"
1128
+ }
1129
+ },
1130
+ "compositePrimaryKeys": {},
1131
+ "uniqueConstraints": {},
1132
+ "checkConstraints": {
1133
+ "identities_principal_check": {
1134
+ "name": "identities_principal_check",
1135
+ "value": "\"identities\".\"principal\" LIKE 'user:%'"
1136
+ },
1137
+ "identities_provider_check": {
1138
+ "name": "identities_provider_check",
1139
+ "value": "length(\"identities\".\"provider\") BETWEEN 1 AND 32 AND \"identities\".\"provider\" GLOB '[a-z0-9]*' AND \"identities\".\"provider\" NOT GLOB '*[^a-z0-9-]*'"
1140
+ },
1141
+ "identities_auth_mac_check": {
1142
+ "name": "identities_auth_mac_check",
1143
+ "value": "octet_length(\"identities\".\"auth_mac\") = 32"
1144
+ }
1145
+ }
1146
+ },
1147
+ "mcp_approvals": {
1148
+ "name": "mcp_approvals",
1149
+ "columns": {
1150
+ "id": {
1151
+ "name": "id",
1152
+ "type": "text",
1153
+ "primaryKey": true,
1154
+ "notNull": true,
1155
+ "autoincrement": false
1156
+ },
1157
+ "connection_id": {
1158
+ "name": "connection_id",
1159
+ "type": "text",
1160
+ "primaryKey": false,
1161
+ "notNull": true,
1162
+ "autoincrement": false
1163
+ },
1164
+ "tool": {
1165
+ "name": "tool",
1166
+ "type": "text",
1167
+ "primaryKey": false,
1168
+ "notNull": true,
1169
+ "autoincrement": false
1170
+ },
1171
+ "arguments": {
1172
+ "name": "arguments",
1173
+ "type": "text",
1174
+ "primaryKey": false,
1175
+ "notNull": true,
1176
+ "autoincrement": false
1177
+ },
1178
+ "digest": {
1179
+ "name": "digest",
1180
+ "type": "blob",
1181
+ "primaryKey": false,
1182
+ "notNull": true,
1183
+ "autoincrement": false
1184
+ },
1185
+ "status": {
1186
+ "name": "status",
1187
+ "type": "text",
1188
+ "primaryKey": false,
1189
+ "notNull": true,
1190
+ "autoincrement": false,
1191
+ "default": "'pending'"
1192
+ },
1193
+ "outcome": {
1194
+ "name": "outcome",
1195
+ "type": "text",
1196
+ "primaryKey": false,
1197
+ "notNull": false,
1198
+ "autoincrement": false
1199
+ },
1200
+ "created_at": {
1201
+ "name": "created_at",
1202
+ "type": "integer",
1203
+ "primaryKey": false,
1204
+ "notNull": true,
1205
+ "autoincrement": false,
1206
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1207
+ },
1208
+ "expires_at": {
1209
+ "name": "expires_at",
1210
+ "type": "integer",
1211
+ "primaryKey": false,
1212
+ "notNull": true,
1213
+ "autoincrement": false
1214
+ },
1215
+ "decided_at": {
1216
+ "name": "decided_at",
1217
+ "type": "integer",
1218
+ "primaryKey": false,
1219
+ "notNull": false,
1220
+ "autoincrement": false
1221
+ },
1222
+ "reported_at": {
1223
+ "name": "reported_at",
1224
+ "type": "integer",
1225
+ "primaryKey": false,
1226
+ "notNull": false,
1227
+ "autoincrement": false
1228
+ }
1229
+ },
1230
+ "indexes": {
1231
+ "mcp_approvals_open_idx": {
1232
+ "name": "mcp_approvals_open_idx",
1233
+ "columns": [
1234
+ "connection_id",
1235
+ "digest"
1236
+ ],
1237
+ "isUnique": false,
1238
+ "where": "\"mcp_approvals\".\"reported_at\" IS NULL"
1239
+ }
1240
+ },
1241
+ "foreignKeys": {
1242
+ "mcp_approvals_connection_fkey": {
1243
+ "name": "mcp_approvals_connection_fkey",
1244
+ "tableFrom": "mcp_approvals",
1245
+ "tableTo": "mcp_connections",
1246
+ "columnsFrom": [
1247
+ "connection_id"
1248
+ ],
1249
+ "columnsTo": [
1250
+ "id"
1251
+ ],
1252
+ "onDelete": "restrict",
1253
+ "onUpdate": "no action"
1254
+ }
1255
+ },
1256
+ "compositePrimaryKeys": {},
1257
+ "uniqueConstraints": {},
1258
+ "checkConstraints": {
1259
+ "mcp_approvals_status_check": {
1260
+ "name": "mcp_approvals_status_check",
1261
+ "value": "\"mcp_approvals\".\"status\" IN ('pending', 'approved', 'denied', 'cancelled', 'failed')"
1262
+ },
1263
+ "mcp_approvals_digest_check": {
1264
+ "name": "mcp_approvals_digest_check",
1265
+ "value": "octet_length(\"mcp_approvals\".\"digest\") = 32"
1266
+ },
1267
+ "mcp_approvals_arguments_check": {
1268
+ "name": "mcp_approvals_arguments_check",
1269
+ "value": "json_valid(\"mcp_approvals\".\"arguments\")"
1270
+ }
1271
+ }
1272
+ },
1273
+ "mcp_connections": {
1274
+ "name": "mcp_connections",
1275
+ "columns": {
1276
+ "id": {
1277
+ "name": "id",
1278
+ "type": "text",
1279
+ "primaryKey": true,
1280
+ "notNull": true,
1281
+ "autoincrement": false
1282
+ },
1283
+ "auth_mac": {
1284
+ "name": "auth_mac",
1285
+ "type": "blob",
1286
+ "primaryKey": false,
1287
+ "notNull": true,
1288
+ "autoincrement": false
1289
+ },
1290
+ "principal": {
1291
+ "name": "principal",
1292
+ "type": "text",
1293
+ "primaryKey": false,
1294
+ "notNull": true,
1295
+ "autoincrement": false
1296
+ },
1297
+ "generation": {
1298
+ "name": "generation",
1299
+ "type": "integer",
1300
+ "primaryKey": false,
1301
+ "notNull": true,
1302
+ "autoincrement": false
1303
+ },
1304
+ "client_id": {
1305
+ "name": "client_id",
1306
+ "type": "text",
1307
+ "primaryKey": false,
1308
+ "notNull": true,
1309
+ "autoincrement": false
1310
+ },
1311
+ "client_name": {
1312
+ "name": "client_name",
1313
+ "type": "text",
1314
+ "primaryKey": false,
1315
+ "notNull": true,
1316
+ "autoincrement": false
1317
+ },
1318
+ "client_host": {
1319
+ "name": "client_host",
1320
+ "type": "text",
1321
+ "primaryKey": false,
1322
+ "notNull": false,
1323
+ "autoincrement": false
1324
+ },
1325
+ "registration": {
1326
+ "name": "registration",
1327
+ "type": "text",
1328
+ "primaryKey": false,
1329
+ "notNull": true,
1330
+ "autoincrement": false
1331
+ },
1332
+ "scopes": {
1333
+ "name": "scopes",
1334
+ "type": "text",
1335
+ "primaryKey": false,
1336
+ "notNull": true,
1337
+ "autoincrement": false
1338
+ },
1339
+ "redirect_uri": {
1340
+ "name": "redirect_uri",
1341
+ "type": "text",
1342
+ "primaryKey": false,
1343
+ "notNull": true,
1344
+ "autoincrement": false
1345
+ },
1346
+ "code_hash": {
1347
+ "name": "code_hash",
1348
+ "type": "blob",
1349
+ "primaryKey": false,
1350
+ "notNull": false,
1351
+ "autoincrement": false
1352
+ },
1353
+ "code_challenge": {
1354
+ "name": "code_challenge",
1355
+ "type": "text",
1356
+ "primaryKey": false,
1357
+ "notNull": false,
1358
+ "autoincrement": false
1359
+ },
1360
+ "code_expires_at": {
1361
+ "name": "code_expires_at",
1362
+ "type": "integer",
1363
+ "primaryKey": false,
1364
+ "notNull": false,
1365
+ "autoincrement": false
1366
+ },
1367
+ "refresh_hash": {
1368
+ "name": "refresh_hash",
1369
+ "type": "blob",
1370
+ "primaryKey": false,
1371
+ "notNull": false,
1372
+ "autoincrement": false
1373
+ },
1374
+ "refresh_previous_hash": {
1375
+ "name": "refresh_previous_hash",
1376
+ "type": "blob",
1377
+ "primaryKey": false,
1378
+ "notNull": false,
1379
+ "autoincrement": false
1380
+ },
1381
+ "expires_at": {
1382
+ "name": "expires_at",
1383
+ "type": "integer",
1384
+ "primaryKey": false,
1385
+ "notNull": true,
1386
+ "autoincrement": false
1387
+ },
1388
+ "created_at": {
1389
+ "name": "created_at",
1390
+ "type": "integer",
1391
+ "primaryKey": false,
1392
+ "notNull": true,
1393
+ "autoincrement": false,
1394
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1395
+ },
1396
+ "last_used_at": {
1397
+ "name": "last_used_at",
1398
+ "type": "integer",
1399
+ "primaryKey": false,
1400
+ "notNull": false,
1401
+ "autoincrement": false
1402
+ },
1403
+ "last_used_ip": {
1404
+ "name": "last_used_ip",
1405
+ "type": "text",
1406
+ "primaryKey": false,
1407
+ "notNull": false,
1408
+ "autoincrement": false
1409
+ },
1410
+ "revoked_at": {
1411
+ "name": "revoked_at",
1412
+ "type": "integer",
1413
+ "primaryKey": false,
1414
+ "notNull": false,
1415
+ "autoincrement": false
1416
+ },
1417
+ "revoked_by": {
1418
+ "name": "revoked_by",
1419
+ "type": "text",
1420
+ "primaryKey": false,
1421
+ "notNull": false,
1422
+ "autoincrement": false
1423
+ }
1424
+ },
1425
+ "indexes": {
1426
+ "mcp_connections_refresh_previous_idx": {
1427
+ "name": "mcp_connections_refresh_previous_idx",
1428
+ "columns": [
1429
+ "refresh_previous_hash"
1430
+ ],
1431
+ "isUnique": false
1432
+ },
1433
+ "mcp_connections_live_idx": {
1434
+ "name": "mcp_connections_live_idx",
1435
+ "columns": [
1436
+ "principal",
1437
+ "expires_at"
1438
+ ],
1439
+ "isUnique": false,
1440
+ "where": "\"mcp_connections\".\"revoked_at\" IS NULL"
1441
+ },
1442
+ "mcp_connections_code_hash_key": {
1443
+ "name": "mcp_connections_code_hash_key",
1444
+ "columns": [
1445
+ "code_hash"
1446
+ ],
1447
+ "isUnique": true
1448
+ },
1449
+ "mcp_connections_refresh_hash_key": {
1450
+ "name": "mcp_connections_refresh_hash_key",
1451
+ "columns": [
1452
+ "refresh_hash"
1453
+ ],
1454
+ "isUnique": true
1455
+ }
1456
+ },
1457
+ "foreignKeys": {
1458
+ "mcp_connections_principal_fkey": {
1459
+ "name": "mcp_connections_principal_fkey",
1460
+ "tableFrom": "mcp_connections",
1461
+ "tableTo": "vault_members",
1462
+ "columnsFrom": [
1463
+ "principal"
1464
+ ],
1465
+ "columnsTo": [
1466
+ "principal"
1467
+ ],
1468
+ "onDelete": "restrict",
1469
+ "onUpdate": "no action"
1470
+ }
1471
+ },
1472
+ "compositePrimaryKeys": {},
1473
+ "uniqueConstraints": {},
1474
+ "checkConstraints": {
1475
+ "mcp_connections_principal_check": {
1476
+ "name": "mcp_connections_principal_check",
1477
+ "value": "\"mcp_connections\".\"principal\" LIKE 'user:%'"
1478
+ },
1479
+ "mcp_connections_registration_check": {
1480
+ "name": "mcp_connections_registration_check",
1481
+ "value": "\"mcp_connections\".\"registration\" IN ('cimd', 'dcr')"
1482
+ },
1483
+ "mcp_connections_auth_mac_check": {
1484
+ "name": "mcp_connections_auth_mac_check",
1485
+ "value": "octet_length(\"mcp_connections\".\"auth_mac\") = 32"
1486
+ },
1487
+ "mcp_connections_code_hash_check": {
1488
+ "name": "mcp_connections_code_hash_check",
1489
+ "value": "\"mcp_connections\".\"code_hash\" IS NULL OR octet_length(\"mcp_connections\".\"code_hash\") = 32"
1490
+ },
1491
+ "mcp_connections_refresh_hash_check": {
1492
+ "name": "mcp_connections_refresh_hash_check",
1493
+ "value": "\"mcp_connections\".\"refresh_hash\" IS NULL OR octet_length(\"mcp_connections\".\"refresh_hash\") = 32"
1494
+ }
1495
+ }
1496
+ },
1497
+ "oauth_clients": {
1498
+ "name": "oauth_clients",
1499
+ "columns": {
1500
+ "id": {
1501
+ "name": "id",
1502
+ "type": "text",
1503
+ "primaryKey": true,
1504
+ "notNull": true,
1505
+ "autoincrement": false
1506
+ },
1507
+ "auth_mac": {
1508
+ "name": "auth_mac",
1509
+ "type": "blob",
1510
+ "primaryKey": false,
1511
+ "notNull": true,
1512
+ "autoincrement": false
1513
+ },
1514
+ "name": {
1515
+ "name": "name",
1516
+ "type": "text",
1517
+ "primaryKey": false,
1518
+ "notNull": true,
1519
+ "autoincrement": false
1520
+ },
1521
+ "redirect_uris": {
1522
+ "name": "redirect_uris",
1523
+ "type": "text",
1524
+ "primaryKey": false,
1525
+ "notNull": true,
1526
+ "autoincrement": false
1527
+ },
1528
+ "created_at": {
1529
+ "name": "created_at",
1530
+ "type": "integer",
1531
+ "primaryKey": false,
1532
+ "notNull": true,
1533
+ "autoincrement": false,
1534
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1535
+ },
1536
+ "created_ip": {
1537
+ "name": "created_ip",
1538
+ "type": "text",
1539
+ "primaryKey": false,
1540
+ "notNull": false,
1541
+ "autoincrement": false
1542
+ },
1543
+ "revoked_at": {
1544
+ "name": "revoked_at",
1545
+ "type": "integer",
1546
+ "primaryKey": false,
1547
+ "notNull": false,
1548
+ "autoincrement": false
1549
+ }
1550
+ },
1551
+ "indexes": {},
1552
+ "foreignKeys": {},
1553
+ "compositePrimaryKeys": {},
1554
+ "uniqueConstraints": {},
1555
+ "checkConstraints": {
1556
+ "oauth_clients_auth_mac_check": {
1557
+ "name": "oauth_clients_auth_mac_check",
1558
+ "value": "octet_length(\"oauth_clients\".\"auth_mac\") = 32"
1559
+ },
1560
+ "oauth_clients_redirect_uris_check": {
1561
+ "name": "oauth_clients_redirect_uris_check",
1562
+ "value": "json_valid(\"oauth_clients\".\"redirect_uris\")"
1563
+ }
1564
+ }
1565
+ },
1566
+ "projects": {
1567
+ "name": "projects",
1568
+ "columns": {
1569
+ "id": {
1570
+ "name": "id",
1571
+ "type": "text",
1572
+ "primaryKey": true,
1573
+ "notNull": true,
1574
+ "autoincrement": false
1575
+ },
1576
+ "slug": {
1577
+ "name": "slug",
1578
+ "type": "text",
1579
+ "primaryKey": false,
1580
+ "notNull": true,
1581
+ "autoincrement": false
1582
+ },
1583
+ "name": {
1584
+ "name": "name",
1585
+ "type": "text",
1586
+ "primaryKey": false,
1587
+ "notNull": true,
1588
+ "autoincrement": false
1589
+ },
1590
+ "created_at": {
1591
+ "name": "created_at",
1592
+ "type": "integer",
1593
+ "primaryKey": false,
1594
+ "notNull": true,
1595
+ "autoincrement": false,
1596
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1597
+ },
1598
+ "archived_at": {
1599
+ "name": "archived_at",
1600
+ "type": "integer",
1601
+ "primaryKey": false,
1602
+ "notNull": false,
1603
+ "autoincrement": false
1604
+ },
1605
+ "folder": {
1606
+ "name": "folder",
1607
+ "type": "text",
1608
+ "primaryKey": false,
1609
+ "notNull": false,
1610
+ "autoincrement": false
1611
+ }
1612
+ },
1613
+ "indexes": {
1614
+ "projects_slug_key": {
1615
+ "name": "projects_slug_key",
1616
+ "columns": [
1617
+ "slug"
1618
+ ],
1619
+ "isUnique": true
1620
+ }
1621
+ },
1622
+ "foreignKeys": {},
1623
+ "compositePrimaryKeys": {},
1624
+ "uniqueConstraints": {},
1625
+ "checkConstraints": {
1626
+ "projects_slug_check": {
1627
+ "name": "projects_slug_check",
1628
+ "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-]*')"
1629
+ },
1630
+ "projects_folder_check": {
1631
+ "name": "projects_folder_check",
1632
+ "value": "\"projects\".\"folder\" IS NULL OR (length(\"projects\".\"folder\") BETWEEN 1 AND 64 AND \"projects\".\"folder\" NOT GLOB '*/*' AND \"projects\".\"folder\" = trim(\"projects\".\"folder\"))"
1633
+ }
1634
+ }
1635
+ },
1636
+ "secret_references": {
1637
+ "name": "secret_references",
1638
+ "columns": {
1639
+ "id": {
1640
+ "name": "id",
1641
+ "type": "text",
1642
+ "primaryKey": true,
1643
+ "notNull": true,
1644
+ "autoincrement": false
1645
+ },
1646
+ "project_id": {
1647
+ "name": "project_id",
1648
+ "type": "text",
1649
+ "primaryKey": false,
1650
+ "notNull": true,
1651
+ "autoincrement": false
1652
+ },
1653
+ "environment_id": {
1654
+ "name": "environment_id",
1655
+ "type": "text",
1656
+ "primaryKey": false,
1657
+ "notNull": true,
1658
+ "autoincrement": false
1659
+ },
1660
+ "secret_id": {
1661
+ "name": "secret_id",
1662
+ "type": "text",
1663
+ "primaryKey": false,
1664
+ "notNull": true,
1665
+ "autoincrement": false
1666
+ },
1667
+ "source_project_id": {
1668
+ "name": "source_project_id",
1669
+ "type": "text",
1670
+ "primaryKey": false,
1671
+ "notNull": true,
1672
+ "autoincrement": false
1673
+ },
1674
+ "source_environment_id": {
1675
+ "name": "source_environment_id",
1676
+ "type": "text",
1677
+ "primaryKey": false,
1678
+ "notNull": true,
1679
+ "autoincrement": false
1680
+ },
1681
+ "source_secret_id": {
1682
+ "name": "source_secret_id",
1683
+ "type": "text",
1684
+ "primaryKey": false,
1685
+ "notNull": true,
1686
+ "autoincrement": false
1687
+ },
1688
+ "created_seq": {
1689
+ "name": "created_seq",
1690
+ "type": "integer",
1691
+ "primaryKey": false,
1692
+ "notNull": true,
1693
+ "autoincrement": false
1694
+ },
1695
+ "created_at": {
1696
+ "name": "created_at",
1697
+ "type": "integer",
1698
+ "primaryKey": false,
1699
+ "notNull": true,
1700
+ "autoincrement": false,
1701
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1702
+ },
1703
+ "created_by": {
1704
+ "name": "created_by",
1705
+ "type": "text",
1706
+ "primaryKey": false,
1707
+ "notNull": true,
1708
+ "autoincrement": false
1709
+ }
1710
+ },
1711
+ "indexes": {
1712
+ "secret_references_holder_idx": {
1713
+ "name": "secret_references_holder_idx",
1714
+ "columns": [
1715
+ "secret_id",
1716
+ "created_seq"
1717
+ ],
1718
+ "isUnique": false
1719
+ },
1720
+ "secret_references_source_idx": {
1721
+ "name": "secret_references_source_idx",
1722
+ "columns": [
1723
+ "source_secret_id"
1724
+ ],
1725
+ "isUnique": false
1726
+ },
1727
+ "secret_references_project_idx": {
1728
+ "name": "secret_references_project_idx",
1729
+ "columns": [
1730
+ "project_id"
1731
+ ],
1732
+ "isUnique": false
1733
+ },
1734
+ "secret_references_source_project_idx": {
1735
+ "name": "secret_references_source_project_idx",
1736
+ "columns": [
1737
+ "source_project_id"
1738
+ ],
1739
+ "isUnique": false
1740
+ },
1741
+ "secret_references_created_by_idx": {
1742
+ "name": "secret_references_created_by_idx",
1743
+ "columns": [
1744
+ "created_by"
1745
+ ],
1746
+ "isUnique": false
1747
+ },
1748
+ "secret_references_created_seq_key": {
1749
+ "name": "secret_references_created_seq_key",
1750
+ "columns": [
1751
+ "created_seq"
1752
+ ],
1753
+ "isUnique": true
1754
+ }
1755
+ },
1756
+ "foreignKeys": {
1757
+ "secret_references_secret_id_fkey": {
1758
+ "name": "secret_references_secret_id_fkey",
1759
+ "tableFrom": "secret_references",
1760
+ "tableTo": "secrets",
1761
+ "columnsFrom": [
1762
+ "secret_id"
1763
+ ],
1764
+ "columnsTo": [
1765
+ "id"
1766
+ ],
1767
+ "onDelete": "restrict",
1768
+ "onUpdate": "no action"
1769
+ },
1770
+ "secret_references_source_secret_id_fkey": {
1771
+ "name": "secret_references_source_secret_id_fkey",
1772
+ "tableFrom": "secret_references",
1773
+ "tableTo": "secrets",
1774
+ "columnsFrom": [
1775
+ "source_secret_id"
1776
+ ],
1777
+ "columnsTo": [
1778
+ "id"
1779
+ ],
1780
+ "onDelete": "restrict",
1781
+ "onUpdate": "no action"
1782
+ },
1783
+ "secret_references_created_seq_fkey": {
1784
+ "name": "secret_references_created_seq_fkey",
1785
+ "tableFrom": "secret_references",
1786
+ "tableTo": "audit_log",
1787
+ "columnsFrom": [
1788
+ "created_seq"
1789
+ ],
1790
+ "columnsTo": [
1791
+ "seq"
1792
+ ],
1793
+ "onDelete": "restrict",
1794
+ "onUpdate": "no action"
1795
+ }
1796
+ },
1797
+ "compositePrimaryKeys": {},
1798
+ "uniqueConstraints": {},
1799
+ "checkConstraints": {}
1800
+ },
1801
+ "secret_versions": {
1802
+ "name": "secret_versions",
1803
+ "columns": {
1804
+ "id": {
1805
+ "name": "id",
1806
+ "type": "text",
1807
+ "primaryKey": true,
1808
+ "notNull": true,
1809
+ "autoincrement": false
1810
+ },
1811
+ "secret_id": {
1812
+ "name": "secret_id",
1813
+ "type": "text",
1814
+ "primaryKey": false,
1815
+ "notNull": true,
1816
+ "autoincrement": false
1817
+ },
1818
+ "version": {
1819
+ "name": "version",
1820
+ "type": "integer",
1821
+ "primaryKey": false,
1822
+ "notNull": true,
1823
+ "autoincrement": false
1824
+ },
1825
+ "envelope_version": {
1826
+ "name": "envelope_version",
1827
+ "type": "integer",
1828
+ "primaryKey": false,
1829
+ "notNull": true,
1830
+ "autoincrement": false
1831
+ },
1832
+ "ciphertext": {
1833
+ "name": "ciphertext",
1834
+ "type": "blob",
1835
+ "primaryKey": false,
1836
+ "notNull": true,
1837
+ "autoincrement": false
1838
+ },
1839
+ "iv": {
1840
+ "name": "iv",
1841
+ "type": "blob",
1842
+ "primaryKey": false,
1843
+ "notNull": true,
1844
+ "autoincrement": false
1845
+ },
1846
+ "auth_tag": {
1847
+ "name": "auth_tag",
1848
+ "type": "blob",
1849
+ "primaryKey": false,
1850
+ "notNull": true,
1851
+ "autoincrement": false
1852
+ },
1853
+ "wrapped_dek": {
1854
+ "name": "wrapped_dek",
1855
+ "type": "blob",
1856
+ "primaryKey": false,
1857
+ "notNull": true,
1858
+ "autoincrement": false
1859
+ },
1860
+ "kek_provider": {
1861
+ "name": "kek_provider",
1862
+ "type": "text",
1863
+ "primaryKey": false,
1864
+ "notNull": true,
1865
+ "autoincrement": false
1866
+ },
1867
+ "kek_id": {
1868
+ "name": "kek_id",
1869
+ "type": "text",
1870
+ "primaryKey": false,
1871
+ "notNull": true,
1872
+ "autoincrement": false
1873
+ },
1874
+ "kek_version": {
1875
+ "name": "kek_version",
1876
+ "type": "text",
1877
+ "primaryKey": false,
1878
+ "notNull": true,
1879
+ "autoincrement": false
1880
+ },
1881
+ "created_at": {
1882
+ "name": "created_at",
1883
+ "type": "integer",
1884
+ "primaryKey": false,
1885
+ "notNull": true,
1886
+ "autoincrement": false,
1887
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1888
+ },
1889
+ "created_by": {
1890
+ "name": "created_by",
1891
+ "type": "text",
1892
+ "primaryKey": false,
1893
+ "notNull": true,
1894
+ "autoincrement": false
1895
+ }
1896
+ },
1897
+ "indexes": {
1898
+ "secret_versions_secret_idx": {
1899
+ "name": "secret_versions_secret_idx",
1900
+ "columns": [
1901
+ "secret_id",
1902
+ "version"
1903
+ ],
1904
+ "isUnique": false
1905
+ },
1906
+ "secret_versions_secret_id_version_key": {
1907
+ "name": "secret_versions_secret_id_version_key",
1908
+ "columns": [
1909
+ "secret_id",
1910
+ "version"
1911
+ ],
1912
+ "isUnique": true
1913
+ }
1914
+ },
1915
+ "foreignKeys": {
1916
+ "secret_versions_secret_id_fkey": {
1917
+ "name": "secret_versions_secret_id_fkey",
1918
+ "tableFrom": "secret_versions",
1919
+ "tableTo": "secrets",
1920
+ "columnsFrom": [
1921
+ "secret_id"
1922
+ ],
1923
+ "columnsTo": [
1924
+ "id"
1925
+ ],
1926
+ "onDelete": "restrict",
1927
+ "onUpdate": "no action"
1928
+ }
1929
+ },
1930
+ "compositePrimaryKeys": {},
1931
+ "uniqueConstraints": {},
1932
+ "checkConstraints": {
1933
+ "secret_versions_version_check": {
1934
+ "name": "secret_versions_version_check",
1935
+ "value": "\"secret_versions\".\"version\" > 0"
1936
+ },
1937
+ "secret_versions_iv_check": {
1938
+ "name": "secret_versions_iv_check",
1939
+ "value": "octet_length(\"secret_versions\".\"iv\") = 12"
1940
+ },
1941
+ "secret_versions_auth_tag_check": {
1942
+ "name": "secret_versions_auth_tag_check",
1943
+ "value": "octet_length(\"secret_versions\".\"auth_tag\") = 16"
1944
+ }
1945
+ }
1946
+ },
1947
+ "secrets": {
1948
+ "name": "secrets",
1949
+ "columns": {
1950
+ "id": {
1951
+ "name": "id",
1952
+ "type": "text",
1953
+ "primaryKey": true,
1954
+ "notNull": true,
1955
+ "autoincrement": false
1956
+ },
1957
+ "project_id": {
1958
+ "name": "project_id",
1959
+ "type": "text",
1960
+ "primaryKey": false,
1961
+ "notNull": true,
1962
+ "autoincrement": false
1963
+ },
1964
+ "environment_id": {
1965
+ "name": "environment_id",
1966
+ "type": "text",
1967
+ "primaryKey": false,
1968
+ "notNull": true,
1969
+ "autoincrement": false
1970
+ },
1971
+ "key": {
1972
+ "name": "key",
1973
+ "type": "text",
1974
+ "primaryKey": false,
1975
+ "notNull": true,
1976
+ "autoincrement": false
1977
+ },
1978
+ "created_at": {
1979
+ "name": "created_at",
1980
+ "type": "integer",
1981
+ "primaryKey": false,
1982
+ "notNull": true,
1983
+ "autoincrement": false,
1984
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1985
+ },
1986
+ "updated_at": {
1987
+ "name": "updated_at",
1988
+ "type": "integer",
1989
+ "primaryKey": false,
1990
+ "notNull": true,
1991
+ "autoincrement": false,
1992
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1993
+ },
1994
+ "current_version_id": {
1995
+ "name": "current_version_id",
1996
+ "type": "text",
1997
+ "primaryKey": false,
1998
+ "notNull": false,
1999
+ "autoincrement": false
2000
+ },
2001
+ "current_version": {
2002
+ "name": "current_version",
2003
+ "type": "integer",
2004
+ "primaryKey": false,
2005
+ "notNull": true,
2006
+ "autoincrement": false,
2007
+ "default": 0
2008
+ },
2009
+ "archived_at": {
2010
+ "name": "archived_at",
2011
+ "type": "integer",
2012
+ "primaryKey": false,
2013
+ "notNull": false,
2014
+ "autoincrement": false
2015
+ },
2016
+ "folder": {
2017
+ "name": "folder",
2018
+ "type": "text",
2019
+ "primaryKey": false,
2020
+ "notNull": false,
2021
+ "autoincrement": false
2022
+ }
2023
+ },
2024
+ "indexes": {
2025
+ "secrets_lookup_idx": {
2026
+ "name": "secrets_lookup_idx",
2027
+ "columns": [
2028
+ "project_id",
2029
+ "environment_id",
2030
+ "key"
2031
+ ],
2032
+ "isUnique": false
2033
+ },
2034
+ "secrets_project_id_environment_id_key_key": {
2035
+ "name": "secrets_project_id_environment_id_key_key",
2036
+ "columns": [
2037
+ "project_id",
2038
+ "environment_id",
2039
+ "key"
2040
+ ],
2041
+ "isUnique": true
2042
+ }
2043
+ },
2044
+ "foreignKeys": {
2045
+ "secrets_current_version_id_secret_versions_id_fk": {
2046
+ "name": "secrets_current_version_id_secret_versions_id_fk",
2047
+ "tableFrom": "secrets",
2048
+ "tableTo": "secret_versions",
2049
+ "columnsFrom": [
2050
+ "current_version_id"
2051
+ ],
2052
+ "columnsTo": [
2053
+ "id"
2054
+ ],
2055
+ "onDelete": "no action",
2056
+ "onUpdate": "no action"
2057
+ },
2058
+ "secrets_project_id_fkey": {
2059
+ "name": "secrets_project_id_fkey",
2060
+ "tableFrom": "secrets",
2061
+ "tableTo": "projects",
2062
+ "columnsFrom": [
2063
+ "project_id"
2064
+ ],
2065
+ "columnsTo": [
2066
+ "id"
2067
+ ],
2068
+ "onDelete": "restrict",
2069
+ "onUpdate": "no action"
2070
+ },
2071
+ "secrets_environment_id_fkey": {
2072
+ "name": "secrets_environment_id_fkey",
2073
+ "tableFrom": "secrets",
2074
+ "tableTo": "environments",
2075
+ "columnsFrom": [
2076
+ "environment_id"
2077
+ ],
2078
+ "columnsTo": [
2079
+ "id"
2080
+ ],
2081
+ "onDelete": "restrict",
2082
+ "onUpdate": "no action"
2083
+ },
2084
+ "secrets_environment_in_project": {
2085
+ "name": "secrets_environment_in_project",
2086
+ "tableFrom": "secrets",
2087
+ "tableTo": "environments",
2088
+ "columnsFrom": [
2089
+ "environment_id",
2090
+ "project_id"
2091
+ ],
2092
+ "columnsTo": [
2093
+ "id",
2094
+ "project_id"
2095
+ ],
2096
+ "onDelete": "no action",
2097
+ "onUpdate": "no action"
2098
+ }
2099
+ },
2100
+ "compositePrimaryKeys": {},
2101
+ "uniqueConstraints": {},
2102
+ "checkConstraints": {
2103
+ "secrets_key_check": {
2104
+ "name": "secrets_key_check",
2105
+ "value": "length(\"secrets\".\"key\") BETWEEN 1 AND 128 AND \"secrets\".\"key\" GLOB '[A-Za-z_]*' AND \"secrets\".\"key\" NOT GLOB '*[^A-Za-z0-9_]*'"
2106
+ },
2107
+ "secrets_folder_check": {
2108
+ "name": "secrets_folder_check",
2109
+ "value": "\"secrets\".\"folder\" IS NULL OR (length(\"secrets\".\"folder\") BETWEEN 1 AND 64 AND \"secrets\".\"folder\" NOT GLOB '*/*' AND \"secrets\".\"folder\" = trim(\"secrets\".\"folder\"))"
2110
+ }
2111
+ }
2112
+ },
2113
+ "service_bindings": {
2114
+ "name": "service_bindings",
2115
+ "columns": {
2116
+ "id": {
2117
+ "name": "id",
2118
+ "type": "text",
2119
+ "primaryKey": true,
2120
+ "notNull": true,
2121
+ "autoincrement": false
2122
+ },
2123
+ "auth_mac": {
2124
+ "name": "auth_mac",
2125
+ "type": "blob",
2126
+ "primaryKey": false,
2127
+ "notNull": true,
2128
+ "autoincrement": false
2129
+ },
2130
+ "principal": {
2131
+ "name": "principal",
2132
+ "type": "text",
2133
+ "primaryKey": false,
2134
+ "notNull": true,
2135
+ "autoincrement": false
2136
+ },
2137
+ "generation": {
2138
+ "name": "generation",
2139
+ "type": "integer",
2140
+ "primaryKey": false,
2141
+ "notNull": true,
2142
+ "autoincrement": false
2143
+ },
2144
+ "profile": {
2145
+ "name": "profile",
2146
+ "type": "text",
2147
+ "primaryKey": false,
2148
+ "notNull": true,
2149
+ "autoincrement": false
2150
+ },
2151
+ "issuer": {
2152
+ "name": "issuer",
2153
+ "type": "text",
2154
+ "primaryKey": false,
2155
+ "notNull": true,
2156
+ "autoincrement": false
2157
+ },
2158
+ "jwks_uri": {
2159
+ "name": "jwks_uri",
2160
+ "type": "text",
2161
+ "primaryKey": false,
2162
+ "notNull": true,
2163
+ "autoincrement": false
2164
+ },
2165
+ "claims": {
2166
+ "name": "claims",
2167
+ "type": "text",
2168
+ "primaryKey": false,
2169
+ "notNull": true,
2170
+ "autoincrement": false
2171
+ },
2172
+ "label": {
2173
+ "name": "label",
2174
+ "type": "text",
2175
+ "primaryKey": false,
2176
+ "notNull": false,
2177
+ "autoincrement": false
2178
+ },
2179
+ "created_at": {
2180
+ "name": "created_at",
2181
+ "type": "integer",
2182
+ "primaryKey": false,
2183
+ "notNull": true,
2184
+ "autoincrement": false,
2185
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
2186
+ },
2187
+ "created_by": {
2188
+ "name": "created_by",
2189
+ "type": "text",
2190
+ "primaryKey": false,
2191
+ "notNull": true,
2192
+ "autoincrement": false
2193
+ },
2194
+ "last_used_at": {
2195
+ "name": "last_used_at",
2196
+ "type": "integer",
2197
+ "primaryKey": false,
2198
+ "notNull": false,
2199
+ "autoincrement": false
2200
+ },
2201
+ "revoked_at": {
2202
+ "name": "revoked_at",
2203
+ "type": "integer",
2204
+ "primaryKey": false,
2205
+ "notNull": false,
2206
+ "autoincrement": false
2207
+ },
2208
+ "revoked_by": {
2209
+ "name": "revoked_by",
2210
+ "type": "text",
2211
+ "primaryKey": false,
2212
+ "notNull": false,
2213
+ "autoincrement": false
2214
+ }
2215
+ },
2216
+ "indexes": {
2217
+ "service_bindings_principal_idx": {
2218
+ "name": "service_bindings_principal_idx",
2219
+ "columns": [
2220
+ "principal",
2221
+ "issuer"
2222
+ ],
2223
+ "isUnique": false
2224
+ },
2225
+ "service_bindings_live_idx": {
2226
+ "name": "service_bindings_live_idx",
2227
+ "columns": [
2228
+ "principal",
2229
+ "issuer",
2230
+ "generation",
2231
+ "created_at",
2232
+ "id"
2233
+ ],
2234
+ "isUnique": false,
2235
+ "where": "\"service_bindings\".\"revoked_at\" IS NULL"
2236
+ }
2237
+ },
2238
+ "foreignKeys": {
2239
+ "service_bindings_principal_fkey": {
2240
+ "name": "service_bindings_principal_fkey",
2241
+ "tableFrom": "service_bindings",
2242
+ "tableTo": "vault_members",
2243
+ "columnsFrom": [
2244
+ "principal"
2245
+ ],
2246
+ "columnsTo": [
2247
+ "principal"
2248
+ ],
2249
+ "onDelete": "restrict",
2250
+ "onUpdate": "no action"
2251
+ }
2252
+ },
2253
+ "compositePrimaryKeys": {},
2254
+ "uniqueConstraints": {},
2255
+ "checkConstraints": {
2256
+ "service_bindings_principal_check": {
2257
+ "name": "service_bindings_principal_check",
2258
+ "value": "\"service_bindings\".\"principal\" LIKE 'token:%'"
2259
+ },
2260
+ "service_bindings_auth_mac_check": {
2261
+ "name": "service_bindings_auth_mac_check",
2262
+ "value": "octet_length(\"service_bindings\".\"auth_mac\") = 32"
2263
+ },
2264
+ "service_bindings_claims_check": {
2265
+ "name": "service_bindings_claims_check",
2266
+ "value": "json_valid(\"service_bindings\".\"claims\")"
2267
+ }
2268
+ }
2269
+ },
2270
+ "vault_grants": {
2271
+ "name": "vault_grants",
2272
+ "columns": {
2273
+ "principal": {
2274
+ "name": "principal",
2275
+ "type": "text",
2276
+ "primaryKey": false,
2277
+ "notNull": true,
2278
+ "autoincrement": false
2279
+ },
2280
+ "project_id": {
2281
+ "name": "project_id",
2282
+ "type": "text",
2283
+ "primaryKey": false,
2284
+ "notNull": false,
2285
+ "autoincrement": false
2286
+ },
2287
+ "environment_id": {
2288
+ "name": "environment_id",
2289
+ "type": "text",
2290
+ "primaryKey": false,
2291
+ "notNull": false,
2292
+ "autoincrement": false
2293
+ },
2294
+ "environment_slug": {
2295
+ "name": "environment_slug",
2296
+ "type": "text",
2297
+ "primaryKey": false,
2298
+ "notNull": false,
2299
+ "autoincrement": false
2300
+ },
2301
+ "role": {
2302
+ "name": "role",
2303
+ "type": "text",
2304
+ "primaryKey": false,
2305
+ "notNull": true,
2306
+ "autoincrement": false
2307
+ },
2308
+ "expires_at": {
2309
+ "name": "expires_at",
2310
+ "type": "integer",
2311
+ "primaryKey": false,
2312
+ "notNull": false,
2313
+ "autoincrement": false
2314
+ },
2315
+ "granted_at": {
2316
+ "name": "granted_at",
2317
+ "type": "integer",
2318
+ "primaryKey": false,
2319
+ "notNull": true,
2320
+ "autoincrement": false
2321
+ },
2322
+ "granted_by": {
2323
+ "name": "granted_by",
2324
+ "type": "text",
2325
+ "primaryKey": false,
2326
+ "notNull": true,
2327
+ "autoincrement": false
2328
+ }
2329
+ },
2330
+ "indexes": {
2331
+ "vault_grants_on_every_project": {
2332
+ "name": "vault_grants_on_every_project",
2333
+ "columns": [
2334
+ "principal"
2335
+ ],
2336
+ "isUnique": true,
2337
+ "where": "\"vault_grants\".\"project_id\" IS NULL AND \"vault_grants\".\"environment_id\" IS NULL AND \"vault_grants\".\"environment_slug\" IS NULL"
2338
+ },
2339
+ "vault_grants_on_project": {
2340
+ "name": "vault_grants_on_project",
2341
+ "columns": [
2342
+ "principal",
2343
+ "project_id"
2344
+ ],
2345
+ "isUnique": true
2346
+ },
2347
+ "vault_grants_on_environment": {
2348
+ "name": "vault_grants_on_environment",
2349
+ "columns": [
2350
+ "principal",
2351
+ "environment_id"
2352
+ ],
2353
+ "isUnique": true
2354
+ },
2355
+ "vault_grants_on_environment_slug": {
2356
+ "name": "vault_grants_on_environment_slug",
2357
+ "columns": [
2358
+ "principal",
2359
+ "environment_slug"
2360
+ ],
2361
+ "isUnique": true
2362
+ }
2363
+ },
2364
+ "foreignKeys": {
2365
+ "vault_grants_principal_fkey": {
2366
+ "name": "vault_grants_principal_fkey",
2367
+ "tableFrom": "vault_grants",
2368
+ "tableTo": "vault_members",
2369
+ "columnsFrom": [
2370
+ "principal"
2371
+ ],
2372
+ "columnsTo": [
2373
+ "principal"
2374
+ ],
2375
+ "onDelete": "restrict",
2376
+ "onUpdate": "no action"
2377
+ },
2378
+ "vault_grants_project_id_fkey": {
2379
+ "name": "vault_grants_project_id_fkey",
2380
+ "tableFrom": "vault_grants",
2381
+ "tableTo": "projects",
2382
+ "columnsFrom": [
2383
+ "project_id"
2384
+ ],
2385
+ "columnsTo": [
2386
+ "id"
2387
+ ],
2388
+ "onDelete": "restrict",
2389
+ "onUpdate": "no action"
2390
+ },
2391
+ "vault_grants_environment_id_fkey": {
2392
+ "name": "vault_grants_environment_id_fkey",
2393
+ "tableFrom": "vault_grants",
2394
+ "tableTo": "environments",
2395
+ "columnsFrom": [
2396
+ "environment_id"
2397
+ ],
2398
+ "columnsTo": [
2399
+ "id"
2400
+ ],
2401
+ "onDelete": "restrict",
2402
+ "onUpdate": "no action"
2403
+ }
2404
+ },
2405
+ "compositePrimaryKeys": {},
2406
+ "uniqueConstraints": {},
2407
+ "checkConstraints": {
2408
+ "vault_grants_one_place": {
2409
+ "name": "vault_grants_one_place",
2410
+ "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)"
2411
+ },
2412
+ "vault_grants_environment_slug_check": {
2413
+ "name": "vault_grants_environment_slug_check",
2414
+ "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-]*')"
2415
+ },
2416
+ "vault_grants_role_check": {
2417
+ "name": "vault_grants_role_check",
2418
+ "value": "\"vault_grants\".\"role\" IN ('viewer', 'developer', 'maintainer', 'access-manager', 'auditor', 'owner')"
2419
+ },
2420
+ "vault_grants_environment_role_check": {
2421
+ "name": "vault_grants_environment_role_check",
2422
+ "value": "(\"vault_grants\".\"environment_id\" IS NULL AND \"vault_grants\".\"environment_slug\" IS NULL) OR \"vault_grants\".\"role\" IN ('viewer', 'developer', 'auditor')"
2423
+ }
2424
+ }
2425
+ },
2426
+ "vault_members": {
2427
+ "name": "vault_members",
2428
+ "columns": {
2429
+ "principal": {
2430
+ "name": "principal",
2431
+ "type": "text",
2432
+ "primaryKey": true,
2433
+ "notNull": true,
2434
+ "autoincrement": false
2435
+ },
2436
+ "status": {
2437
+ "name": "status",
2438
+ "type": "text",
2439
+ "primaryKey": false,
2440
+ "notNull": true,
2441
+ "autoincrement": false
2442
+ },
2443
+ "owner": {
2444
+ "name": "owner",
2445
+ "type": "integer",
2446
+ "primaryKey": false,
2447
+ "notNull": true,
2448
+ "autoincrement": false,
2449
+ "default": false
2450
+ },
2451
+ "role": {
2452
+ "name": "role",
2453
+ "type": "text",
2454
+ "primaryKey": false,
2455
+ "notNull": false,
2456
+ "autoincrement": false
2457
+ },
2458
+ "scope": {
2459
+ "name": "scope",
2460
+ "type": "text",
2461
+ "primaryKey": false,
2462
+ "notNull": false,
2463
+ "autoincrement": false
2464
+ },
2465
+ "generation": {
2466
+ "name": "generation",
2467
+ "type": "integer",
2468
+ "primaryKey": false,
2469
+ "notNull": true,
2470
+ "autoincrement": false,
2471
+ "default": 0
2472
+ },
2473
+ "created_at": {
2474
+ "name": "created_at",
2475
+ "type": "integer",
2476
+ "primaryKey": false,
2477
+ "notNull": true,
2478
+ "autoincrement": false
2479
+ },
2480
+ "created_by": {
2481
+ "name": "created_by",
2482
+ "type": "text",
2483
+ "primaryKey": false,
2484
+ "notNull": true,
2485
+ "autoincrement": false
2486
+ },
2487
+ "status_changed_at": {
2488
+ "name": "status_changed_at",
2489
+ "type": "integer",
2490
+ "primaryKey": false,
2491
+ "notNull": true,
2492
+ "autoincrement": false
2493
+ },
2494
+ "status_changed_by": {
2495
+ "name": "status_changed_by",
2496
+ "type": "text",
2497
+ "primaryKey": false,
2498
+ "notNull": true,
2499
+ "autoincrement": false
2500
+ },
2501
+ "access_seq": {
2502
+ "name": "access_seq",
2503
+ "type": "integer",
2504
+ "primaryKey": false,
2505
+ "notNull": true,
2506
+ "autoincrement": false
2507
+ },
2508
+ "mac": {
2509
+ "name": "mac",
2510
+ "type": "blob",
2511
+ "primaryKey": false,
2512
+ "notNull": true,
2513
+ "autoincrement": false
2514
+ }
2515
+ },
2516
+ "indexes": {},
2517
+ "foreignKeys": {},
2518
+ "compositePrimaryKeys": {},
2519
+ "uniqueConstraints": {},
2520
+ "checkConstraints": {
2521
+ "vault_members_mac_check": {
2522
+ "name": "vault_members_mac_check",
2523
+ "value": "octet_length(\"vault_members\".\"mac\") = 32"
2524
+ },
2525
+ "vault_members_principal_check": {
2526
+ "name": "vault_members_principal_check",
2527
+ "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"
2528
+ },
2529
+ "vault_members_user_lowercase": {
2530
+ "name": "vault_members_user_lowercase",
2531
+ "value": "\"vault_members\".\"principal\" NOT LIKE 'user:%' OR \"vault_members\".\"principal\" = lower(\"vault_members\".\"principal\")"
2532
+ },
2533
+ "vault_members_status_check": {
2534
+ "name": "vault_members_status_check",
2535
+ "value": "\"vault_members\".\"status\" IN ('active', 'removed')"
2536
+ },
2537
+ "vault_members_owner_check": {
2538
+ "name": "vault_members_owner_check",
2539
+ "value": "NOT \"vault_members\".\"owner\" OR (\"vault_members\".\"status\" = 'active' AND \"vault_members\".\"principal\" LIKE 'user:%')"
2540
+ },
2541
+ "vault_members_generation_check": {
2542
+ "name": "vault_members_generation_check",
2543
+ "value": "\"vault_members\".\"generation\" >= 0"
2544
+ }
2545
+ }
2546
+ }
2547
+ },
2548
+ "views": {},
2549
+ "enums": {},
2550
+ "_meta": {
2551
+ "schemas": {},
2552
+ "tables": {},
2553
+ "columns": {}
2554
+ },
2555
+ "internal": {
2556
+ "indexes": {
2557
+ "audit_log_unbind_idx": {
2558
+ "columns": {
2559
+ "json_extract(\"metadata\", '$.bindingId')": {
2560
+ "isExpression": true
2561
+ }
2562
+ }
2563
+ },
2564
+ "audit_log_exchange_idx": {
2565
+ "columns": {
2566
+ "json_extract(\"metadata\", '$.credentialId')": {
2567
+ "isExpression": true
2568
+ }
2569
+ }
2570
+ },
2571
+ "audit_log_also_project_idx": {
2572
+ "columns": {
2573
+ "json_extract(\"metadata\", '$.also.projectId')": {
2574
+ "isExpression": true
2575
+ }
2576
+ }
2577
+ },
2578
+ "audit_log_also_environment_idx": {
2579
+ "columns": {
2580
+ "json_extract(\"metadata\", '$.also.environmentId')": {
2581
+ "isExpression": true
2582
+ }
2583
+ }
2584
+ },
2585
+ "audit_log_also_secret_idx": {
2586
+ "columns": {
2587
+ "json_extract(\"metadata\", '$.also.secretId')": {
2588
+ "isExpression": true
2589
+ }
2590
+ }
2591
+ }
2592
+ }
2593
+ }
2594
+ }