@coffre/db 0.2.0 → 0.4.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 (76) hide show
  1. package/dist/connect.d.ts +1 -1
  2. package/dist/{database-Cq_52uUo.d.ts → database-edkMkG02.d.ts} +1 -1
  3. package/dist/dialect.d.ts +10 -2
  4. package/dist/dialect.js +34 -1
  5. package/dist/grants.d.ts +32 -0
  6. package/dist/grants.js +27 -0
  7. package/dist/hyperdrive.d.ts +1 -1
  8. package/dist/index.d.ts +2 -2
  9. package/dist/log.d.ts +1 -1
  10. package/dist/migrate.js +6 -1
  11. package/dist/migrations/postgres/0000_baseline.sql +174 -46
  12. package/dist/migrations/postgres/0001_mcp_approvals.sql +24 -0
  13. package/dist/migrations/postgres/meta/0000_snapshot.json +963 -185
  14. package/dist/migrations/postgres/meta/0001_snapshot.json +1171 -30
  15. package/dist/migrations/postgres/meta/_journal.json +3 -24
  16. package/dist/migrations/sqlite/0000_baseline.sql +142 -35
  17. package/dist/migrations/sqlite/0001_mcp_approvals.sql +19 -0
  18. package/dist/migrations/sqlite/meta/0000_snapshot.json +878 -235
  19. package/dist/migrations/sqlite/meta/0001_snapshot.json +1062 -57
  20. package/dist/migrations/sqlite/meta/_journal.json +3 -24
  21. package/dist/portable.d.ts +2 -2
  22. package/dist/{schema-Wt-p8AOh.d.ts → schema-BqCB3XFm.d.ts} +1153 -83
  23. package/dist/schema-sqlite.d.ts +1171 -60
  24. package/dist/schema-sqlite.js +173 -11
  25. package/dist/schema-version.d.ts +9 -13
  26. package/dist/schema-version.js +38 -90
  27. package/dist/schema.d.ts +2 -2
  28. package/dist/schema.js +208 -15
  29. package/package.json +7 -2
  30. package/src/baseline/postgres.sql +46 -10
  31. package/src/baseline/sqlite.sql +15 -0
  32. package/src/baseline.ts +7 -3
  33. package/src/dialect.ts +25 -1
  34. package/src/grants.ts +51 -0
  35. package/src/migrate.ts +5 -0
  36. package/src/migrations/postgres/0000_baseline.sql +174 -46
  37. package/src/migrations/postgres/0001_mcp_approvals.sql +24 -0
  38. package/src/migrations/postgres/meta/0000_snapshot.json +963 -185
  39. package/src/migrations/postgres/meta/0001_snapshot.json +1171 -30
  40. package/src/migrations/postgres/meta/_journal.json +3 -24
  41. package/src/migrations/sqlite/0000_baseline.sql +142 -35
  42. package/src/migrations/sqlite/0001_mcp_approvals.sql +19 -0
  43. package/src/migrations/sqlite/meta/0000_snapshot.json +878 -235
  44. package/src/migrations/sqlite/meta/0001_snapshot.json +1062 -57
  45. package/src/migrations/sqlite/meta/_journal.json +3 -24
  46. package/src/schema-version.ts +26 -18
  47. package/src/schema.sqlite.ts +223 -8
  48. package/src/schema.ts +263 -11
  49. package/dist/migrations/postgres/0001_remove_syncs.sql +0 -13
  50. package/dist/migrations/postgres/0002_service_bindings.sql +0 -28
  51. package/dist/migrations/postgres/0003_exchanges.sql +0 -10
  52. package/dist/migrations/postgres/0004_live_indexes.sql +0 -3
  53. package/dist/migrations/postgres/meta/0002_snapshot.json +0 -1870
  54. package/dist/migrations/postgres/meta/0003_snapshot.json +0 -1917
  55. package/dist/migrations/postgres/meta/0004_snapshot.json +0 -2006
  56. package/dist/migrations/sqlite/0001_remove_syncs.sql +0 -13
  57. package/dist/migrations/sqlite/0002_service_bindings.sql +0 -23
  58. package/dist/migrations/sqlite/0003_exchanges.sql +0 -7
  59. package/dist/migrations/sqlite/0004_live_indexes.sql +0 -3
  60. package/dist/migrations/sqlite/meta/0002_snapshot.json +0 -1736
  61. package/dist/migrations/sqlite/meta/0003_snapshot.json +0 -1781
  62. package/dist/migrations/sqlite/meta/0004_snapshot.json +0 -1811
  63. package/src/migrations/postgres/0001_remove_syncs.sql +0 -13
  64. package/src/migrations/postgres/0002_service_bindings.sql +0 -28
  65. package/src/migrations/postgres/0003_exchanges.sql +0 -10
  66. package/src/migrations/postgres/0004_live_indexes.sql +0 -3
  67. package/src/migrations/postgres/meta/0002_snapshot.json +0 -1870
  68. package/src/migrations/postgres/meta/0003_snapshot.json +0 -1917
  69. package/src/migrations/postgres/meta/0004_snapshot.json +0 -2006
  70. package/src/migrations/sqlite/0001_remove_syncs.sql +0 -13
  71. package/src/migrations/sqlite/0002_service_bindings.sql +0 -23
  72. package/src/migrations/sqlite/0003_exchanges.sql +0 -7
  73. package/src/migrations/sqlite/0004_live_indexes.sql +0 -3
  74. package/src/migrations/sqlite/meta/0002_snapshot.json +0 -1736
  75. package/src/migrations/sqlite/meta/0003_snapshot.json +0 -1781
  76. package/src/migrations/sqlite/meta/0004_snapshot.json +0 -1811
@@ -1,6 +1,6 @@
1
1
  {
2
- "id": "349584fd-2c70-4863-bcd6-d353cc28205a",
3
- "prevId": "b76d9374-5d86-42d1-9d06-1af17adadd6b",
2
+ "id": "872201b9-66a8-43bf-9a05-e5492fe3e3ee",
3
+ "prevId": "52e2bd4a-ba59-41f7-890c-edfa62f0425d",
4
4
  "version": "7",
5
5
  "dialect": "postgresql",
6
6
  "tables": {
@@ -380,6 +380,120 @@
380
380
  "concurrently": false,
381
381
  "method": "btree",
382
382
  "with": {}
383
+ },
384
+ "audit_log_unbind_idx": {
385
+ "name": "audit_log_unbind_idx",
386
+ "columns": [
387
+ {
388
+ "expression": "((\"metadata\")::jsonb ->> 'bindingId')",
389
+ "asc": true,
390
+ "isExpression": true,
391
+ "nulls": "last"
392
+ }
393
+ ],
394
+ "isUnique": false,
395
+ "where": "\"audit_log\".\"author\" = 'app' AND \"audit_log\".\"action\" = 'token.unbind' AND \"audit_log\".\"decision\" = 'allow'",
396
+ "concurrently": false,
397
+ "method": "btree",
398
+ "with": {}
399
+ },
400
+ "audit_log_exchange_idx": {
401
+ "name": "audit_log_exchange_idx",
402
+ "columns": [
403
+ {
404
+ "expression": "((\"metadata\")::jsonb ->> 'credentialId')",
405
+ "asc": true,
406
+ "isExpression": true,
407
+ "nulls": "last"
408
+ }
409
+ ],
410
+ "isUnique": false,
411
+ "where": "\"audit_log\".\"author\" = 'app' AND \"audit_log\".\"action\" = 'token.exchange' AND \"audit_log\".\"decision\" = 'allow'",
412
+ "concurrently": false,
413
+ "method": "btree",
414
+ "with": {}
415
+ },
416
+ "audit_log_reference_end_idx": {
417
+ "name": "audit_log_reference_end_idx",
418
+ "columns": [
419
+ {
420
+ "expression": "related_seq",
421
+ "isExpression": false,
422
+ "asc": true,
423
+ "nulls": "last"
424
+ }
425
+ ],
426
+ "isUnique": false,
427
+ "where": "\"audit_log\".\"author\" = 'vault' AND \"audit_log\".\"action\" = 'reference.end' AND \"audit_log\".\"decision\" = 'allow'",
428
+ "concurrently": false,
429
+ "method": "btree",
430
+ "with": {}
431
+ },
432
+ "audit_log_also_project_idx": {
433
+ "name": "audit_log_also_project_idx",
434
+ "columns": [
435
+ {
436
+ "expression": "(((\"metadata\")::jsonb -> 'also') ->> 'projectId')",
437
+ "asc": true,
438
+ "isExpression": true,
439
+ "nulls": "last"
440
+ },
441
+ {
442
+ "expression": "seq",
443
+ "isExpression": false,
444
+ "asc": true,
445
+ "nulls": "last"
446
+ }
447
+ ],
448
+ "isUnique": false,
449
+ "where": "((\"audit_log\".\"metadata\")::jsonb -> 'also') IS NOT NULL",
450
+ "concurrently": false,
451
+ "method": "btree",
452
+ "with": {}
453
+ },
454
+ "audit_log_also_environment_idx": {
455
+ "name": "audit_log_also_environment_idx",
456
+ "columns": [
457
+ {
458
+ "expression": "(((\"metadata\")::jsonb -> 'also') ->> 'environmentId')",
459
+ "asc": true,
460
+ "isExpression": true,
461
+ "nulls": "last"
462
+ },
463
+ {
464
+ "expression": "seq",
465
+ "isExpression": false,
466
+ "asc": true,
467
+ "nulls": "last"
468
+ }
469
+ ],
470
+ "isUnique": false,
471
+ "where": "((\"audit_log\".\"metadata\")::jsonb -> 'also') IS NOT NULL",
472
+ "concurrently": false,
473
+ "method": "btree",
474
+ "with": {}
475
+ },
476
+ "audit_log_also_secret_idx": {
477
+ "name": "audit_log_also_secret_idx",
478
+ "columns": [
479
+ {
480
+ "expression": "(((\"metadata\")::jsonb -> 'also') ->> 'secretId')",
481
+ "asc": true,
482
+ "isExpression": true,
483
+ "nulls": "last"
484
+ },
485
+ {
486
+ "expression": "seq",
487
+ "isExpression": false,
488
+ "asc": true,
489
+ "nulls": "last"
490
+ }
491
+ ],
492
+ "isUnique": false,
493
+ "where": "((\"audit_log\".\"metadata\")::jsonb -> 'also') IS NOT NULL",
494
+ "concurrently": false,
495
+ "method": "btree",
496
+ "with": {}
383
497
  }
384
498
  },
385
499
  "foreignKeys": {
@@ -459,7 +573,7 @@
459
573
  },
460
574
  "audit_log_actor_check": {
461
575
  "name": "audit_log_actor_check",
462
- "value": "\"audit_log\".\"actor\" ~ '^(user|token|sync|system):.+$'"
576
+ "value": "\"audit_log\".\"actor\" ~ '^(user|token|system):.+$'"
463
577
  },
464
578
  "audit_log_decision_check": {
465
579
  "name": "audit_log_decision_check",
@@ -484,6 +598,37 @@
484
598
  },
485
599
  "isRLSEnabled": false
486
600
  },
601
+ "public.consumed_tokens": {
602
+ "name": "consumed_tokens",
603
+ "schema": "",
604
+ "columns": {
605
+ "hash": {
606
+ "name": "hash",
607
+ "type": "bytea",
608
+ "primaryKey": true,
609
+ "notNull": true
610
+ },
611
+ "consumed_at": {
612
+ "name": "consumed_at",
613
+ "type": "timestamp with time zone",
614
+ "primaryKey": false,
615
+ "notNull": true,
616
+ "default": "now()"
617
+ }
618
+ },
619
+ "indexes": {},
620
+ "foreignKeys": {},
621
+ "compositePrimaryKeys": {},
622
+ "uniqueConstraints": {},
623
+ "policies": {},
624
+ "checkConstraints": {
625
+ "consumed_tokens_hash_check": {
626
+ "name": "consumed_tokens_hash_check",
627
+ "value": "octet_length(\"consumed_tokens\".\"hash\") = 32"
628
+ }
629
+ },
630
+ "isRLSEnabled": false
631
+ },
487
632
  "public.credentials": {
488
633
  "name": "credentials",
489
634
  "schema": "",
@@ -608,6 +753,55 @@
608
753
  "concurrently": false,
609
754
  "method": "btree",
610
755
  "with": {}
756
+ },
757
+ "credentials_live_idx": {
758
+ "name": "credentials_live_idx",
759
+ "columns": [
760
+ {
761
+ "expression": "principal",
762
+ "isExpression": false,
763
+ "asc": true,
764
+ "nulls": "last"
765
+ },
766
+ {
767
+ "expression": "expires_at",
768
+ "isExpression": false,
769
+ "asc": true,
770
+ "nulls": "last"
771
+ }
772
+ ],
773
+ "isUnique": false,
774
+ "where": "\"credentials\".\"revoked_at\" IS NULL",
775
+ "concurrently": false,
776
+ "method": "btree",
777
+ "with": {}
778
+ },
779
+ "credentials_issued_by_idx": {
780
+ "name": "credentials_issued_by_idx",
781
+ "columns": [
782
+ {
783
+ "expression": "principal",
784
+ "isExpression": false,
785
+ "asc": true,
786
+ "nulls": "last"
787
+ },
788
+ {
789
+ "expression": "created_by",
790
+ "isExpression": false,
791
+ "asc": true,
792
+ "nulls": "last"
793
+ },
794
+ {
795
+ "expression": "created_at",
796
+ "isExpression": false,
797
+ "asc": true,
798
+ "nulls": "last"
799
+ }
800
+ ],
801
+ "isUnique": false,
802
+ "concurrently": false,
803
+ "method": "btree",
804
+ "with": {}
611
805
  }
612
806
  },
613
807
  "foreignKeys": {
@@ -813,6 +1007,83 @@
813
1007
  },
814
1008
  "isRLSEnabled": false
815
1009
  },
1010
+ "public.dismissed_keys": {
1011
+ "name": "dismissed_keys",
1012
+ "schema": "",
1013
+ "columns": {
1014
+ "environment_id": {
1015
+ "name": "environment_id",
1016
+ "type": "uuid",
1017
+ "primaryKey": false,
1018
+ "notNull": true
1019
+ },
1020
+ "key": {
1021
+ "name": "key",
1022
+ "type": "text",
1023
+ "primaryKey": false,
1024
+ "notNull": true
1025
+ },
1026
+ "dismissed_at": {
1027
+ "name": "dismissed_at",
1028
+ "type": "timestamp with time zone",
1029
+ "primaryKey": false,
1030
+ "notNull": true,
1031
+ "default": "now()"
1032
+ },
1033
+ "dismissed_by": {
1034
+ "name": "dismissed_by",
1035
+ "type": "text",
1036
+ "primaryKey": false,
1037
+ "notNull": true
1038
+ },
1039
+ "restored_at": {
1040
+ "name": "restored_at",
1041
+ "type": "timestamp with time zone",
1042
+ "primaryKey": false,
1043
+ "notNull": false
1044
+ },
1045
+ "restored_by": {
1046
+ "name": "restored_by",
1047
+ "type": "text",
1048
+ "primaryKey": false,
1049
+ "notNull": false
1050
+ }
1051
+ },
1052
+ "indexes": {},
1053
+ "foreignKeys": {
1054
+ "dismissed_keys_environment_id_fkey": {
1055
+ "name": "dismissed_keys_environment_id_fkey",
1056
+ "tableFrom": "dismissed_keys",
1057
+ "tableTo": "environments",
1058
+ "columnsFrom": [
1059
+ "environment_id"
1060
+ ],
1061
+ "columnsTo": [
1062
+ "id"
1063
+ ],
1064
+ "onDelete": "restrict",
1065
+ "onUpdate": "no action"
1066
+ }
1067
+ },
1068
+ "compositePrimaryKeys": {
1069
+ "dismissed_keys_pkey": {
1070
+ "name": "dismissed_keys_pkey",
1071
+ "columns": [
1072
+ "environment_id",
1073
+ "key"
1074
+ ]
1075
+ }
1076
+ },
1077
+ "uniqueConstraints": {},
1078
+ "policies": {},
1079
+ "checkConstraints": {
1080
+ "dismissed_keys_key_check": {
1081
+ "name": "dismissed_keys_key_check",
1082
+ "value": "\"dismissed_keys\".\"key\" ~ '^[A-Za-z_][A-Za-z0-9_]{0,127}$'"
1083
+ }
1084
+ },
1085
+ "isRLSEnabled": false
1086
+ },
816
1087
  "public.environments": {
817
1088
  "name": "environments",
818
1089
  "schema": "",
@@ -895,7 +1166,7 @@
895
1166
  "checkConstraints": {
896
1167
  "environments_slug_check": {
897
1168
  "name": "environments_slug_check",
898
- "value": "\"environments\".\"slug\" ~ '^[a-z0-9][a-z0-9-]{0,62}$'"
1169
+ "value": "\"environments\".\"slug\" ~ '^[a-z0-9][a-z0-9-]{0,62}(~[a-z0-9-]{1,40})?$'"
899
1170
  }
900
1171
  },
901
1172
  "isRLSEnabled": false
@@ -1089,29 +1360,53 @@
1089
1360
  },
1090
1361
  "isRLSEnabled": false
1091
1362
  },
1092
- "public.projects": {
1093
- "name": "projects",
1363
+ "public.mcp_approvals": {
1364
+ "name": "mcp_approvals",
1094
1365
  "schema": "",
1095
1366
  "columns": {
1096
1367
  "id": {
1097
1368
  "name": "id",
1098
1369
  "type": "uuid",
1099
1370
  "primaryKey": true,
1100
- "notNull": true,
1101
- "default": "gen_random_uuid()"
1371
+ "notNull": true
1102
1372
  },
1103
- "slug": {
1104
- "name": "slug",
1373
+ "connection_id": {
1374
+ "name": "connection_id",
1375
+ "type": "uuid",
1376
+ "primaryKey": false,
1377
+ "notNull": true
1378
+ },
1379
+ "tool": {
1380
+ "name": "tool",
1105
1381
  "type": "text",
1106
1382
  "primaryKey": false,
1107
1383
  "notNull": true
1108
1384
  },
1109
- "name": {
1110
- "name": "name",
1385
+ "arguments": {
1386
+ "name": "arguments",
1111
1387
  "type": "text",
1112
1388
  "primaryKey": false,
1113
1389
  "notNull": true
1114
1390
  },
1391
+ "digest": {
1392
+ "name": "digest",
1393
+ "type": "bytea",
1394
+ "primaryKey": false,
1395
+ "notNull": true
1396
+ },
1397
+ "status": {
1398
+ "name": "status",
1399
+ "type": "text",
1400
+ "primaryKey": false,
1401
+ "notNull": true,
1402
+ "default": "'pending'"
1403
+ },
1404
+ "outcome": {
1405
+ "name": "outcome",
1406
+ "type": "text",
1407
+ "primaryKey": false,
1408
+ "notNull": false
1409
+ },
1115
1410
  "created_at": {
1116
1411
  "name": "created_at",
1117
1412
  "type": "timestamp with time zone",
@@ -1119,32 +1414,646 @@
1119
1414
  "notNull": true,
1120
1415
  "default": "now()"
1121
1416
  },
1122
- "archived_at": {
1123
- "name": "archived_at",
1417
+ "expires_at": {
1418
+ "name": "expires_at",
1419
+ "type": "timestamp with time zone",
1420
+ "primaryKey": false,
1421
+ "notNull": true
1422
+ },
1423
+ "decided_at": {
1424
+ "name": "decided_at",
1425
+ "type": "timestamp with time zone",
1426
+ "primaryKey": false,
1427
+ "notNull": false
1428
+ },
1429
+ "reported_at": {
1430
+ "name": "reported_at",
1124
1431
  "type": "timestamp with time zone",
1125
1432
  "primaryKey": false,
1126
1433
  "notNull": false
1127
1434
  }
1128
1435
  },
1129
- "indexes": {},
1130
- "foreignKeys": {},
1131
- "compositePrimaryKeys": {},
1132
- "uniqueConstraints": {
1133
- "projects_slug_key": {
1436
+ "indexes": {
1437
+ "mcp_approvals_open_idx": {
1438
+ "name": "mcp_approvals_open_idx",
1439
+ "columns": [
1440
+ {
1441
+ "expression": "connection_id",
1442
+ "isExpression": false,
1443
+ "asc": true,
1444
+ "nulls": "last"
1445
+ },
1446
+ {
1447
+ "expression": "digest",
1448
+ "isExpression": false,
1449
+ "asc": true,
1450
+ "nulls": "last"
1451
+ }
1452
+ ],
1453
+ "isUnique": false,
1454
+ "where": "\"mcp_approvals\".\"reported_at\" IS NULL",
1455
+ "concurrently": false,
1456
+ "method": "btree",
1457
+ "with": {}
1458
+ }
1459
+ },
1460
+ "foreignKeys": {
1461
+ "mcp_approvals_connection_fkey": {
1462
+ "name": "mcp_approvals_connection_fkey",
1463
+ "tableFrom": "mcp_approvals",
1464
+ "tableTo": "mcp_connections",
1465
+ "columnsFrom": [
1466
+ "connection_id"
1467
+ ],
1468
+ "columnsTo": [
1469
+ "id"
1470
+ ],
1471
+ "onDelete": "restrict",
1472
+ "onUpdate": "no action"
1473
+ }
1474
+ },
1475
+ "compositePrimaryKeys": {},
1476
+ "uniqueConstraints": {},
1477
+ "policies": {},
1478
+ "checkConstraints": {
1479
+ "mcp_approvals_status_check": {
1480
+ "name": "mcp_approvals_status_check",
1481
+ "value": "\"mcp_approvals\".\"status\" IN ('pending', 'approved', 'denied', 'cancelled', 'failed')"
1482
+ },
1483
+ "mcp_approvals_digest_check": {
1484
+ "name": "mcp_approvals_digest_check",
1485
+ "value": "octet_length(\"mcp_approvals\".\"digest\") = 32"
1486
+ },
1487
+ "mcp_approvals_arguments_check": {
1488
+ "name": "mcp_approvals_arguments_check",
1489
+ "value": "\"mcp_approvals\".\"arguments\"::jsonb IS NOT NULL"
1490
+ }
1491
+ },
1492
+ "isRLSEnabled": false
1493
+ },
1494
+ "public.mcp_connections": {
1495
+ "name": "mcp_connections",
1496
+ "schema": "",
1497
+ "columns": {
1498
+ "id": {
1499
+ "name": "id",
1500
+ "type": "uuid",
1501
+ "primaryKey": true,
1502
+ "notNull": true
1503
+ },
1504
+ "auth_mac": {
1505
+ "name": "auth_mac",
1506
+ "type": "bytea",
1507
+ "primaryKey": false,
1508
+ "notNull": true
1509
+ },
1510
+ "principal": {
1511
+ "name": "principal",
1512
+ "type": "text",
1513
+ "primaryKey": false,
1514
+ "notNull": true
1515
+ },
1516
+ "generation": {
1517
+ "name": "generation",
1518
+ "type": "integer",
1519
+ "primaryKey": false,
1520
+ "notNull": true
1521
+ },
1522
+ "client_id": {
1523
+ "name": "client_id",
1524
+ "type": "text",
1525
+ "primaryKey": false,
1526
+ "notNull": true
1527
+ },
1528
+ "client_name": {
1529
+ "name": "client_name",
1530
+ "type": "text",
1531
+ "primaryKey": false,
1532
+ "notNull": true
1533
+ },
1534
+ "client_host": {
1535
+ "name": "client_host",
1536
+ "type": "text",
1537
+ "primaryKey": false,
1538
+ "notNull": false
1539
+ },
1540
+ "registration": {
1541
+ "name": "registration",
1542
+ "type": "text",
1543
+ "primaryKey": false,
1544
+ "notNull": true
1545
+ },
1546
+ "scopes": {
1547
+ "name": "scopes",
1548
+ "type": "text",
1549
+ "primaryKey": false,
1550
+ "notNull": true
1551
+ },
1552
+ "redirect_uri": {
1553
+ "name": "redirect_uri",
1554
+ "type": "text",
1555
+ "primaryKey": false,
1556
+ "notNull": true
1557
+ },
1558
+ "code_hash": {
1559
+ "name": "code_hash",
1560
+ "type": "bytea",
1561
+ "primaryKey": false,
1562
+ "notNull": false
1563
+ },
1564
+ "code_challenge": {
1565
+ "name": "code_challenge",
1566
+ "type": "text",
1567
+ "primaryKey": false,
1568
+ "notNull": false
1569
+ },
1570
+ "code_expires_at": {
1571
+ "name": "code_expires_at",
1572
+ "type": "timestamp with time zone",
1573
+ "primaryKey": false,
1574
+ "notNull": false
1575
+ },
1576
+ "refresh_hash": {
1577
+ "name": "refresh_hash",
1578
+ "type": "bytea",
1579
+ "primaryKey": false,
1580
+ "notNull": false
1581
+ },
1582
+ "refresh_previous_hash": {
1583
+ "name": "refresh_previous_hash",
1584
+ "type": "bytea",
1585
+ "primaryKey": false,
1586
+ "notNull": false
1587
+ },
1588
+ "expires_at": {
1589
+ "name": "expires_at",
1590
+ "type": "timestamp with time zone",
1591
+ "primaryKey": false,
1592
+ "notNull": true
1593
+ },
1594
+ "created_at": {
1595
+ "name": "created_at",
1596
+ "type": "timestamp with time zone",
1597
+ "primaryKey": false,
1598
+ "notNull": true,
1599
+ "default": "now()"
1600
+ },
1601
+ "last_used_at": {
1602
+ "name": "last_used_at",
1603
+ "type": "timestamp with time zone",
1604
+ "primaryKey": false,
1605
+ "notNull": false
1606
+ },
1607
+ "last_used_ip": {
1608
+ "name": "last_used_ip",
1609
+ "type": "text",
1610
+ "primaryKey": false,
1611
+ "notNull": false
1612
+ },
1613
+ "revoked_at": {
1614
+ "name": "revoked_at",
1615
+ "type": "timestamp with time zone",
1616
+ "primaryKey": false,
1617
+ "notNull": false
1618
+ },
1619
+ "revoked_by": {
1620
+ "name": "revoked_by",
1621
+ "type": "text",
1622
+ "primaryKey": false,
1623
+ "notNull": false
1624
+ }
1625
+ },
1626
+ "indexes": {
1627
+ "mcp_connections_refresh_previous_idx": {
1628
+ "name": "mcp_connections_refresh_previous_idx",
1629
+ "columns": [
1630
+ {
1631
+ "expression": "refresh_previous_hash",
1632
+ "isExpression": false,
1633
+ "asc": true,
1634
+ "nulls": "last"
1635
+ }
1636
+ ],
1637
+ "isUnique": false,
1638
+ "concurrently": false,
1639
+ "method": "btree",
1640
+ "with": {}
1641
+ },
1642
+ "mcp_connections_live_idx": {
1643
+ "name": "mcp_connections_live_idx",
1644
+ "columns": [
1645
+ {
1646
+ "expression": "principal",
1647
+ "isExpression": false,
1648
+ "asc": true,
1649
+ "nulls": "last"
1650
+ },
1651
+ {
1652
+ "expression": "expires_at",
1653
+ "isExpression": false,
1654
+ "asc": true,
1655
+ "nulls": "last"
1656
+ }
1657
+ ],
1658
+ "isUnique": false,
1659
+ "where": "\"mcp_connections\".\"revoked_at\" IS NULL",
1660
+ "concurrently": false,
1661
+ "method": "btree",
1662
+ "with": {}
1663
+ }
1664
+ },
1665
+ "foreignKeys": {
1666
+ "mcp_connections_principal_fkey": {
1667
+ "name": "mcp_connections_principal_fkey",
1668
+ "tableFrom": "mcp_connections",
1669
+ "tableTo": "vault_members",
1670
+ "columnsFrom": [
1671
+ "principal"
1672
+ ],
1673
+ "columnsTo": [
1674
+ "principal"
1675
+ ],
1676
+ "onDelete": "restrict",
1677
+ "onUpdate": "no action"
1678
+ }
1679
+ },
1680
+ "compositePrimaryKeys": {},
1681
+ "uniqueConstraints": {
1682
+ "mcp_connections_code_hash_key": {
1683
+ "name": "mcp_connections_code_hash_key",
1684
+ "nullsNotDistinct": false,
1685
+ "columns": [
1686
+ "code_hash"
1687
+ ]
1688
+ },
1689
+ "mcp_connections_refresh_hash_key": {
1690
+ "name": "mcp_connections_refresh_hash_key",
1691
+ "nullsNotDistinct": false,
1692
+ "columns": [
1693
+ "refresh_hash"
1694
+ ]
1695
+ }
1696
+ },
1697
+ "policies": {},
1698
+ "checkConstraints": {
1699
+ "mcp_connections_principal_check": {
1700
+ "name": "mcp_connections_principal_check",
1701
+ "value": "\"mcp_connections\".\"principal\" LIKE 'user:%'"
1702
+ },
1703
+ "mcp_connections_registration_check": {
1704
+ "name": "mcp_connections_registration_check",
1705
+ "value": "\"mcp_connections\".\"registration\" IN ('cimd', 'dcr')"
1706
+ },
1707
+ "mcp_connections_auth_mac_check": {
1708
+ "name": "mcp_connections_auth_mac_check",
1709
+ "value": "octet_length(\"mcp_connections\".\"auth_mac\") = 32"
1710
+ },
1711
+ "mcp_connections_code_hash_check": {
1712
+ "name": "mcp_connections_code_hash_check",
1713
+ "value": "\"mcp_connections\".\"code_hash\" IS NULL OR octet_length(\"mcp_connections\".\"code_hash\") = 32"
1714
+ },
1715
+ "mcp_connections_refresh_hash_check": {
1716
+ "name": "mcp_connections_refresh_hash_check",
1717
+ "value": "\"mcp_connections\".\"refresh_hash\" IS NULL OR octet_length(\"mcp_connections\".\"refresh_hash\") = 32"
1718
+ }
1719
+ },
1720
+ "isRLSEnabled": false
1721
+ },
1722
+ "public.oauth_clients": {
1723
+ "name": "oauth_clients",
1724
+ "schema": "",
1725
+ "columns": {
1726
+ "id": {
1727
+ "name": "id",
1728
+ "type": "uuid",
1729
+ "primaryKey": true,
1730
+ "notNull": true
1731
+ },
1732
+ "auth_mac": {
1733
+ "name": "auth_mac",
1734
+ "type": "bytea",
1735
+ "primaryKey": false,
1736
+ "notNull": true
1737
+ },
1738
+ "name": {
1739
+ "name": "name",
1740
+ "type": "text",
1741
+ "primaryKey": false,
1742
+ "notNull": true
1743
+ },
1744
+ "redirect_uris": {
1745
+ "name": "redirect_uris",
1746
+ "type": "text",
1747
+ "primaryKey": false,
1748
+ "notNull": true
1749
+ },
1750
+ "created_at": {
1751
+ "name": "created_at",
1752
+ "type": "timestamp with time zone",
1753
+ "primaryKey": false,
1754
+ "notNull": true,
1755
+ "default": "now()"
1756
+ },
1757
+ "created_ip": {
1758
+ "name": "created_ip",
1759
+ "type": "text",
1760
+ "primaryKey": false,
1761
+ "notNull": false
1762
+ },
1763
+ "revoked_at": {
1764
+ "name": "revoked_at",
1765
+ "type": "timestamp with time zone",
1766
+ "primaryKey": false,
1767
+ "notNull": false
1768
+ }
1769
+ },
1770
+ "indexes": {},
1771
+ "foreignKeys": {},
1772
+ "compositePrimaryKeys": {},
1773
+ "uniqueConstraints": {},
1774
+ "policies": {},
1775
+ "checkConstraints": {
1776
+ "oauth_clients_auth_mac_check": {
1777
+ "name": "oauth_clients_auth_mac_check",
1778
+ "value": "octet_length(\"oauth_clients\".\"auth_mac\") = 32"
1779
+ },
1780
+ "oauth_clients_redirect_uris_check": {
1781
+ "name": "oauth_clients_redirect_uris_check",
1782
+ "value": "\"oauth_clients\".\"redirect_uris\"::jsonb IS NOT NULL"
1783
+ }
1784
+ },
1785
+ "isRLSEnabled": false
1786
+ },
1787
+ "public.projects": {
1788
+ "name": "projects",
1789
+ "schema": "",
1790
+ "columns": {
1791
+ "id": {
1792
+ "name": "id",
1793
+ "type": "uuid",
1794
+ "primaryKey": true,
1795
+ "notNull": true,
1796
+ "default": "gen_random_uuid()"
1797
+ },
1798
+ "slug": {
1799
+ "name": "slug",
1800
+ "type": "text",
1801
+ "primaryKey": false,
1802
+ "notNull": true
1803
+ },
1804
+ "name": {
1805
+ "name": "name",
1806
+ "type": "text",
1807
+ "primaryKey": false,
1808
+ "notNull": true
1809
+ },
1810
+ "created_at": {
1811
+ "name": "created_at",
1812
+ "type": "timestamp with time zone",
1813
+ "primaryKey": false,
1814
+ "notNull": true,
1815
+ "default": "now()"
1816
+ },
1817
+ "archived_at": {
1818
+ "name": "archived_at",
1819
+ "type": "timestamp with time zone",
1820
+ "primaryKey": false,
1821
+ "notNull": false
1822
+ },
1823
+ "folder": {
1824
+ "name": "folder",
1825
+ "type": "text",
1826
+ "primaryKey": false,
1827
+ "notNull": false
1828
+ }
1829
+ },
1830
+ "indexes": {},
1831
+ "foreignKeys": {},
1832
+ "compositePrimaryKeys": {},
1833
+ "uniqueConstraints": {
1834
+ "projects_slug_key": {
1134
1835
  "name": "projects_slug_key",
1135
1836
  "nullsNotDistinct": false,
1136
1837
  "columns": [
1137
- "slug"
1838
+ "slug"
1839
+ ]
1840
+ }
1841
+ },
1842
+ "policies": {},
1843
+ "checkConstraints": {
1844
+ "projects_slug_check": {
1845
+ "name": "projects_slug_check",
1846
+ "value": "\"projects\".\"slug\" ~ '^[a-z0-9][a-z0-9-]{0,62}(~[a-z0-9-]{1,40})?$'"
1847
+ },
1848
+ "projects_folder_check": {
1849
+ "name": "projects_folder_check",
1850
+ "value": "\"projects\".\"folder\" IS NULL OR (char_length(\"projects\".\"folder\") BETWEEN 1 AND 64 AND \"projects\".\"folder\" !~ '[/[:cntrl:]]' AND \"projects\".\"folder\" = btrim(\"projects\".\"folder\"))"
1851
+ }
1852
+ },
1853
+ "isRLSEnabled": false
1854
+ },
1855
+ "public.secret_references": {
1856
+ "name": "secret_references",
1857
+ "schema": "",
1858
+ "columns": {
1859
+ "id": {
1860
+ "name": "id",
1861
+ "type": "uuid",
1862
+ "primaryKey": true,
1863
+ "notNull": true
1864
+ },
1865
+ "project_id": {
1866
+ "name": "project_id",
1867
+ "type": "uuid",
1868
+ "primaryKey": false,
1869
+ "notNull": true
1870
+ },
1871
+ "environment_id": {
1872
+ "name": "environment_id",
1873
+ "type": "uuid",
1874
+ "primaryKey": false,
1875
+ "notNull": true
1876
+ },
1877
+ "secret_id": {
1878
+ "name": "secret_id",
1879
+ "type": "uuid",
1880
+ "primaryKey": false,
1881
+ "notNull": true
1882
+ },
1883
+ "source_project_id": {
1884
+ "name": "source_project_id",
1885
+ "type": "uuid",
1886
+ "primaryKey": false,
1887
+ "notNull": true
1888
+ },
1889
+ "source_environment_id": {
1890
+ "name": "source_environment_id",
1891
+ "type": "uuid",
1892
+ "primaryKey": false,
1893
+ "notNull": true
1894
+ },
1895
+ "source_secret_id": {
1896
+ "name": "source_secret_id",
1897
+ "type": "uuid",
1898
+ "primaryKey": false,
1899
+ "notNull": true
1900
+ },
1901
+ "created_seq": {
1902
+ "name": "created_seq",
1903
+ "type": "bigint",
1904
+ "primaryKey": false,
1905
+ "notNull": true
1906
+ },
1907
+ "created_at": {
1908
+ "name": "created_at",
1909
+ "type": "timestamp with time zone",
1910
+ "primaryKey": false,
1911
+ "notNull": true,
1912
+ "default": "now()"
1913
+ },
1914
+ "created_by": {
1915
+ "name": "created_by",
1916
+ "type": "text",
1917
+ "primaryKey": false,
1918
+ "notNull": true
1919
+ }
1920
+ },
1921
+ "indexes": {
1922
+ "secret_references_holder_idx": {
1923
+ "name": "secret_references_holder_idx",
1924
+ "columns": [
1925
+ {
1926
+ "expression": "secret_id",
1927
+ "isExpression": false,
1928
+ "asc": true,
1929
+ "nulls": "last"
1930
+ },
1931
+ {
1932
+ "expression": "created_seq",
1933
+ "isExpression": false,
1934
+ "asc": true,
1935
+ "nulls": "last"
1936
+ }
1937
+ ],
1938
+ "isUnique": false,
1939
+ "concurrently": false,
1940
+ "method": "btree",
1941
+ "with": {}
1942
+ },
1943
+ "secret_references_source_idx": {
1944
+ "name": "secret_references_source_idx",
1945
+ "columns": [
1946
+ {
1947
+ "expression": "source_secret_id",
1948
+ "isExpression": false,
1949
+ "asc": true,
1950
+ "nulls": "last"
1951
+ }
1952
+ ],
1953
+ "isUnique": false,
1954
+ "concurrently": false,
1955
+ "method": "btree",
1956
+ "with": {}
1957
+ },
1958
+ "secret_references_project_idx": {
1959
+ "name": "secret_references_project_idx",
1960
+ "columns": [
1961
+ {
1962
+ "expression": "project_id",
1963
+ "isExpression": false,
1964
+ "asc": true,
1965
+ "nulls": "last"
1966
+ }
1967
+ ],
1968
+ "isUnique": false,
1969
+ "concurrently": false,
1970
+ "method": "btree",
1971
+ "with": {}
1972
+ },
1973
+ "secret_references_source_project_idx": {
1974
+ "name": "secret_references_source_project_idx",
1975
+ "columns": [
1976
+ {
1977
+ "expression": "source_project_id",
1978
+ "isExpression": false,
1979
+ "asc": true,
1980
+ "nulls": "last"
1981
+ }
1982
+ ],
1983
+ "isUnique": false,
1984
+ "concurrently": false,
1985
+ "method": "btree",
1986
+ "with": {}
1987
+ },
1988
+ "secret_references_created_by_idx": {
1989
+ "name": "secret_references_created_by_idx",
1990
+ "columns": [
1991
+ {
1992
+ "expression": "created_by",
1993
+ "isExpression": false,
1994
+ "asc": true,
1995
+ "nulls": "last"
1996
+ }
1997
+ ],
1998
+ "isUnique": false,
1999
+ "concurrently": false,
2000
+ "method": "btree",
2001
+ "with": {}
2002
+ }
2003
+ },
2004
+ "foreignKeys": {
2005
+ "secret_references_secret_id_fkey": {
2006
+ "name": "secret_references_secret_id_fkey",
2007
+ "tableFrom": "secret_references",
2008
+ "tableTo": "secrets",
2009
+ "columnsFrom": [
2010
+ "secret_id"
2011
+ ],
2012
+ "columnsTo": [
2013
+ "id"
2014
+ ],
2015
+ "onDelete": "restrict",
2016
+ "onUpdate": "no action"
2017
+ },
2018
+ "secret_references_source_secret_id_fkey": {
2019
+ "name": "secret_references_source_secret_id_fkey",
2020
+ "tableFrom": "secret_references",
2021
+ "tableTo": "secrets",
2022
+ "columnsFrom": [
2023
+ "source_secret_id"
2024
+ ],
2025
+ "columnsTo": [
2026
+ "id"
2027
+ ],
2028
+ "onDelete": "restrict",
2029
+ "onUpdate": "no action"
2030
+ },
2031
+ "secret_references_created_seq_fkey": {
2032
+ "name": "secret_references_created_seq_fkey",
2033
+ "tableFrom": "secret_references",
2034
+ "tableTo": "audit_log",
2035
+ "columnsFrom": [
2036
+ "created_seq"
2037
+ ],
2038
+ "columnsTo": [
2039
+ "seq"
2040
+ ],
2041
+ "onDelete": "restrict",
2042
+ "onUpdate": "no action"
2043
+ }
2044
+ },
2045
+ "compositePrimaryKeys": {},
2046
+ "uniqueConstraints": {
2047
+ "secret_references_created_seq_key": {
2048
+ "name": "secret_references_created_seq_key",
2049
+ "nullsNotDistinct": false,
2050
+ "columns": [
2051
+ "created_seq"
1138
2052
  ]
1139
2053
  }
1140
2054
  },
1141
2055
  "policies": {},
1142
- "checkConstraints": {
1143
- "projects_slug_check": {
1144
- "name": "projects_slug_check",
1145
- "value": "\"projects\".\"slug\" ~ '^[a-z0-9][a-z0-9-]{0,62}$'"
1146
- }
1147
- },
2056
+ "checkConstraints": {},
1148
2057
  "isRLSEnabled": false
1149
2058
  },
1150
2059
  "public.secret_versions": {
@@ -1359,6 +2268,12 @@
1359
2268
  "type": "timestamp with time zone",
1360
2269
  "primaryKey": false,
1361
2270
  "notNull": false
2271
+ },
2272
+ "folder": {
2273
+ "name": "folder",
2274
+ "type": "text",
2275
+ "primaryKey": false,
2276
+ "notNull": false
1362
2277
  }
1363
2278
  },
1364
2279
  "indexes": {
@@ -1463,6 +2378,197 @@
1463
2378
  "secrets_key_check": {
1464
2379
  "name": "secrets_key_check",
1465
2380
  "value": "\"secrets\".\"key\" ~ '^[A-Za-z_][A-Za-z0-9_]{0,127}$'"
2381
+ },
2382
+ "secrets_folder_check": {
2383
+ "name": "secrets_folder_check",
2384
+ "value": "\"secrets\".\"folder\" IS NULL OR (char_length(\"secrets\".\"folder\") BETWEEN 1 AND 64 AND \"secrets\".\"folder\" !~ '[/[:cntrl:]]' AND \"secrets\".\"folder\" = btrim(\"secrets\".\"folder\"))"
2385
+ }
2386
+ },
2387
+ "isRLSEnabled": false
2388
+ },
2389
+ "public.service_bindings": {
2390
+ "name": "service_bindings",
2391
+ "schema": "",
2392
+ "columns": {
2393
+ "id": {
2394
+ "name": "id",
2395
+ "type": "uuid",
2396
+ "primaryKey": true,
2397
+ "notNull": true
2398
+ },
2399
+ "auth_mac": {
2400
+ "name": "auth_mac",
2401
+ "type": "bytea",
2402
+ "primaryKey": false,
2403
+ "notNull": true
2404
+ },
2405
+ "principal": {
2406
+ "name": "principal",
2407
+ "type": "text",
2408
+ "primaryKey": false,
2409
+ "notNull": true
2410
+ },
2411
+ "generation": {
2412
+ "name": "generation",
2413
+ "type": "integer",
2414
+ "primaryKey": false,
2415
+ "notNull": true
2416
+ },
2417
+ "profile": {
2418
+ "name": "profile",
2419
+ "type": "text",
2420
+ "primaryKey": false,
2421
+ "notNull": true
2422
+ },
2423
+ "issuer": {
2424
+ "name": "issuer",
2425
+ "type": "text",
2426
+ "primaryKey": false,
2427
+ "notNull": true
2428
+ },
2429
+ "jwks_uri": {
2430
+ "name": "jwks_uri",
2431
+ "type": "text",
2432
+ "primaryKey": false,
2433
+ "notNull": true
2434
+ },
2435
+ "claims": {
2436
+ "name": "claims",
2437
+ "type": "text",
2438
+ "primaryKey": false,
2439
+ "notNull": true
2440
+ },
2441
+ "label": {
2442
+ "name": "label",
2443
+ "type": "text",
2444
+ "primaryKey": false,
2445
+ "notNull": false
2446
+ },
2447
+ "created_at": {
2448
+ "name": "created_at",
2449
+ "type": "timestamp with time zone",
2450
+ "primaryKey": false,
2451
+ "notNull": true,
2452
+ "default": "now()"
2453
+ },
2454
+ "created_by": {
2455
+ "name": "created_by",
2456
+ "type": "text",
2457
+ "primaryKey": false,
2458
+ "notNull": true
2459
+ },
2460
+ "last_used_at": {
2461
+ "name": "last_used_at",
2462
+ "type": "timestamp with time zone",
2463
+ "primaryKey": false,
2464
+ "notNull": false
2465
+ },
2466
+ "revoked_at": {
2467
+ "name": "revoked_at",
2468
+ "type": "timestamp with time zone",
2469
+ "primaryKey": false,
2470
+ "notNull": false
2471
+ },
2472
+ "revoked_by": {
2473
+ "name": "revoked_by",
2474
+ "type": "text",
2475
+ "primaryKey": false,
2476
+ "notNull": false
2477
+ }
2478
+ },
2479
+ "indexes": {
2480
+ "service_bindings_principal_idx": {
2481
+ "name": "service_bindings_principal_idx",
2482
+ "columns": [
2483
+ {
2484
+ "expression": "principal",
2485
+ "isExpression": false,
2486
+ "asc": true,
2487
+ "nulls": "last"
2488
+ },
2489
+ {
2490
+ "expression": "issuer",
2491
+ "isExpression": false,
2492
+ "asc": true,
2493
+ "nulls": "last"
2494
+ }
2495
+ ],
2496
+ "isUnique": false,
2497
+ "concurrently": false,
2498
+ "method": "btree",
2499
+ "with": {}
2500
+ },
2501
+ "service_bindings_live_idx": {
2502
+ "name": "service_bindings_live_idx",
2503
+ "columns": [
2504
+ {
2505
+ "expression": "principal",
2506
+ "isExpression": false,
2507
+ "asc": true,
2508
+ "nulls": "last"
2509
+ },
2510
+ {
2511
+ "expression": "issuer",
2512
+ "isExpression": false,
2513
+ "asc": true,
2514
+ "nulls": "last"
2515
+ },
2516
+ {
2517
+ "expression": "generation",
2518
+ "isExpression": false,
2519
+ "asc": true,
2520
+ "nulls": "last"
2521
+ },
2522
+ {
2523
+ "expression": "created_at",
2524
+ "isExpression": false,
2525
+ "asc": true,
2526
+ "nulls": "last"
2527
+ },
2528
+ {
2529
+ "expression": "id",
2530
+ "isExpression": false,
2531
+ "asc": true,
2532
+ "nulls": "last"
2533
+ }
2534
+ ],
2535
+ "isUnique": false,
2536
+ "where": "\"service_bindings\".\"revoked_at\" IS NULL",
2537
+ "concurrently": false,
2538
+ "method": "btree",
2539
+ "with": {}
2540
+ }
2541
+ },
2542
+ "foreignKeys": {
2543
+ "service_bindings_principal_fkey": {
2544
+ "name": "service_bindings_principal_fkey",
2545
+ "tableFrom": "service_bindings",
2546
+ "tableTo": "vault_members",
2547
+ "columnsFrom": [
2548
+ "principal"
2549
+ ],
2550
+ "columnsTo": [
2551
+ "principal"
2552
+ ],
2553
+ "onDelete": "restrict",
2554
+ "onUpdate": "no action"
2555
+ }
2556
+ },
2557
+ "compositePrimaryKeys": {},
2558
+ "uniqueConstraints": {},
2559
+ "policies": {},
2560
+ "checkConstraints": {
2561
+ "service_bindings_principal_check": {
2562
+ "name": "service_bindings_principal_check",
2563
+ "value": "\"service_bindings\".\"principal\" LIKE 'token:%'"
2564
+ },
2565
+ "service_bindings_auth_mac_check": {
2566
+ "name": "service_bindings_auth_mac_check",
2567
+ "value": "octet_length(\"service_bindings\".\"auth_mac\") = 32"
2568
+ },
2569
+ "service_bindings_claims_check": {
2570
+ "name": "service_bindings_claims_check",
2571
+ "value": "\"service_bindings\".\"claims\"::jsonb IS NOT NULL"
1466
2572
  }
1467
2573
  },
1468
2574
  "isRLSEnabled": false
@@ -1489,6 +2595,12 @@
1489
2595
  "primaryKey": false,
1490
2596
  "notNull": false
1491
2597
  },
2598
+ "environment_slug": {
2599
+ "name": "environment_slug",
2600
+ "type": "text",
2601
+ "primaryKey": false,
2602
+ "notNull": false
2603
+ },
1492
2604
  "role": {
1493
2605
  "name": "role",
1494
2606
  "type": "text",
@@ -1514,7 +2626,24 @@
1514
2626
  "notNull": true
1515
2627
  }
1516
2628
  },
1517
- "indexes": {},
2629
+ "indexes": {
2630
+ "vault_grants_on_every_project": {
2631
+ "name": "vault_grants_on_every_project",
2632
+ "columns": [
2633
+ {
2634
+ "expression": "principal",
2635
+ "isExpression": false,
2636
+ "asc": true,
2637
+ "nulls": "last"
2638
+ }
2639
+ ],
2640
+ "isUnique": true,
2641
+ "where": "\"vault_grants\".\"project_id\" IS NULL AND \"vault_grants\".\"environment_id\" IS NULL AND \"vault_grants\".\"environment_slug\" IS NULL",
2642
+ "concurrently": false,
2643
+ "method": "btree",
2644
+ "with": {}
2645
+ }
2646
+ },
1518
2647
  "foreignKeys": {
1519
2648
  "vault_grants_principal_fkey": {
1520
2649
  "name": "vault_grants_principal_fkey",
@@ -1573,13 +2702,25 @@
1573
2702
  "principal",
1574
2703
  "environment_id"
1575
2704
  ]
2705
+ },
2706
+ "vault_grants_on_environment_slug": {
2707
+ "name": "vault_grants_on_environment_slug",
2708
+ "nullsNotDistinct": false,
2709
+ "columns": [
2710
+ "principal",
2711
+ "environment_slug"
2712
+ ]
1576
2713
  }
1577
2714
  },
1578
2715
  "policies": {},
1579
2716
  "checkConstraints": {
1580
2717
  "vault_grants_one_place": {
1581
2718
  "name": "vault_grants_one_place",
1582
- "value": "(\"vault_grants\".\"project_id\" IS NULL) <> (\"vault_grants\".\"environment_id\" IS NULL)"
2719
+ "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)"
2720
+ },
2721
+ "vault_grants_environment_slug_check": {
2722
+ "name": "vault_grants_environment_slug_check",
2723
+ "value": "\"vault_grants\".\"environment_slug\" IS NULL OR \"vault_grants\".\"environment_slug\" ~ '^[a-z0-9][a-z0-9-]{0,62}$'"
1583
2724
  },
1584
2725
  "vault_grants_role_check": {
1585
2726
  "name": "vault_grants_role_check",
@@ -1587,7 +2728,7 @@
1587
2728
  },
1588
2729
  "vault_grants_environment_role_check": {
1589
2730
  "name": "vault_grants_environment_role_check",
1590
- "value": "\"vault_grants\".\"environment_id\" IS NULL OR \"vault_grants\".\"role\" IN ('viewer', 'developer', 'auditor')"
2731
+ "value": "(\"vault_grants\".\"environment_id\" IS NULL AND \"vault_grants\".\"environment_slug\" IS NULL) OR \"vault_grants\".\"role\" IN ('viewer', 'developer', 'auditor')"
1591
2732
  }
1592
2733
  },
1593
2734
  "isRLSEnabled": false
@@ -1671,7 +2812,7 @@
1671
2812
  },
1672
2813
  "vault_members_principal_check": {
1673
2814
  "name": "vault_members_principal_check",
1674
- "value": "\"vault_members\".\"principal\" ~ '^(user|token|sync):[^[:space:]:][^[:space:]]*$'"
2815
+ "value": "\"vault_members\".\"principal\" ~ '^(user|token):[^[:space:]:][^[:space:]]*$'"
1675
2816
  },
1676
2817
  "vault_members_user_lowercase": {
1677
2818
  "name": "vault_members_user_lowercase",