@coffre/db 0.4.6 → 0.5.1

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 (45) 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/migrate.d.ts +41 -4
  11. package/dist/migrate.js +95 -8
  12. package/dist/migrations/postgres/0002_instance_roles.sql +4 -0
  13. package/dist/migrations/postgres/0003_credential_scopes.sql +4 -0
  14. package/dist/migrations/postgres/meta/0002_snapshot.json +2860 -0
  15. package/dist/migrations/postgres/meta/0003_snapshot.json +2872 -0
  16. package/dist/migrations/postgres/meta/_journal.json +14 -0
  17. package/dist/migrations/sqlite/0002_instance_roles.sql +2 -0
  18. package/dist/migrations/sqlite/0003_credential_scopes.sql +2 -0
  19. package/dist/migrations/sqlite/meta/0002_snapshot.json +2594 -0
  20. package/dist/migrations/sqlite/meta/0003_snapshot.json +2608 -0
  21. package/dist/migrations/sqlite/meta/_journal.json +14 -0
  22. package/dist/portable.d.ts +2 -2
  23. package/dist/{schema-BqCB3XFm.d.ts → schema-a7PkFgea.d.ts} +68 -0
  24. package/dist/schema-sqlite.d.ts +76 -0
  25. package/dist/schema-sqlite.js +4 -0
  26. package/dist/schema-version.d.ts +1 -1
  27. package/dist/schema-version.js +60 -26
  28. package/dist/schema.d.ts +1 -1
  29. package/dist/schema.js +4 -0
  30. package/package.json +2 -2
  31. package/src/grants.ts +272 -11
  32. package/src/log.ts +66 -2
  33. package/src/migrate.ts +111 -6
  34. package/src/migrations/postgres/0002_instance_roles.sql +4 -0
  35. package/src/migrations/postgres/0003_credential_scopes.sql +4 -0
  36. package/src/migrations/postgres/meta/0002_snapshot.json +2860 -0
  37. package/src/migrations/postgres/meta/0003_snapshot.json +2872 -0
  38. package/src/migrations/postgres/meta/_journal.json +14 -0
  39. package/src/migrations/sqlite/0002_instance_roles.sql +2 -0
  40. package/src/migrations/sqlite/0003_credential_scopes.sql +2 -0
  41. package/src/migrations/sqlite/meta/0002_snapshot.json +2594 -0
  42. package/src/migrations/sqlite/meta/0003_snapshot.json +2608 -0
  43. package/src/migrations/sqlite/meta/_journal.json +14 -0
  44. package/src/schema.sqlite.ts +6 -0
  45. package/src/schema.ts +11 -1
@@ -0,0 +1,2608 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "e88f495b-b45b-45f9-a361-e1b224e6ecfe",
5
+ "prevId": "583d0c84-fcb4-412c-9862-dc67b3a018ee",
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
+ },
945
+ "indexes": {
946
+ "environments_project_id_slug_key": {
947
+ "name": "environments_project_id_slug_key",
948
+ "columns": [
949
+ "project_id",
950
+ "slug"
951
+ ],
952
+ "isUnique": true
953
+ },
954
+ "environments_project_scoped": {
955
+ "name": "environments_project_scoped",
956
+ "columns": [
957
+ "id",
958
+ "project_id"
959
+ ],
960
+ "isUnique": true
961
+ }
962
+ },
963
+ "foreignKeys": {
964
+ "environments_project_id_fkey": {
965
+ "name": "environments_project_id_fkey",
966
+ "tableFrom": "environments",
967
+ "tableTo": "projects",
968
+ "columnsFrom": [
969
+ "project_id"
970
+ ],
971
+ "columnsTo": [
972
+ "id"
973
+ ],
974
+ "onDelete": "restrict",
975
+ "onUpdate": "no action"
976
+ }
977
+ },
978
+ "compositePrimaryKeys": {},
979
+ "uniqueConstraints": {},
980
+ "checkConstraints": {
981
+ "environments_slug_check": {
982
+ "name": "environments_slug_check",
983
+ "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-]*')"
984
+ }
985
+ }
986
+ },
987
+ "identities": {
988
+ "name": "identities",
989
+ "columns": {
990
+ "id": {
991
+ "name": "id",
992
+ "type": "text",
993
+ "primaryKey": true,
994
+ "notNull": true,
995
+ "autoincrement": false
996
+ },
997
+ "provider": {
998
+ "name": "provider",
999
+ "type": "text",
1000
+ "primaryKey": false,
1001
+ "notNull": true,
1002
+ "autoincrement": false
1003
+ },
1004
+ "auth_mac": {
1005
+ "name": "auth_mac",
1006
+ "type": "blob",
1007
+ "primaryKey": false,
1008
+ "notNull": true,
1009
+ "autoincrement": false
1010
+ },
1011
+ "subject": {
1012
+ "name": "subject",
1013
+ "type": "text",
1014
+ "primaryKey": false,
1015
+ "notNull": true,
1016
+ "autoincrement": false
1017
+ },
1018
+ "issuer_hash": {
1019
+ "name": "issuer_hash",
1020
+ "type": "text",
1021
+ "primaryKey": false,
1022
+ "notNull": true,
1023
+ "autoincrement": false
1024
+ },
1025
+ "generation": {
1026
+ "name": "generation",
1027
+ "type": "integer",
1028
+ "primaryKey": false,
1029
+ "notNull": true,
1030
+ "autoincrement": false
1031
+ },
1032
+ "principal": {
1033
+ "name": "principal",
1034
+ "type": "text",
1035
+ "primaryKey": false,
1036
+ "notNull": true,
1037
+ "autoincrement": false
1038
+ },
1039
+ "email": {
1040
+ "name": "email",
1041
+ "type": "text",
1042
+ "primaryKey": false,
1043
+ "notNull": false,
1044
+ "autoincrement": false
1045
+ },
1046
+ "created_at": {
1047
+ "name": "created_at",
1048
+ "type": "integer",
1049
+ "primaryKey": false,
1050
+ "notNull": true,
1051
+ "autoincrement": false,
1052
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1053
+ },
1054
+ "created_by": {
1055
+ "name": "created_by",
1056
+ "type": "text",
1057
+ "primaryKey": false,
1058
+ "notNull": true,
1059
+ "autoincrement": false
1060
+ },
1061
+ "last_sign_in_at": {
1062
+ "name": "last_sign_in_at",
1063
+ "type": "integer",
1064
+ "primaryKey": false,
1065
+ "notNull": false,
1066
+ "autoincrement": false
1067
+ },
1068
+ "revoked_at": {
1069
+ "name": "revoked_at",
1070
+ "type": "integer",
1071
+ "primaryKey": false,
1072
+ "notNull": false,
1073
+ "autoincrement": false
1074
+ },
1075
+ "revoked_by": {
1076
+ "name": "revoked_by",
1077
+ "type": "text",
1078
+ "primaryKey": false,
1079
+ "notNull": false,
1080
+ "autoincrement": false
1081
+ },
1082
+ "active_subject": {
1083
+ "name": "active_subject",
1084
+ "type": "text",
1085
+ "primaryKey": false,
1086
+ "notNull": false,
1087
+ "autoincrement": false,
1088
+ "generated": {
1089
+ "as": "(CASE WHEN revoked_at IS NULL THEN subject END)",
1090
+ "type": "stored"
1091
+ }
1092
+ }
1093
+ },
1094
+ "indexes": {
1095
+ "identities_active_subject": {
1096
+ "name": "identities_active_subject",
1097
+ "columns": [
1098
+ "provider",
1099
+ "issuer_hash",
1100
+ "active_subject"
1101
+ ],
1102
+ "isUnique": true
1103
+ },
1104
+ "identities_principal_idx": {
1105
+ "name": "identities_principal_idx",
1106
+ "columns": [
1107
+ "principal",
1108
+ "generation"
1109
+ ],
1110
+ "isUnique": false
1111
+ },
1112
+ "identities_member_generation_key": {
1113
+ "name": "identities_member_generation_key",
1114
+ "columns": [
1115
+ "id",
1116
+ "principal",
1117
+ "generation"
1118
+ ],
1119
+ "isUnique": true
1120
+ }
1121
+ },
1122
+ "foreignKeys": {
1123
+ "identities_principal_fkey": {
1124
+ "name": "identities_principal_fkey",
1125
+ "tableFrom": "identities",
1126
+ "tableTo": "vault_members",
1127
+ "columnsFrom": [
1128
+ "principal"
1129
+ ],
1130
+ "columnsTo": [
1131
+ "principal"
1132
+ ],
1133
+ "onDelete": "restrict",
1134
+ "onUpdate": "no action"
1135
+ }
1136
+ },
1137
+ "compositePrimaryKeys": {},
1138
+ "uniqueConstraints": {},
1139
+ "checkConstraints": {
1140
+ "identities_principal_check": {
1141
+ "name": "identities_principal_check",
1142
+ "value": "\"identities\".\"principal\" LIKE 'user:%'"
1143
+ },
1144
+ "identities_provider_check": {
1145
+ "name": "identities_provider_check",
1146
+ "value": "length(\"identities\".\"provider\") BETWEEN 1 AND 32 AND \"identities\".\"provider\" GLOB '[a-z0-9]*' AND \"identities\".\"provider\" NOT GLOB '*[^a-z0-9-]*'"
1147
+ },
1148
+ "identities_auth_mac_check": {
1149
+ "name": "identities_auth_mac_check",
1150
+ "value": "octet_length(\"identities\".\"auth_mac\") = 32"
1151
+ }
1152
+ }
1153
+ },
1154
+ "mcp_approvals": {
1155
+ "name": "mcp_approvals",
1156
+ "columns": {
1157
+ "id": {
1158
+ "name": "id",
1159
+ "type": "text",
1160
+ "primaryKey": true,
1161
+ "notNull": true,
1162
+ "autoincrement": false
1163
+ },
1164
+ "connection_id": {
1165
+ "name": "connection_id",
1166
+ "type": "text",
1167
+ "primaryKey": false,
1168
+ "notNull": true,
1169
+ "autoincrement": false
1170
+ },
1171
+ "tool": {
1172
+ "name": "tool",
1173
+ "type": "text",
1174
+ "primaryKey": false,
1175
+ "notNull": true,
1176
+ "autoincrement": false
1177
+ },
1178
+ "arguments": {
1179
+ "name": "arguments",
1180
+ "type": "text",
1181
+ "primaryKey": false,
1182
+ "notNull": true,
1183
+ "autoincrement": false
1184
+ },
1185
+ "digest": {
1186
+ "name": "digest",
1187
+ "type": "blob",
1188
+ "primaryKey": false,
1189
+ "notNull": true,
1190
+ "autoincrement": false
1191
+ },
1192
+ "status": {
1193
+ "name": "status",
1194
+ "type": "text",
1195
+ "primaryKey": false,
1196
+ "notNull": true,
1197
+ "autoincrement": false,
1198
+ "default": "'pending'"
1199
+ },
1200
+ "outcome": {
1201
+ "name": "outcome",
1202
+ "type": "text",
1203
+ "primaryKey": false,
1204
+ "notNull": false,
1205
+ "autoincrement": false
1206
+ },
1207
+ "created_at": {
1208
+ "name": "created_at",
1209
+ "type": "integer",
1210
+ "primaryKey": false,
1211
+ "notNull": true,
1212
+ "autoincrement": false,
1213
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1214
+ },
1215
+ "expires_at": {
1216
+ "name": "expires_at",
1217
+ "type": "integer",
1218
+ "primaryKey": false,
1219
+ "notNull": true,
1220
+ "autoincrement": false
1221
+ },
1222
+ "decided_at": {
1223
+ "name": "decided_at",
1224
+ "type": "integer",
1225
+ "primaryKey": false,
1226
+ "notNull": false,
1227
+ "autoincrement": false
1228
+ },
1229
+ "reported_at": {
1230
+ "name": "reported_at",
1231
+ "type": "integer",
1232
+ "primaryKey": false,
1233
+ "notNull": false,
1234
+ "autoincrement": false
1235
+ }
1236
+ },
1237
+ "indexes": {
1238
+ "mcp_approvals_open_idx": {
1239
+ "name": "mcp_approvals_open_idx",
1240
+ "columns": [
1241
+ "connection_id",
1242
+ "digest"
1243
+ ],
1244
+ "isUnique": false,
1245
+ "where": "\"mcp_approvals\".\"reported_at\" IS NULL"
1246
+ }
1247
+ },
1248
+ "foreignKeys": {
1249
+ "mcp_approvals_connection_fkey": {
1250
+ "name": "mcp_approvals_connection_fkey",
1251
+ "tableFrom": "mcp_approvals",
1252
+ "tableTo": "mcp_connections",
1253
+ "columnsFrom": [
1254
+ "connection_id"
1255
+ ],
1256
+ "columnsTo": [
1257
+ "id"
1258
+ ],
1259
+ "onDelete": "restrict",
1260
+ "onUpdate": "no action"
1261
+ }
1262
+ },
1263
+ "compositePrimaryKeys": {},
1264
+ "uniqueConstraints": {},
1265
+ "checkConstraints": {
1266
+ "mcp_approvals_status_check": {
1267
+ "name": "mcp_approvals_status_check",
1268
+ "value": "\"mcp_approvals\".\"status\" IN ('pending', 'approved', 'denied', 'cancelled', 'failed')"
1269
+ },
1270
+ "mcp_approvals_digest_check": {
1271
+ "name": "mcp_approvals_digest_check",
1272
+ "value": "octet_length(\"mcp_approvals\".\"digest\") = 32"
1273
+ },
1274
+ "mcp_approvals_arguments_check": {
1275
+ "name": "mcp_approvals_arguments_check",
1276
+ "value": "json_valid(\"mcp_approvals\".\"arguments\")"
1277
+ }
1278
+ }
1279
+ },
1280
+ "mcp_connections": {
1281
+ "name": "mcp_connections",
1282
+ "columns": {
1283
+ "id": {
1284
+ "name": "id",
1285
+ "type": "text",
1286
+ "primaryKey": true,
1287
+ "notNull": true,
1288
+ "autoincrement": false
1289
+ },
1290
+ "auth_mac": {
1291
+ "name": "auth_mac",
1292
+ "type": "blob",
1293
+ "primaryKey": false,
1294
+ "notNull": true,
1295
+ "autoincrement": false
1296
+ },
1297
+ "principal": {
1298
+ "name": "principal",
1299
+ "type": "text",
1300
+ "primaryKey": false,
1301
+ "notNull": true,
1302
+ "autoincrement": false
1303
+ },
1304
+ "generation": {
1305
+ "name": "generation",
1306
+ "type": "integer",
1307
+ "primaryKey": false,
1308
+ "notNull": true,
1309
+ "autoincrement": false
1310
+ },
1311
+ "client_id": {
1312
+ "name": "client_id",
1313
+ "type": "text",
1314
+ "primaryKey": false,
1315
+ "notNull": true,
1316
+ "autoincrement": false
1317
+ },
1318
+ "client_name": {
1319
+ "name": "client_name",
1320
+ "type": "text",
1321
+ "primaryKey": false,
1322
+ "notNull": true,
1323
+ "autoincrement": false
1324
+ },
1325
+ "client_host": {
1326
+ "name": "client_host",
1327
+ "type": "text",
1328
+ "primaryKey": false,
1329
+ "notNull": false,
1330
+ "autoincrement": false
1331
+ },
1332
+ "registration": {
1333
+ "name": "registration",
1334
+ "type": "text",
1335
+ "primaryKey": false,
1336
+ "notNull": true,
1337
+ "autoincrement": false
1338
+ },
1339
+ "scopes": {
1340
+ "name": "scopes",
1341
+ "type": "text",
1342
+ "primaryKey": false,
1343
+ "notNull": true,
1344
+ "autoincrement": false
1345
+ },
1346
+ "redirect_uri": {
1347
+ "name": "redirect_uri",
1348
+ "type": "text",
1349
+ "primaryKey": false,
1350
+ "notNull": true,
1351
+ "autoincrement": false
1352
+ },
1353
+ "code_hash": {
1354
+ "name": "code_hash",
1355
+ "type": "blob",
1356
+ "primaryKey": false,
1357
+ "notNull": false,
1358
+ "autoincrement": false
1359
+ },
1360
+ "code_challenge": {
1361
+ "name": "code_challenge",
1362
+ "type": "text",
1363
+ "primaryKey": false,
1364
+ "notNull": false,
1365
+ "autoincrement": false
1366
+ },
1367
+ "code_expires_at": {
1368
+ "name": "code_expires_at",
1369
+ "type": "integer",
1370
+ "primaryKey": false,
1371
+ "notNull": false,
1372
+ "autoincrement": false
1373
+ },
1374
+ "refresh_hash": {
1375
+ "name": "refresh_hash",
1376
+ "type": "blob",
1377
+ "primaryKey": false,
1378
+ "notNull": false,
1379
+ "autoincrement": false
1380
+ },
1381
+ "refresh_previous_hash": {
1382
+ "name": "refresh_previous_hash",
1383
+ "type": "blob",
1384
+ "primaryKey": false,
1385
+ "notNull": false,
1386
+ "autoincrement": false
1387
+ },
1388
+ "expires_at": {
1389
+ "name": "expires_at",
1390
+ "type": "integer",
1391
+ "primaryKey": false,
1392
+ "notNull": true,
1393
+ "autoincrement": false
1394
+ },
1395
+ "created_at": {
1396
+ "name": "created_at",
1397
+ "type": "integer",
1398
+ "primaryKey": false,
1399
+ "notNull": true,
1400
+ "autoincrement": false,
1401
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1402
+ },
1403
+ "last_used_at": {
1404
+ "name": "last_used_at",
1405
+ "type": "integer",
1406
+ "primaryKey": false,
1407
+ "notNull": false,
1408
+ "autoincrement": false
1409
+ },
1410
+ "last_used_ip": {
1411
+ "name": "last_used_ip",
1412
+ "type": "text",
1413
+ "primaryKey": false,
1414
+ "notNull": false,
1415
+ "autoincrement": false
1416
+ },
1417
+ "revoked_at": {
1418
+ "name": "revoked_at",
1419
+ "type": "integer",
1420
+ "primaryKey": false,
1421
+ "notNull": false,
1422
+ "autoincrement": false
1423
+ },
1424
+ "revoked_by": {
1425
+ "name": "revoked_by",
1426
+ "type": "text",
1427
+ "primaryKey": false,
1428
+ "notNull": false,
1429
+ "autoincrement": false
1430
+ }
1431
+ },
1432
+ "indexes": {
1433
+ "mcp_connections_refresh_previous_idx": {
1434
+ "name": "mcp_connections_refresh_previous_idx",
1435
+ "columns": [
1436
+ "refresh_previous_hash"
1437
+ ],
1438
+ "isUnique": false
1439
+ },
1440
+ "mcp_connections_live_idx": {
1441
+ "name": "mcp_connections_live_idx",
1442
+ "columns": [
1443
+ "principal",
1444
+ "expires_at"
1445
+ ],
1446
+ "isUnique": false,
1447
+ "where": "\"mcp_connections\".\"revoked_at\" IS NULL"
1448
+ },
1449
+ "mcp_connections_code_hash_key": {
1450
+ "name": "mcp_connections_code_hash_key",
1451
+ "columns": [
1452
+ "code_hash"
1453
+ ],
1454
+ "isUnique": true
1455
+ },
1456
+ "mcp_connections_refresh_hash_key": {
1457
+ "name": "mcp_connections_refresh_hash_key",
1458
+ "columns": [
1459
+ "refresh_hash"
1460
+ ],
1461
+ "isUnique": true
1462
+ }
1463
+ },
1464
+ "foreignKeys": {
1465
+ "mcp_connections_principal_fkey": {
1466
+ "name": "mcp_connections_principal_fkey",
1467
+ "tableFrom": "mcp_connections",
1468
+ "tableTo": "vault_members",
1469
+ "columnsFrom": [
1470
+ "principal"
1471
+ ],
1472
+ "columnsTo": [
1473
+ "principal"
1474
+ ],
1475
+ "onDelete": "restrict",
1476
+ "onUpdate": "no action"
1477
+ }
1478
+ },
1479
+ "compositePrimaryKeys": {},
1480
+ "uniqueConstraints": {},
1481
+ "checkConstraints": {
1482
+ "mcp_connections_principal_check": {
1483
+ "name": "mcp_connections_principal_check",
1484
+ "value": "\"mcp_connections\".\"principal\" LIKE 'user:%'"
1485
+ },
1486
+ "mcp_connections_registration_check": {
1487
+ "name": "mcp_connections_registration_check",
1488
+ "value": "\"mcp_connections\".\"registration\" IN ('cimd', 'dcr')"
1489
+ },
1490
+ "mcp_connections_auth_mac_check": {
1491
+ "name": "mcp_connections_auth_mac_check",
1492
+ "value": "octet_length(\"mcp_connections\".\"auth_mac\") = 32"
1493
+ },
1494
+ "mcp_connections_code_hash_check": {
1495
+ "name": "mcp_connections_code_hash_check",
1496
+ "value": "\"mcp_connections\".\"code_hash\" IS NULL OR octet_length(\"mcp_connections\".\"code_hash\") = 32"
1497
+ },
1498
+ "mcp_connections_refresh_hash_check": {
1499
+ "name": "mcp_connections_refresh_hash_check",
1500
+ "value": "\"mcp_connections\".\"refresh_hash\" IS NULL OR octet_length(\"mcp_connections\".\"refresh_hash\") = 32"
1501
+ }
1502
+ }
1503
+ },
1504
+ "oauth_clients": {
1505
+ "name": "oauth_clients",
1506
+ "columns": {
1507
+ "id": {
1508
+ "name": "id",
1509
+ "type": "text",
1510
+ "primaryKey": true,
1511
+ "notNull": true,
1512
+ "autoincrement": false
1513
+ },
1514
+ "auth_mac": {
1515
+ "name": "auth_mac",
1516
+ "type": "blob",
1517
+ "primaryKey": false,
1518
+ "notNull": true,
1519
+ "autoincrement": false
1520
+ },
1521
+ "name": {
1522
+ "name": "name",
1523
+ "type": "text",
1524
+ "primaryKey": false,
1525
+ "notNull": true,
1526
+ "autoincrement": false
1527
+ },
1528
+ "redirect_uris": {
1529
+ "name": "redirect_uris",
1530
+ "type": "text",
1531
+ "primaryKey": false,
1532
+ "notNull": true,
1533
+ "autoincrement": false
1534
+ },
1535
+ "created_at": {
1536
+ "name": "created_at",
1537
+ "type": "integer",
1538
+ "primaryKey": false,
1539
+ "notNull": true,
1540
+ "autoincrement": false,
1541
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1542
+ },
1543
+ "created_ip": {
1544
+ "name": "created_ip",
1545
+ "type": "text",
1546
+ "primaryKey": false,
1547
+ "notNull": false,
1548
+ "autoincrement": false
1549
+ },
1550
+ "revoked_at": {
1551
+ "name": "revoked_at",
1552
+ "type": "integer",
1553
+ "primaryKey": false,
1554
+ "notNull": false,
1555
+ "autoincrement": false
1556
+ }
1557
+ },
1558
+ "indexes": {},
1559
+ "foreignKeys": {},
1560
+ "compositePrimaryKeys": {},
1561
+ "uniqueConstraints": {},
1562
+ "checkConstraints": {
1563
+ "oauth_clients_auth_mac_check": {
1564
+ "name": "oauth_clients_auth_mac_check",
1565
+ "value": "octet_length(\"oauth_clients\".\"auth_mac\") = 32"
1566
+ },
1567
+ "oauth_clients_redirect_uris_check": {
1568
+ "name": "oauth_clients_redirect_uris_check",
1569
+ "value": "json_valid(\"oauth_clients\".\"redirect_uris\")"
1570
+ }
1571
+ }
1572
+ },
1573
+ "projects": {
1574
+ "name": "projects",
1575
+ "columns": {
1576
+ "id": {
1577
+ "name": "id",
1578
+ "type": "text",
1579
+ "primaryKey": true,
1580
+ "notNull": true,
1581
+ "autoincrement": false
1582
+ },
1583
+ "slug": {
1584
+ "name": "slug",
1585
+ "type": "text",
1586
+ "primaryKey": false,
1587
+ "notNull": true,
1588
+ "autoincrement": false
1589
+ },
1590
+ "name": {
1591
+ "name": "name",
1592
+ "type": "text",
1593
+ "primaryKey": false,
1594
+ "notNull": true,
1595
+ "autoincrement": false
1596
+ },
1597
+ "created_at": {
1598
+ "name": "created_at",
1599
+ "type": "integer",
1600
+ "primaryKey": false,
1601
+ "notNull": true,
1602
+ "autoincrement": false,
1603
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1604
+ },
1605
+ "archived_at": {
1606
+ "name": "archived_at",
1607
+ "type": "integer",
1608
+ "primaryKey": false,
1609
+ "notNull": false,
1610
+ "autoincrement": false
1611
+ },
1612
+ "folder": {
1613
+ "name": "folder",
1614
+ "type": "text",
1615
+ "primaryKey": false,
1616
+ "notNull": false,
1617
+ "autoincrement": false
1618
+ }
1619
+ },
1620
+ "indexes": {
1621
+ "projects_slug_key": {
1622
+ "name": "projects_slug_key",
1623
+ "columns": [
1624
+ "slug"
1625
+ ],
1626
+ "isUnique": true
1627
+ }
1628
+ },
1629
+ "foreignKeys": {},
1630
+ "compositePrimaryKeys": {},
1631
+ "uniqueConstraints": {},
1632
+ "checkConstraints": {
1633
+ "projects_slug_check": {
1634
+ "name": "projects_slug_check",
1635
+ "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-]*')"
1636
+ },
1637
+ "projects_folder_check": {
1638
+ "name": "projects_folder_check",
1639
+ "value": "\"projects\".\"folder\" IS NULL OR (length(\"projects\".\"folder\") BETWEEN 1 AND 64 AND \"projects\".\"folder\" NOT GLOB '*/*' AND \"projects\".\"folder\" = trim(\"projects\".\"folder\"))"
1640
+ }
1641
+ }
1642
+ },
1643
+ "secret_references": {
1644
+ "name": "secret_references",
1645
+ "columns": {
1646
+ "id": {
1647
+ "name": "id",
1648
+ "type": "text",
1649
+ "primaryKey": true,
1650
+ "notNull": true,
1651
+ "autoincrement": false
1652
+ },
1653
+ "project_id": {
1654
+ "name": "project_id",
1655
+ "type": "text",
1656
+ "primaryKey": false,
1657
+ "notNull": true,
1658
+ "autoincrement": false
1659
+ },
1660
+ "environment_id": {
1661
+ "name": "environment_id",
1662
+ "type": "text",
1663
+ "primaryKey": false,
1664
+ "notNull": true,
1665
+ "autoincrement": false
1666
+ },
1667
+ "secret_id": {
1668
+ "name": "secret_id",
1669
+ "type": "text",
1670
+ "primaryKey": false,
1671
+ "notNull": true,
1672
+ "autoincrement": false
1673
+ },
1674
+ "source_project_id": {
1675
+ "name": "source_project_id",
1676
+ "type": "text",
1677
+ "primaryKey": false,
1678
+ "notNull": true,
1679
+ "autoincrement": false
1680
+ },
1681
+ "source_environment_id": {
1682
+ "name": "source_environment_id",
1683
+ "type": "text",
1684
+ "primaryKey": false,
1685
+ "notNull": true,
1686
+ "autoincrement": false
1687
+ },
1688
+ "source_secret_id": {
1689
+ "name": "source_secret_id",
1690
+ "type": "text",
1691
+ "primaryKey": false,
1692
+ "notNull": true,
1693
+ "autoincrement": false
1694
+ },
1695
+ "created_seq": {
1696
+ "name": "created_seq",
1697
+ "type": "integer",
1698
+ "primaryKey": false,
1699
+ "notNull": true,
1700
+ "autoincrement": false
1701
+ },
1702
+ "created_at": {
1703
+ "name": "created_at",
1704
+ "type": "integer",
1705
+ "primaryKey": false,
1706
+ "notNull": true,
1707
+ "autoincrement": false,
1708
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1709
+ },
1710
+ "created_by": {
1711
+ "name": "created_by",
1712
+ "type": "text",
1713
+ "primaryKey": false,
1714
+ "notNull": true,
1715
+ "autoincrement": false
1716
+ }
1717
+ },
1718
+ "indexes": {
1719
+ "secret_references_holder_idx": {
1720
+ "name": "secret_references_holder_idx",
1721
+ "columns": [
1722
+ "secret_id",
1723
+ "created_seq"
1724
+ ],
1725
+ "isUnique": false
1726
+ },
1727
+ "secret_references_source_idx": {
1728
+ "name": "secret_references_source_idx",
1729
+ "columns": [
1730
+ "source_secret_id"
1731
+ ],
1732
+ "isUnique": false
1733
+ },
1734
+ "secret_references_project_idx": {
1735
+ "name": "secret_references_project_idx",
1736
+ "columns": [
1737
+ "project_id"
1738
+ ],
1739
+ "isUnique": false
1740
+ },
1741
+ "secret_references_source_project_idx": {
1742
+ "name": "secret_references_source_project_idx",
1743
+ "columns": [
1744
+ "source_project_id"
1745
+ ],
1746
+ "isUnique": false
1747
+ },
1748
+ "secret_references_created_by_idx": {
1749
+ "name": "secret_references_created_by_idx",
1750
+ "columns": [
1751
+ "created_by"
1752
+ ],
1753
+ "isUnique": false
1754
+ },
1755
+ "secret_references_created_seq_key": {
1756
+ "name": "secret_references_created_seq_key",
1757
+ "columns": [
1758
+ "created_seq"
1759
+ ],
1760
+ "isUnique": true
1761
+ }
1762
+ },
1763
+ "foreignKeys": {
1764
+ "secret_references_secret_id_fkey": {
1765
+ "name": "secret_references_secret_id_fkey",
1766
+ "tableFrom": "secret_references",
1767
+ "tableTo": "secrets",
1768
+ "columnsFrom": [
1769
+ "secret_id"
1770
+ ],
1771
+ "columnsTo": [
1772
+ "id"
1773
+ ],
1774
+ "onDelete": "restrict",
1775
+ "onUpdate": "no action"
1776
+ },
1777
+ "secret_references_source_secret_id_fkey": {
1778
+ "name": "secret_references_source_secret_id_fkey",
1779
+ "tableFrom": "secret_references",
1780
+ "tableTo": "secrets",
1781
+ "columnsFrom": [
1782
+ "source_secret_id"
1783
+ ],
1784
+ "columnsTo": [
1785
+ "id"
1786
+ ],
1787
+ "onDelete": "restrict",
1788
+ "onUpdate": "no action"
1789
+ },
1790
+ "secret_references_created_seq_fkey": {
1791
+ "name": "secret_references_created_seq_fkey",
1792
+ "tableFrom": "secret_references",
1793
+ "tableTo": "audit_log",
1794
+ "columnsFrom": [
1795
+ "created_seq"
1796
+ ],
1797
+ "columnsTo": [
1798
+ "seq"
1799
+ ],
1800
+ "onDelete": "restrict",
1801
+ "onUpdate": "no action"
1802
+ }
1803
+ },
1804
+ "compositePrimaryKeys": {},
1805
+ "uniqueConstraints": {},
1806
+ "checkConstraints": {}
1807
+ },
1808
+ "secret_versions": {
1809
+ "name": "secret_versions",
1810
+ "columns": {
1811
+ "id": {
1812
+ "name": "id",
1813
+ "type": "text",
1814
+ "primaryKey": true,
1815
+ "notNull": true,
1816
+ "autoincrement": false
1817
+ },
1818
+ "secret_id": {
1819
+ "name": "secret_id",
1820
+ "type": "text",
1821
+ "primaryKey": false,
1822
+ "notNull": true,
1823
+ "autoincrement": false
1824
+ },
1825
+ "version": {
1826
+ "name": "version",
1827
+ "type": "integer",
1828
+ "primaryKey": false,
1829
+ "notNull": true,
1830
+ "autoincrement": false
1831
+ },
1832
+ "envelope_version": {
1833
+ "name": "envelope_version",
1834
+ "type": "integer",
1835
+ "primaryKey": false,
1836
+ "notNull": true,
1837
+ "autoincrement": false
1838
+ },
1839
+ "ciphertext": {
1840
+ "name": "ciphertext",
1841
+ "type": "blob",
1842
+ "primaryKey": false,
1843
+ "notNull": true,
1844
+ "autoincrement": false
1845
+ },
1846
+ "iv": {
1847
+ "name": "iv",
1848
+ "type": "blob",
1849
+ "primaryKey": false,
1850
+ "notNull": true,
1851
+ "autoincrement": false
1852
+ },
1853
+ "auth_tag": {
1854
+ "name": "auth_tag",
1855
+ "type": "blob",
1856
+ "primaryKey": false,
1857
+ "notNull": true,
1858
+ "autoincrement": false
1859
+ },
1860
+ "wrapped_dek": {
1861
+ "name": "wrapped_dek",
1862
+ "type": "blob",
1863
+ "primaryKey": false,
1864
+ "notNull": true,
1865
+ "autoincrement": false
1866
+ },
1867
+ "kek_provider": {
1868
+ "name": "kek_provider",
1869
+ "type": "text",
1870
+ "primaryKey": false,
1871
+ "notNull": true,
1872
+ "autoincrement": false
1873
+ },
1874
+ "kek_id": {
1875
+ "name": "kek_id",
1876
+ "type": "text",
1877
+ "primaryKey": false,
1878
+ "notNull": true,
1879
+ "autoincrement": false
1880
+ },
1881
+ "kek_version": {
1882
+ "name": "kek_version",
1883
+ "type": "text",
1884
+ "primaryKey": false,
1885
+ "notNull": true,
1886
+ "autoincrement": false
1887
+ },
1888
+ "created_at": {
1889
+ "name": "created_at",
1890
+ "type": "integer",
1891
+ "primaryKey": false,
1892
+ "notNull": true,
1893
+ "autoincrement": false,
1894
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1895
+ },
1896
+ "created_by": {
1897
+ "name": "created_by",
1898
+ "type": "text",
1899
+ "primaryKey": false,
1900
+ "notNull": true,
1901
+ "autoincrement": false
1902
+ }
1903
+ },
1904
+ "indexes": {
1905
+ "secret_versions_secret_idx": {
1906
+ "name": "secret_versions_secret_idx",
1907
+ "columns": [
1908
+ "secret_id",
1909
+ "version"
1910
+ ],
1911
+ "isUnique": false
1912
+ },
1913
+ "secret_versions_secret_id_version_key": {
1914
+ "name": "secret_versions_secret_id_version_key",
1915
+ "columns": [
1916
+ "secret_id",
1917
+ "version"
1918
+ ],
1919
+ "isUnique": true
1920
+ }
1921
+ },
1922
+ "foreignKeys": {
1923
+ "secret_versions_secret_id_fkey": {
1924
+ "name": "secret_versions_secret_id_fkey",
1925
+ "tableFrom": "secret_versions",
1926
+ "tableTo": "secrets",
1927
+ "columnsFrom": [
1928
+ "secret_id"
1929
+ ],
1930
+ "columnsTo": [
1931
+ "id"
1932
+ ],
1933
+ "onDelete": "restrict",
1934
+ "onUpdate": "no action"
1935
+ }
1936
+ },
1937
+ "compositePrimaryKeys": {},
1938
+ "uniqueConstraints": {},
1939
+ "checkConstraints": {
1940
+ "secret_versions_version_check": {
1941
+ "name": "secret_versions_version_check",
1942
+ "value": "\"secret_versions\".\"version\" > 0"
1943
+ },
1944
+ "secret_versions_iv_check": {
1945
+ "name": "secret_versions_iv_check",
1946
+ "value": "octet_length(\"secret_versions\".\"iv\") = 12"
1947
+ },
1948
+ "secret_versions_auth_tag_check": {
1949
+ "name": "secret_versions_auth_tag_check",
1950
+ "value": "octet_length(\"secret_versions\".\"auth_tag\") = 16"
1951
+ }
1952
+ }
1953
+ },
1954
+ "secrets": {
1955
+ "name": "secrets",
1956
+ "columns": {
1957
+ "id": {
1958
+ "name": "id",
1959
+ "type": "text",
1960
+ "primaryKey": true,
1961
+ "notNull": true,
1962
+ "autoincrement": false
1963
+ },
1964
+ "project_id": {
1965
+ "name": "project_id",
1966
+ "type": "text",
1967
+ "primaryKey": false,
1968
+ "notNull": true,
1969
+ "autoincrement": false
1970
+ },
1971
+ "environment_id": {
1972
+ "name": "environment_id",
1973
+ "type": "text",
1974
+ "primaryKey": false,
1975
+ "notNull": true,
1976
+ "autoincrement": false
1977
+ },
1978
+ "key": {
1979
+ "name": "key",
1980
+ "type": "text",
1981
+ "primaryKey": false,
1982
+ "notNull": true,
1983
+ "autoincrement": false
1984
+ },
1985
+ "created_at": {
1986
+ "name": "created_at",
1987
+ "type": "integer",
1988
+ "primaryKey": false,
1989
+ "notNull": true,
1990
+ "autoincrement": false,
1991
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1992
+ },
1993
+ "updated_at": {
1994
+ "name": "updated_at",
1995
+ "type": "integer",
1996
+ "primaryKey": false,
1997
+ "notNull": true,
1998
+ "autoincrement": false,
1999
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
2000
+ },
2001
+ "current_version_id": {
2002
+ "name": "current_version_id",
2003
+ "type": "text",
2004
+ "primaryKey": false,
2005
+ "notNull": false,
2006
+ "autoincrement": false
2007
+ },
2008
+ "current_version": {
2009
+ "name": "current_version",
2010
+ "type": "integer",
2011
+ "primaryKey": false,
2012
+ "notNull": true,
2013
+ "autoincrement": false,
2014
+ "default": 0
2015
+ },
2016
+ "archived_at": {
2017
+ "name": "archived_at",
2018
+ "type": "integer",
2019
+ "primaryKey": false,
2020
+ "notNull": false,
2021
+ "autoincrement": false
2022
+ },
2023
+ "folder": {
2024
+ "name": "folder",
2025
+ "type": "text",
2026
+ "primaryKey": false,
2027
+ "notNull": false,
2028
+ "autoincrement": false
2029
+ }
2030
+ },
2031
+ "indexes": {
2032
+ "secrets_lookup_idx": {
2033
+ "name": "secrets_lookup_idx",
2034
+ "columns": [
2035
+ "project_id",
2036
+ "environment_id",
2037
+ "key"
2038
+ ],
2039
+ "isUnique": false
2040
+ },
2041
+ "secrets_project_id_environment_id_key_key": {
2042
+ "name": "secrets_project_id_environment_id_key_key",
2043
+ "columns": [
2044
+ "project_id",
2045
+ "environment_id",
2046
+ "key"
2047
+ ],
2048
+ "isUnique": true
2049
+ }
2050
+ },
2051
+ "foreignKeys": {
2052
+ "secrets_current_version_id_secret_versions_id_fk": {
2053
+ "name": "secrets_current_version_id_secret_versions_id_fk",
2054
+ "tableFrom": "secrets",
2055
+ "tableTo": "secret_versions",
2056
+ "columnsFrom": [
2057
+ "current_version_id"
2058
+ ],
2059
+ "columnsTo": [
2060
+ "id"
2061
+ ],
2062
+ "onDelete": "no action",
2063
+ "onUpdate": "no action"
2064
+ },
2065
+ "secrets_project_id_fkey": {
2066
+ "name": "secrets_project_id_fkey",
2067
+ "tableFrom": "secrets",
2068
+ "tableTo": "projects",
2069
+ "columnsFrom": [
2070
+ "project_id"
2071
+ ],
2072
+ "columnsTo": [
2073
+ "id"
2074
+ ],
2075
+ "onDelete": "restrict",
2076
+ "onUpdate": "no action"
2077
+ },
2078
+ "secrets_environment_id_fkey": {
2079
+ "name": "secrets_environment_id_fkey",
2080
+ "tableFrom": "secrets",
2081
+ "tableTo": "environments",
2082
+ "columnsFrom": [
2083
+ "environment_id"
2084
+ ],
2085
+ "columnsTo": [
2086
+ "id"
2087
+ ],
2088
+ "onDelete": "restrict",
2089
+ "onUpdate": "no action"
2090
+ },
2091
+ "secrets_environment_in_project": {
2092
+ "name": "secrets_environment_in_project",
2093
+ "tableFrom": "secrets",
2094
+ "tableTo": "environments",
2095
+ "columnsFrom": [
2096
+ "environment_id",
2097
+ "project_id"
2098
+ ],
2099
+ "columnsTo": [
2100
+ "id",
2101
+ "project_id"
2102
+ ],
2103
+ "onDelete": "no action",
2104
+ "onUpdate": "no action"
2105
+ }
2106
+ },
2107
+ "compositePrimaryKeys": {},
2108
+ "uniqueConstraints": {},
2109
+ "checkConstraints": {
2110
+ "secrets_key_check": {
2111
+ "name": "secrets_key_check",
2112
+ "value": "length(\"secrets\".\"key\") BETWEEN 1 AND 128 AND \"secrets\".\"key\" GLOB '[A-Za-z_]*' AND \"secrets\".\"key\" NOT GLOB '*[^A-Za-z0-9_]*'"
2113
+ },
2114
+ "secrets_folder_check": {
2115
+ "name": "secrets_folder_check",
2116
+ "value": "\"secrets\".\"folder\" IS NULL OR (length(\"secrets\".\"folder\") BETWEEN 1 AND 64 AND \"secrets\".\"folder\" NOT GLOB '*/*' AND \"secrets\".\"folder\" = trim(\"secrets\".\"folder\"))"
2117
+ }
2118
+ }
2119
+ },
2120
+ "service_bindings": {
2121
+ "name": "service_bindings",
2122
+ "columns": {
2123
+ "id": {
2124
+ "name": "id",
2125
+ "type": "text",
2126
+ "primaryKey": true,
2127
+ "notNull": true,
2128
+ "autoincrement": false
2129
+ },
2130
+ "auth_mac": {
2131
+ "name": "auth_mac",
2132
+ "type": "blob",
2133
+ "primaryKey": false,
2134
+ "notNull": true,
2135
+ "autoincrement": false
2136
+ },
2137
+ "principal": {
2138
+ "name": "principal",
2139
+ "type": "text",
2140
+ "primaryKey": false,
2141
+ "notNull": true,
2142
+ "autoincrement": false
2143
+ },
2144
+ "generation": {
2145
+ "name": "generation",
2146
+ "type": "integer",
2147
+ "primaryKey": false,
2148
+ "notNull": true,
2149
+ "autoincrement": false
2150
+ },
2151
+ "profile": {
2152
+ "name": "profile",
2153
+ "type": "text",
2154
+ "primaryKey": false,
2155
+ "notNull": true,
2156
+ "autoincrement": false
2157
+ },
2158
+ "issuer": {
2159
+ "name": "issuer",
2160
+ "type": "text",
2161
+ "primaryKey": false,
2162
+ "notNull": true,
2163
+ "autoincrement": false
2164
+ },
2165
+ "jwks_uri": {
2166
+ "name": "jwks_uri",
2167
+ "type": "text",
2168
+ "primaryKey": false,
2169
+ "notNull": true,
2170
+ "autoincrement": false
2171
+ },
2172
+ "claims": {
2173
+ "name": "claims",
2174
+ "type": "text",
2175
+ "primaryKey": false,
2176
+ "notNull": true,
2177
+ "autoincrement": false
2178
+ },
2179
+ "scope": {
2180
+ "name": "scope",
2181
+ "type": "text",
2182
+ "primaryKey": false,
2183
+ "notNull": false,
2184
+ "autoincrement": false
2185
+ },
2186
+ "label": {
2187
+ "name": "label",
2188
+ "type": "text",
2189
+ "primaryKey": false,
2190
+ "notNull": false,
2191
+ "autoincrement": false
2192
+ },
2193
+ "created_at": {
2194
+ "name": "created_at",
2195
+ "type": "integer",
2196
+ "primaryKey": false,
2197
+ "notNull": true,
2198
+ "autoincrement": false,
2199
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
2200
+ },
2201
+ "created_by": {
2202
+ "name": "created_by",
2203
+ "type": "text",
2204
+ "primaryKey": false,
2205
+ "notNull": true,
2206
+ "autoincrement": false
2207
+ },
2208
+ "last_used_at": {
2209
+ "name": "last_used_at",
2210
+ "type": "integer",
2211
+ "primaryKey": false,
2212
+ "notNull": false,
2213
+ "autoincrement": false
2214
+ },
2215
+ "revoked_at": {
2216
+ "name": "revoked_at",
2217
+ "type": "integer",
2218
+ "primaryKey": false,
2219
+ "notNull": false,
2220
+ "autoincrement": false
2221
+ },
2222
+ "revoked_by": {
2223
+ "name": "revoked_by",
2224
+ "type": "text",
2225
+ "primaryKey": false,
2226
+ "notNull": false,
2227
+ "autoincrement": false
2228
+ }
2229
+ },
2230
+ "indexes": {
2231
+ "service_bindings_principal_idx": {
2232
+ "name": "service_bindings_principal_idx",
2233
+ "columns": [
2234
+ "principal",
2235
+ "issuer"
2236
+ ],
2237
+ "isUnique": false
2238
+ },
2239
+ "service_bindings_live_idx": {
2240
+ "name": "service_bindings_live_idx",
2241
+ "columns": [
2242
+ "principal",
2243
+ "issuer",
2244
+ "generation",
2245
+ "created_at",
2246
+ "id"
2247
+ ],
2248
+ "isUnique": false,
2249
+ "where": "\"service_bindings\".\"revoked_at\" IS NULL"
2250
+ }
2251
+ },
2252
+ "foreignKeys": {
2253
+ "service_bindings_principal_fkey": {
2254
+ "name": "service_bindings_principal_fkey",
2255
+ "tableFrom": "service_bindings",
2256
+ "tableTo": "vault_members",
2257
+ "columnsFrom": [
2258
+ "principal"
2259
+ ],
2260
+ "columnsTo": [
2261
+ "principal"
2262
+ ],
2263
+ "onDelete": "restrict",
2264
+ "onUpdate": "no action"
2265
+ }
2266
+ },
2267
+ "compositePrimaryKeys": {},
2268
+ "uniqueConstraints": {},
2269
+ "checkConstraints": {
2270
+ "service_bindings_principal_check": {
2271
+ "name": "service_bindings_principal_check",
2272
+ "value": "\"service_bindings\".\"principal\" LIKE 'token:%'"
2273
+ },
2274
+ "service_bindings_auth_mac_check": {
2275
+ "name": "service_bindings_auth_mac_check",
2276
+ "value": "octet_length(\"service_bindings\".\"auth_mac\") = 32"
2277
+ },
2278
+ "service_bindings_claims_check": {
2279
+ "name": "service_bindings_claims_check",
2280
+ "value": "json_valid(\"service_bindings\".\"claims\")"
2281
+ }
2282
+ }
2283
+ },
2284
+ "vault_grants": {
2285
+ "name": "vault_grants",
2286
+ "columns": {
2287
+ "principal": {
2288
+ "name": "principal",
2289
+ "type": "text",
2290
+ "primaryKey": false,
2291
+ "notNull": true,
2292
+ "autoincrement": false
2293
+ },
2294
+ "project_id": {
2295
+ "name": "project_id",
2296
+ "type": "text",
2297
+ "primaryKey": false,
2298
+ "notNull": false,
2299
+ "autoincrement": false
2300
+ },
2301
+ "environment_id": {
2302
+ "name": "environment_id",
2303
+ "type": "text",
2304
+ "primaryKey": false,
2305
+ "notNull": false,
2306
+ "autoincrement": false
2307
+ },
2308
+ "environment_slug": {
2309
+ "name": "environment_slug",
2310
+ "type": "text",
2311
+ "primaryKey": false,
2312
+ "notNull": false,
2313
+ "autoincrement": false
2314
+ },
2315
+ "role": {
2316
+ "name": "role",
2317
+ "type": "text",
2318
+ "primaryKey": false,
2319
+ "notNull": true,
2320
+ "autoincrement": false
2321
+ },
2322
+ "expires_at": {
2323
+ "name": "expires_at",
2324
+ "type": "integer",
2325
+ "primaryKey": false,
2326
+ "notNull": false,
2327
+ "autoincrement": false
2328
+ },
2329
+ "granted_at": {
2330
+ "name": "granted_at",
2331
+ "type": "integer",
2332
+ "primaryKey": false,
2333
+ "notNull": true,
2334
+ "autoincrement": false
2335
+ },
2336
+ "granted_by": {
2337
+ "name": "granted_by",
2338
+ "type": "text",
2339
+ "primaryKey": false,
2340
+ "notNull": true,
2341
+ "autoincrement": false
2342
+ }
2343
+ },
2344
+ "indexes": {
2345
+ "vault_grants_on_every_project": {
2346
+ "name": "vault_grants_on_every_project",
2347
+ "columns": [
2348
+ "principal"
2349
+ ],
2350
+ "isUnique": true,
2351
+ "where": "\"vault_grants\".\"project_id\" IS NULL AND \"vault_grants\".\"environment_id\" IS NULL AND \"vault_grants\".\"environment_slug\" IS NULL"
2352
+ },
2353
+ "vault_grants_on_project": {
2354
+ "name": "vault_grants_on_project",
2355
+ "columns": [
2356
+ "principal",
2357
+ "project_id"
2358
+ ],
2359
+ "isUnique": true
2360
+ },
2361
+ "vault_grants_on_environment": {
2362
+ "name": "vault_grants_on_environment",
2363
+ "columns": [
2364
+ "principal",
2365
+ "environment_id"
2366
+ ],
2367
+ "isUnique": true
2368
+ },
2369
+ "vault_grants_on_environment_slug": {
2370
+ "name": "vault_grants_on_environment_slug",
2371
+ "columns": [
2372
+ "principal",
2373
+ "environment_slug"
2374
+ ],
2375
+ "isUnique": true
2376
+ }
2377
+ },
2378
+ "foreignKeys": {
2379
+ "vault_grants_principal_fkey": {
2380
+ "name": "vault_grants_principal_fkey",
2381
+ "tableFrom": "vault_grants",
2382
+ "tableTo": "vault_members",
2383
+ "columnsFrom": [
2384
+ "principal"
2385
+ ],
2386
+ "columnsTo": [
2387
+ "principal"
2388
+ ],
2389
+ "onDelete": "restrict",
2390
+ "onUpdate": "no action"
2391
+ },
2392
+ "vault_grants_project_id_fkey": {
2393
+ "name": "vault_grants_project_id_fkey",
2394
+ "tableFrom": "vault_grants",
2395
+ "tableTo": "projects",
2396
+ "columnsFrom": [
2397
+ "project_id"
2398
+ ],
2399
+ "columnsTo": [
2400
+ "id"
2401
+ ],
2402
+ "onDelete": "restrict",
2403
+ "onUpdate": "no action"
2404
+ },
2405
+ "vault_grants_environment_id_fkey": {
2406
+ "name": "vault_grants_environment_id_fkey",
2407
+ "tableFrom": "vault_grants",
2408
+ "tableTo": "environments",
2409
+ "columnsFrom": [
2410
+ "environment_id"
2411
+ ],
2412
+ "columnsTo": [
2413
+ "id"
2414
+ ],
2415
+ "onDelete": "restrict",
2416
+ "onUpdate": "no action"
2417
+ }
2418
+ },
2419
+ "compositePrimaryKeys": {},
2420
+ "uniqueConstraints": {},
2421
+ "checkConstraints": {
2422
+ "vault_grants_one_place": {
2423
+ "name": "vault_grants_one_place",
2424
+ "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)"
2425
+ },
2426
+ "vault_grants_environment_slug_check": {
2427
+ "name": "vault_grants_environment_slug_check",
2428
+ "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-]*')"
2429
+ },
2430
+ "vault_grants_role_check": {
2431
+ "name": "vault_grants_role_check",
2432
+ "value": "\"vault_grants\".\"role\" IN ('viewer', 'developer', 'maintainer', 'access-manager', 'auditor', 'owner')"
2433
+ },
2434
+ "vault_grants_environment_role_check": {
2435
+ "name": "vault_grants_environment_role_check",
2436
+ "value": "(\"vault_grants\".\"environment_id\" IS NULL AND \"vault_grants\".\"environment_slug\" IS NULL) OR \"vault_grants\".\"role\" IN ('viewer', 'developer', 'auditor')"
2437
+ }
2438
+ }
2439
+ },
2440
+ "vault_members": {
2441
+ "name": "vault_members",
2442
+ "columns": {
2443
+ "principal": {
2444
+ "name": "principal",
2445
+ "type": "text",
2446
+ "primaryKey": true,
2447
+ "notNull": true,
2448
+ "autoincrement": false
2449
+ },
2450
+ "status": {
2451
+ "name": "status",
2452
+ "type": "text",
2453
+ "primaryKey": false,
2454
+ "notNull": true,
2455
+ "autoincrement": false
2456
+ },
2457
+ "owner": {
2458
+ "name": "owner",
2459
+ "type": "integer",
2460
+ "primaryKey": false,
2461
+ "notNull": true,
2462
+ "autoincrement": false,
2463
+ "default": false
2464
+ },
2465
+ "role": {
2466
+ "name": "role",
2467
+ "type": "text",
2468
+ "primaryKey": false,
2469
+ "notNull": false,
2470
+ "autoincrement": false
2471
+ },
2472
+ "scope": {
2473
+ "name": "scope",
2474
+ "type": "text",
2475
+ "primaryKey": false,
2476
+ "notNull": false,
2477
+ "autoincrement": false
2478
+ },
2479
+ "generation": {
2480
+ "name": "generation",
2481
+ "type": "integer",
2482
+ "primaryKey": false,
2483
+ "notNull": true,
2484
+ "autoincrement": false,
2485
+ "default": 0
2486
+ },
2487
+ "created_at": {
2488
+ "name": "created_at",
2489
+ "type": "integer",
2490
+ "primaryKey": false,
2491
+ "notNull": true,
2492
+ "autoincrement": false
2493
+ },
2494
+ "created_by": {
2495
+ "name": "created_by",
2496
+ "type": "text",
2497
+ "primaryKey": false,
2498
+ "notNull": true,
2499
+ "autoincrement": false
2500
+ },
2501
+ "status_changed_at": {
2502
+ "name": "status_changed_at",
2503
+ "type": "integer",
2504
+ "primaryKey": false,
2505
+ "notNull": true,
2506
+ "autoincrement": false
2507
+ },
2508
+ "status_changed_by": {
2509
+ "name": "status_changed_by",
2510
+ "type": "text",
2511
+ "primaryKey": false,
2512
+ "notNull": true,
2513
+ "autoincrement": false
2514
+ },
2515
+ "access_seq": {
2516
+ "name": "access_seq",
2517
+ "type": "integer",
2518
+ "primaryKey": false,
2519
+ "notNull": true,
2520
+ "autoincrement": false
2521
+ },
2522
+ "mac": {
2523
+ "name": "mac",
2524
+ "type": "blob",
2525
+ "primaryKey": false,
2526
+ "notNull": true,
2527
+ "autoincrement": false
2528
+ }
2529
+ },
2530
+ "indexes": {},
2531
+ "foreignKeys": {},
2532
+ "compositePrimaryKeys": {},
2533
+ "uniqueConstraints": {},
2534
+ "checkConstraints": {
2535
+ "vault_members_mac_check": {
2536
+ "name": "vault_members_mac_check",
2537
+ "value": "octet_length(\"vault_members\".\"mac\") = 32"
2538
+ },
2539
+ "vault_members_principal_check": {
2540
+ "name": "vault_members_principal_check",
2541
+ "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"
2542
+ },
2543
+ "vault_members_user_lowercase": {
2544
+ "name": "vault_members_user_lowercase",
2545
+ "value": "\"vault_members\".\"principal\" NOT LIKE 'user:%' OR \"vault_members\".\"principal\" = lower(\"vault_members\".\"principal\")"
2546
+ },
2547
+ "vault_members_status_check": {
2548
+ "name": "vault_members_status_check",
2549
+ "value": "\"vault_members\".\"status\" IN ('active', 'removed')"
2550
+ },
2551
+ "vault_members_owner_check": {
2552
+ "name": "vault_members_owner_check",
2553
+ "value": "NOT \"vault_members\".\"owner\" OR (\"vault_members\".\"status\" = 'active' AND \"vault_members\".\"principal\" LIKE 'user:%')"
2554
+ },
2555
+ "vault_members_generation_check": {
2556
+ "name": "vault_members_generation_check",
2557
+ "value": "\"vault_members\".\"generation\" >= 0"
2558
+ }
2559
+ }
2560
+ }
2561
+ },
2562
+ "views": {},
2563
+ "enums": {},
2564
+ "_meta": {
2565
+ "schemas": {},
2566
+ "tables": {},
2567
+ "columns": {}
2568
+ },
2569
+ "internal": {
2570
+ "indexes": {
2571
+ "audit_log_unbind_idx": {
2572
+ "columns": {
2573
+ "json_extract(\"metadata\", '$.bindingId')": {
2574
+ "isExpression": true
2575
+ }
2576
+ }
2577
+ },
2578
+ "audit_log_exchange_idx": {
2579
+ "columns": {
2580
+ "json_extract(\"metadata\", '$.credentialId')": {
2581
+ "isExpression": true
2582
+ }
2583
+ }
2584
+ },
2585
+ "audit_log_also_project_idx": {
2586
+ "columns": {
2587
+ "json_extract(\"metadata\", '$.also.projectId')": {
2588
+ "isExpression": true
2589
+ }
2590
+ }
2591
+ },
2592
+ "audit_log_also_environment_idx": {
2593
+ "columns": {
2594
+ "json_extract(\"metadata\", '$.also.environmentId')": {
2595
+ "isExpression": true
2596
+ }
2597
+ }
2598
+ },
2599
+ "audit_log_also_secret_idx": {
2600
+ "columns": {
2601
+ "json_extract(\"metadata\", '$.also.secretId')": {
2602
+ "isExpression": true
2603
+ }
2604
+ }
2605
+ }
2606
+ }
2607
+ }
2608
+ }