@coffre/db 0.3.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,5 +1,5 @@
1
1
  {
2
- "id": "b76d9374-5d86-42d1-9d06-1af17adadd6b",
2
+ "id": "52e2bd4a-ba59-41f7-890c-edfa62f0425d",
3
3
  "prevId": "00000000-0000-0000-0000-000000000000",
4
4
  "version": "7",
5
5
  "dialect": "postgresql",
@@ -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,62 +1360,569 @@
1089
1360
  },
1090
1361
  "isRLSEnabled": false
1091
1362
  },
1092
- "public.projects": {
1093
- "name": "projects",
1363
+ "public.mcp_connections": {
1364
+ "name": "mcp_connections",
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
+ "auth_mac": {
1374
+ "name": "auth_mac",
1375
+ "type": "bytea",
1376
+ "primaryKey": false,
1377
+ "notNull": true
1378
+ },
1379
+ "principal": {
1380
+ "name": "principal",
1105
1381
  "type": "text",
1106
1382
  "primaryKey": false,
1107
1383
  "notNull": true
1108
1384
  },
1109
- "name": {
1110
- "name": "name",
1385
+ "generation": {
1386
+ "name": "generation",
1387
+ "type": "integer",
1388
+ "primaryKey": false,
1389
+ "notNull": true
1390
+ },
1391
+ "client_id": {
1392
+ "name": "client_id",
1111
1393
  "type": "text",
1112
1394
  "primaryKey": false,
1113
1395
  "notNull": true
1114
1396
  },
1115
- "created_at": {
1116
- "name": "created_at",
1117
- "type": "timestamp with time zone",
1397
+ "client_name": {
1398
+ "name": "client_name",
1399
+ "type": "text",
1118
1400
  "primaryKey": false,
1119
- "notNull": true,
1120
- "default": "now()"
1401
+ "notNull": true
1121
1402
  },
1122
- "archived_at": {
1123
- "name": "archived_at",
1124
- "type": "timestamp with time zone",
1403
+ "client_host": {
1404
+ "name": "client_host",
1405
+ "type": "text",
1125
1406
  "primaryKey": false,
1126
1407
  "notNull": false
1127
- }
1128
- },
1129
- "indexes": {},
1130
- "foreignKeys": {},
1131
- "compositePrimaryKeys": {},
1132
- "uniqueConstraints": {
1133
- "projects_slug_key": {
1134
- "name": "projects_slug_key",
1135
- "nullsNotDistinct": false,
1136
- "columns": [
1137
- "slug"
1408
+ },
1409
+ "registration": {
1410
+ "name": "registration",
1411
+ "type": "text",
1412
+ "primaryKey": false,
1413
+ "notNull": true
1414
+ },
1415
+ "scopes": {
1416
+ "name": "scopes",
1417
+ "type": "text",
1418
+ "primaryKey": false,
1419
+ "notNull": true
1420
+ },
1421
+ "redirect_uri": {
1422
+ "name": "redirect_uri",
1423
+ "type": "text",
1424
+ "primaryKey": false,
1425
+ "notNull": true
1426
+ },
1427
+ "code_hash": {
1428
+ "name": "code_hash",
1429
+ "type": "bytea",
1430
+ "primaryKey": false,
1431
+ "notNull": false
1432
+ },
1433
+ "code_challenge": {
1434
+ "name": "code_challenge",
1435
+ "type": "text",
1436
+ "primaryKey": false,
1437
+ "notNull": false
1438
+ },
1439
+ "code_expires_at": {
1440
+ "name": "code_expires_at",
1441
+ "type": "timestamp with time zone",
1442
+ "primaryKey": false,
1443
+ "notNull": false
1444
+ },
1445
+ "refresh_hash": {
1446
+ "name": "refresh_hash",
1447
+ "type": "bytea",
1448
+ "primaryKey": false,
1449
+ "notNull": false
1450
+ },
1451
+ "refresh_previous_hash": {
1452
+ "name": "refresh_previous_hash",
1453
+ "type": "bytea",
1454
+ "primaryKey": false,
1455
+ "notNull": false
1456
+ },
1457
+ "expires_at": {
1458
+ "name": "expires_at",
1459
+ "type": "timestamp with time zone",
1460
+ "primaryKey": false,
1461
+ "notNull": true
1462
+ },
1463
+ "created_at": {
1464
+ "name": "created_at",
1465
+ "type": "timestamp with time zone",
1466
+ "primaryKey": false,
1467
+ "notNull": true,
1468
+ "default": "now()"
1469
+ },
1470
+ "last_used_at": {
1471
+ "name": "last_used_at",
1472
+ "type": "timestamp with time zone",
1473
+ "primaryKey": false,
1474
+ "notNull": false
1475
+ },
1476
+ "last_used_ip": {
1477
+ "name": "last_used_ip",
1478
+ "type": "text",
1479
+ "primaryKey": false,
1480
+ "notNull": false
1481
+ },
1482
+ "revoked_at": {
1483
+ "name": "revoked_at",
1484
+ "type": "timestamp with time zone",
1485
+ "primaryKey": false,
1486
+ "notNull": false
1487
+ },
1488
+ "revoked_by": {
1489
+ "name": "revoked_by",
1490
+ "type": "text",
1491
+ "primaryKey": false,
1492
+ "notNull": false
1493
+ }
1494
+ },
1495
+ "indexes": {
1496
+ "mcp_connections_refresh_previous_idx": {
1497
+ "name": "mcp_connections_refresh_previous_idx",
1498
+ "columns": [
1499
+ {
1500
+ "expression": "refresh_previous_hash",
1501
+ "isExpression": false,
1502
+ "asc": true,
1503
+ "nulls": "last"
1504
+ }
1505
+ ],
1506
+ "isUnique": false,
1507
+ "concurrently": false,
1508
+ "method": "btree",
1509
+ "with": {}
1510
+ },
1511
+ "mcp_connections_live_idx": {
1512
+ "name": "mcp_connections_live_idx",
1513
+ "columns": [
1514
+ {
1515
+ "expression": "principal",
1516
+ "isExpression": false,
1517
+ "asc": true,
1518
+ "nulls": "last"
1519
+ },
1520
+ {
1521
+ "expression": "expires_at",
1522
+ "isExpression": false,
1523
+ "asc": true,
1524
+ "nulls": "last"
1525
+ }
1526
+ ],
1527
+ "isUnique": false,
1528
+ "where": "\"mcp_connections\".\"revoked_at\" IS NULL",
1529
+ "concurrently": false,
1530
+ "method": "btree",
1531
+ "with": {}
1532
+ }
1533
+ },
1534
+ "foreignKeys": {
1535
+ "mcp_connections_principal_fkey": {
1536
+ "name": "mcp_connections_principal_fkey",
1537
+ "tableFrom": "mcp_connections",
1538
+ "tableTo": "vault_members",
1539
+ "columnsFrom": [
1540
+ "principal"
1541
+ ],
1542
+ "columnsTo": [
1543
+ "principal"
1544
+ ],
1545
+ "onDelete": "restrict",
1546
+ "onUpdate": "no action"
1547
+ }
1548
+ },
1549
+ "compositePrimaryKeys": {},
1550
+ "uniqueConstraints": {
1551
+ "mcp_connections_code_hash_key": {
1552
+ "name": "mcp_connections_code_hash_key",
1553
+ "nullsNotDistinct": false,
1554
+ "columns": [
1555
+ "code_hash"
1556
+ ]
1557
+ },
1558
+ "mcp_connections_refresh_hash_key": {
1559
+ "name": "mcp_connections_refresh_hash_key",
1560
+ "nullsNotDistinct": false,
1561
+ "columns": [
1562
+ "refresh_hash"
1138
1563
  ]
1139
1564
  }
1140
1565
  },
1141
- "policies": {},
1142
- "checkConstraints": {
1143
- "projects_slug_check": {
1144
- "name": "projects_slug_check",
1145
- "value": "\"projects\".\"slug\" ~ '^[a-z0-9][a-z0-9-]{0,62}$'"
1566
+ "policies": {},
1567
+ "checkConstraints": {
1568
+ "mcp_connections_principal_check": {
1569
+ "name": "mcp_connections_principal_check",
1570
+ "value": "\"mcp_connections\".\"principal\" LIKE 'user:%'"
1571
+ },
1572
+ "mcp_connections_registration_check": {
1573
+ "name": "mcp_connections_registration_check",
1574
+ "value": "\"mcp_connections\".\"registration\" IN ('cimd', 'dcr')"
1575
+ },
1576
+ "mcp_connections_auth_mac_check": {
1577
+ "name": "mcp_connections_auth_mac_check",
1578
+ "value": "octet_length(\"mcp_connections\".\"auth_mac\") = 32"
1579
+ },
1580
+ "mcp_connections_code_hash_check": {
1581
+ "name": "mcp_connections_code_hash_check",
1582
+ "value": "\"mcp_connections\".\"code_hash\" IS NULL OR octet_length(\"mcp_connections\".\"code_hash\") = 32"
1583
+ },
1584
+ "mcp_connections_refresh_hash_check": {
1585
+ "name": "mcp_connections_refresh_hash_check",
1586
+ "value": "\"mcp_connections\".\"refresh_hash\" IS NULL OR octet_length(\"mcp_connections\".\"refresh_hash\") = 32"
1587
+ }
1588
+ },
1589
+ "isRLSEnabled": false
1590
+ },
1591
+ "public.oauth_clients": {
1592
+ "name": "oauth_clients",
1593
+ "schema": "",
1594
+ "columns": {
1595
+ "id": {
1596
+ "name": "id",
1597
+ "type": "uuid",
1598
+ "primaryKey": true,
1599
+ "notNull": true
1600
+ },
1601
+ "auth_mac": {
1602
+ "name": "auth_mac",
1603
+ "type": "bytea",
1604
+ "primaryKey": false,
1605
+ "notNull": true
1606
+ },
1607
+ "name": {
1608
+ "name": "name",
1609
+ "type": "text",
1610
+ "primaryKey": false,
1611
+ "notNull": true
1612
+ },
1613
+ "redirect_uris": {
1614
+ "name": "redirect_uris",
1615
+ "type": "text",
1616
+ "primaryKey": false,
1617
+ "notNull": true
1618
+ },
1619
+ "created_at": {
1620
+ "name": "created_at",
1621
+ "type": "timestamp with time zone",
1622
+ "primaryKey": false,
1623
+ "notNull": true,
1624
+ "default": "now()"
1625
+ },
1626
+ "created_ip": {
1627
+ "name": "created_ip",
1628
+ "type": "text",
1629
+ "primaryKey": false,
1630
+ "notNull": false
1631
+ },
1632
+ "revoked_at": {
1633
+ "name": "revoked_at",
1634
+ "type": "timestamp with time zone",
1635
+ "primaryKey": false,
1636
+ "notNull": false
1637
+ }
1638
+ },
1639
+ "indexes": {},
1640
+ "foreignKeys": {},
1641
+ "compositePrimaryKeys": {},
1642
+ "uniqueConstraints": {},
1643
+ "policies": {},
1644
+ "checkConstraints": {
1645
+ "oauth_clients_auth_mac_check": {
1646
+ "name": "oauth_clients_auth_mac_check",
1647
+ "value": "octet_length(\"oauth_clients\".\"auth_mac\") = 32"
1648
+ },
1649
+ "oauth_clients_redirect_uris_check": {
1650
+ "name": "oauth_clients_redirect_uris_check",
1651
+ "value": "\"oauth_clients\".\"redirect_uris\"::jsonb IS NOT NULL"
1652
+ }
1653
+ },
1654
+ "isRLSEnabled": false
1655
+ },
1656
+ "public.projects": {
1657
+ "name": "projects",
1658
+ "schema": "",
1659
+ "columns": {
1660
+ "id": {
1661
+ "name": "id",
1662
+ "type": "uuid",
1663
+ "primaryKey": true,
1664
+ "notNull": true,
1665
+ "default": "gen_random_uuid()"
1666
+ },
1667
+ "slug": {
1668
+ "name": "slug",
1669
+ "type": "text",
1670
+ "primaryKey": false,
1671
+ "notNull": true
1672
+ },
1673
+ "name": {
1674
+ "name": "name",
1675
+ "type": "text",
1676
+ "primaryKey": false,
1677
+ "notNull": true
1678
+ },
1679
+ "created_at": {
1680
+ "name": "created_at",
1681
+ "type": "timestamp with time zone",
1682
+ "primaryKey": false,
1683
+ "notNull": true,
1684
+ "default": "now()"
1685
+ },
1686
+ "archived_at": {
1687
+ "name": "archived_at",
1688
+ "type": "timestamp with time zone",
1689
+ "primaryKey": false,
1690
+ "notNull": false
1691
+ },
1692
+ "folder": {
1693
+ "name": "folder",
1694
+ "type": "text",
1695
+ "primaryKey": false,
1696
+ "notNull": false
1697
+ }
1698
+ },
1699
+ "indexes": {},
1700
+ "foreignKeys": {},
1701
+ "compositePrimaryKeys": {},
1702
+ "uniqueConstraints": {
1703
+ "projects_slug_key": {
1704
+ "name": "projects_slug_key",
1705
+ "nullsNotDistinct": false,
1706
+ "columns": [
1707
+ "slug"
1708
+ ]
1709
+ }
1710
+ },
1711
+ "policies": {},
1712
+ "checkConstraints": {
1713
+ "projects_slug_check": {
1714
+ "name": "projects_slug_check",
1715
+ "value": "\"projects\".\"slug\" ~ '^[a-z0-9][a-z0-9-]{0,62}(~[a-z0-9-]{1,40})?$'"
1716
+ },
1717
+ "projects_folder_check": {
1718
+ "name": "projects_folder_check",
1719
+ "value": "\"projects\".\"folder\" IS NULL OR (char_length(\"projects\".\"folder\") BETWEEN 1 AND 64 AND \"projects\".\"folder\" !~ '[/[:cntrl:]]' AND \"projects\".\"folder\" = btrim(\"projects\".\"folder\"))"
1720
+ }
1721
+ },
1722
+ "isRLSEnabled": false
1723
+ },
1724
+ "public.secret_references": {
1725
+ "name": "secret_references",
1726
+ "schema": "",
1727
+ "columns": {
1728
+ "id": {
1729
+ "name": "id",
1730
+ "type": "uuid",
1731
+ "primaryKey": true,
1732
+ "notNull": true
1733
+ },
1734
+ "project_id": {
1735
+ "name": "project_id",
1736
+ "type": "uuid",
1737
+ "primaryKey": false,
1738
+ "notNull": true
1739
+ },
1740
+ "environment_id": {
1741
+ "name": "environment_id",
1742
+ "type": "uuid",
1743
+ "primaryKey": false,
1744
+ "notNull": true
1745
+ },
1746
+ "secret_id": {
1747
+ "name": "secret_id",
1748
+ "type": "uuid",
1749
+ "primaryKey": false,
1750
+ "notNull": true
1751
+ },
1752
+ "source_project_id": {
1753
+ "name": "source_project_id",
1754
+ "type": "uuid",
1755
+ "primaryKey": false,
1756
+ "notNull": true
1757
+ },
1758
+ "source_environment_id": {
1759
+ "name": "source_environment_id",
1760
+ "type": "uuid",
1761
+ "primaryKey": false,
1762
+ "notNull": true
1763
+ },
1764
+ "source_secret_id": {
1765
+ "name": "source_secret_id",
1766
+ "type": "uuid",
1767
+ "primaryKey": false,
1768
+ "notNull": true
1769
+ },
1770
+ "created_seq": {
1771
+ "name": "created_seq",
1772
+ "type": "bigint",
1773
+ "primaryKey": false,
1774
+ "notNull": true
1775
+ },
1776
+ "created_at": {
1777
+ "name": "created_at",
1778
+ "type": "timestamp with time zone",
1779
+ "primaryKey": false,
1780
+ "notNull": true,
1781
+ "default": "now()"
1782
+ },
1783
+ "created_by": {
1784
+ "name": "created_by",
1785
+ "type": "text",
1786
+ "primaryKey": false,
1787
+ "notNull": true
1788
+ }
1789
+ },
1790
+ "indexes": {
1791
+ "secret_references_holder_idx": {
1792
+ "name": "secret_references_holder_idx",
1793
+ "columns": [
1794
+ {
1795
+ "expression": "secret_id",
1796
+ "isExpression": false,
1797
+ "asc": true,
1798
+ "nulls": "last"
1799
+ },
1800
+ {
1801
+ "expression": "created_seq",
1802
+ "isExpression": false,
1803
+ "asc": true,
1804
+ "nulls": "last"
1805
+ }
1806
+ ],
1807
+ "isUnique": false,
1808
+ "concurrently": false,
1809
+ "method": "btree",
1810
+ "with": {}
1811
+ },
1812
+ "secret_references_source_idx": {
1813
+ "name": "secret_references_source_idx",
1814
+ "columns": [
1815
+ {
1816
+ "expression": "source_secret_id",
1817
+ "isExpression": false,
1818
+ "asc": true,
1819
+ "nulls": "last"
1820
+ }
1821
+ ],
1822
+ "isUnique": false,
1823
+ "concurrently": false,
1824
+ "method": "btree",
1825
+ "with": {}
1826
+ },
1827
+ "secret_references_project_idx": {
1828
+ "name": "secret_references_project_idx",
1829
+ "columns": [
1830
+ {
1831
+ "expression": "project_id",
1832
+ "isExpression": false,
1833
+ "asc": true,
1834
+ "nulls": "last"
1835
+ }
1836
+ ],
1837
+ "isUnique": false,
1838
+ "concurrently": false,
1839
+ "method": "btree",
1840
+ "with": {}
1841
+ },
1842
+ "secret_references_source_project_idx": {
1843
+ "name": "secret_references_source_project_idx",
1844
+ "columns": [
1845
+ {
1846
+ "expression": "source_project_id",
1847
+ "isExpression": false,
1848
+ "asc": true,
1849
+ "nulls": "last"
1850
+ }
1851
+ ],
1852
+ "isUnique": false,
1853
+ "concurrently": false,
1854
+ "method": "btree",
1855
+ "with": {}
1856
+ },
1857
+ "secret_references_created_by_idx": {
1858
+ "name": "secret_references_created_by_idx",
1859
+ "columns": [
1860
+ {
1861
+ "expression": "created_by",
1862
+ "isExpression": false,
1863
+ "asc": true,
1864
+ "nulls": "last"
1865
+ }
1866
+ ],
1867
+ "isUnique": false,
1868
+ "concurrently": false,
1869
+ "method": "btree",
1870
+ "with": {}
1871
+ }
1872
+ },
1873
+ "foreignKeys": {
1874
+ "secret_references_secret_id_fkey": {
1875
+ "name": "secret_references_secret_id_fkey",
1876
+ "tableFrom": "secret_references",
1877
+ "tableTo": "secrets",
1878
+ "columnsFrom": [
1879
+ "secret_id"
1880
+ ],
1881
+ "columnsTo": [
1882
+ "id"
1883
+ ],
1884
+ "onDelete": "restrict",
1885
+ "onUpdate": "no action"
1886
+ },
1887
+ "secret_references_source_secret_id_fkey": {
1888
+ "name": "secret_references_source_secret_id_fkey",
1889
+ "tableFrom": "secret_references",
1890
+ "tableTo": "secrets",
1891
+ "columnsFrom": [
1892
+ "source_secret_id"
1893
+ ],
1894
+ "columnsTo": [
1895
+ "id"
1896
+ ],
1897
+ "onDelete": "restrict",
1898
+ "onUpdate": "no action"
1899
+ },
1900
+ "secret_references_created_seq_fkey": {
1901
+ "name": "secret_references_created_seq_fkey",
1902
+ "tableFrom": "secret_references",
1903
+ "tableTo": "audit_log",
1904
+ "columnsFrom": [
1905
+ "created_seq"
1906
+ ],
1907
+ "columnsTo": [
1908
+ "seq"
1909
+ ],
1910
+ "onDelete": "restrict",
1911
+ "onUpdate": "no action"
1912
+ }
1913
+ },
1914
+ "compositePrimaryKeys": {},
1915
+ "uniqueConstraints": {
1916
+ "secret_references_created_seq_key": {
1917
+ "name": "secret_references_created_seq_key",
1918
+ "nullsNotDistinct": false,
1919
+ "columns": [
1920
+ "created_seq"
1921
+ ]
1146
1922
  }
1147
1923
  },
1924
+ "policies": {},
1925
+ "checkConstraints": {},
1148
1926
  "isRLSEnabled": false
1149
1927
  },
1150
1928
  "public.secret_versions": {
@@ -1359,6 +2137,12 @@
1359
2137
  "type": "timestamp with time zone",
1360
2138
  "primaryKey": false,
1361
2139
  "notNull": false
2140
+ },
2141
+ "folder": {
2142
+ "name": "folder",
2143
+ "type": "text",
2144
+ "primaryKey": false,
2145
+ "notNull": false
1362
2146
  }
1363
2147
  },
1364
2148
  "indexes": {
@@ -1463,129 +2247,71 @@
1463
2247
  "secrets_key_check": {
1464
2248
  "name": "secrets_key_check",
1465
2249
  "value": "\"secrets\".\"key\" ~ '^[A-Za-z_][A-Za-z0-9_]{0,127}$'"
2250
+ },
2251
+ "secrets_folder_check": {
2252
+ "name": "secrets_folder_check",
2253
+ "value": "\"secrets\".\"folder\" IS NULL OR (char_length(\"secrets\".\"folder\") BETWEEN 1 AND 64 AND \"secrets\".\"folder\" !~ '[/[:cntrl:]]' AND \"secrets\".\"folder\" = btrim(\"secrets\".\"folder\"))"
1466
2254
  }
1467
2255
  },
1468
2256
  "isRLSEnabled": false
1469
2257
  },
1470
- "public.sync_keys": {
1471
- "name": "sync_keys",
2258
+ "public.service_bindings": {
2259
+ "name": "service_bindings",
1472
2260
  "schema": "",
1473
2261
  "columns": {
1474
- "sync_id": {
1475
- "name": "sync_id",
2262
+ "id": {
2263
+ "name": "id",
1476
2264
  "type": "uuid",
1477
- "primaryKey": false,
2265
+ "primaryKey": true,
1478
2266
  "notNull": true
1479
2267
  },
1480
- "key": {
1481
- "name": "key",
1482
- "type": "text",
2268
+ "auth_mac": {
2269
+ "name": "auth_mac",
2270
+ "type": "bytea",
1483
2271
  "primaryKey": false,
1484
2272
  "notNull": true
1485
2273
  },
1486
- "secret_version_id": {
1487
- "name": "secret_version_id",
1488
- "type": "uuid",
1489
- "primaryKey": false,
1490
- "notNull": false
1491
- },
1492
- "pushed_at": {
1493
- "name": "pushed_at",
1494
- "type": "timestamp with time zone",
2274
+ "principal": {
2275
+ "name": "principal",
2276
+ "type": "text",
1495
2277
  "primaryKey": false,
1496
- "notNull": true,
1497
- "default": "now()"
2278
+ "notNull": true
1498
2279
  },
1499
- "removed_at": {
1500
- "name": "removed_at",
1501
- "type": "timestamp with time zone",
2280
+ "generation": {
2281
+ "name": "generation",
2282
+ "type": "integer",
1502
2283
  "primaryKey": false,
1503
- "notNull": false
1504
- }
1505
- },
1506
- "indexes": {},
1507
- "foreignKeys": {
1508
- "sync_keys_sync_id_fkey": {
1509
- "name": "sync_keys_sync_id_fkey",
1510
- "tableFrom": "sync_keys",
1511
- "tableTo": "syncs",
1512
- "columnsFrom": [
1513
- "sync_id"
1514
- ],
1515
- "columnsTo": [
1516
- "id"
1517
- ],
1518
- "onDelete": "restrict",
1519
- "onUpdate": "no action"
1520
- },
1521
- "sync_keys_secret_version_id_fkey": {
1522
- "name": "sync_keys_secret_version_id_fkey",
1523
- "tableFrom": "sync_keys",
1524
- "tableTo": "secret_versions",
1525
- "columnsFrom": [
1526
- "secret_version_id"
1527
- ],
1528
- "columnsTo": [
1529
- "id"
1530
- ],
1531
- "onDelete": "restrict",
1532
- "onUpdate": "no action"
1533
- }
1534
- },
1535
- "compositePrimaryKeys": {
1536
- "sync_keys_pkey": {
1537
- "name": "sync_keys_pkey",
1538
- "columns": [
1539
- "sync_id",
1540
- "key"
1541
- ]
1542
- }
1543
- },
1544
- "uniqueConstraints": {},
1545
- "policies": {},
1546
- "checkConstraints": {},
1547
- "isRLSEnabled": false
1548
- },
1549
- "public.syncs": {
1550
- "name": "syncs",
1551
- "schema": "",
1552
- "columns": {
1553
- "id": {
1554
- "name": "id",
1555
- "type": "uuid",
1556
- "primaryKey": true,
1557
- "notNull": true,
1558
- "default": "gen_random_uuid()"
2284
+ "notNull": true
1559
2285
  },
1560
- "project_id": {
1561
- "name": "project_id",
1562
- "type": "uuid",
2286
+ "profile": {
2287
+ "name": "profile",
2288
+ "type": "text",
1563
2289
  "primaryKey": false,
1564
2290
  "notNull": true
1565
2291
  },
1566
- "environment_id": {
1567
- "name": "environment_id",
1568
- "type": "uuid",
2292
+ "issuer": {
2293
+ "name": "issuer",
2294
+ "type": "text",
1569
2295
  "primaryKey": false,
1570
2296
  "notNull": true
1571
2297
  },
1572
- "provider": {
1573
- "name": "provider",
2298
+ "jwks_uri": {
2299
+ "name": "jwks_uri",
1574
2300
  "type": "text",
1575
2301
  "primaryKey": false,
1576
2302
  "notNull": true
1577
2303
  },
1578
- "config": {
1579
- "name": "config",
2304
+ "claims": {
2305
+ "name": "claims",
1580
2306
  "type": "text",
1581
2307
  "primaryKey": false,
1582
2308
  "notNull": true
1583
2309
  },
1584
- "credential_secret_id": {
1585
- "name": "credential_secret_id",
1586
- "type": "uuid",
2310
+ "label": {
2311
+ "name": "label",
2312
+ "type": "text",
1587
2313
  "primaryKey": false,
1588
- "notNull": true
2314
+ "notNull": false
1589
2315
  },
1590
2316
  "created_at": {
1591
2317
  "name": "created_at",
@@ -1600,85 +2326,98 @@
1600
2326
  "primaryKey": false,
1601
2327
  "notNull": true
1602
2328
  },
1603
- "paused_at": {
1604
- "name": "paused_at",
1605
- "type": "timestamp with time zone",
1606
- "primaryKey": false,
1607
- "notNull": false
1608
- },
1609
- "archived_at": {
1610
- "name": "archived_at",
1611
- "type": "timestamp with time zone",
1612
- "primaryKey": false,
1613
- "notNull": false
1614
- },
1615
- "lease_until": {
1616
- "name": "lease_until",
2329
+ "last_used_at": {
2330
+ "name": "last_used_at",
1617
2331
  "type": "timestamp with time zone",
1618
2332
  "primaryKey": false,
1619
2333
  "notNull": false
1620
2334
  },
1621
- "last_run_at": {
1622
- "name": "last_run_at",
2335
+ "revoked_at": {
2336
+ "name": "revoked_at",
1623
2337
  "type": "timestamp with time zone",
1624
2338
  "primaryKey": false,
1625
2339
  "notNull": false
1626
2340
  },
1627
- "last_status": {
1628
- "name": "last_status",
1629
- "type": "text",
1630
- "primaryKey": false,
1631
- "notNull": false
1632
- },
1633
- "last_error": {
1634
- "name": "last_error",
2341
+ "revoked_by": {
2342
+ "name": "revoked_by",
1635
2343
  "type": "text",
1636
2344
  "primaryKey": false,
1637
2345
  "notNull": false
1638
2346
  }
1639
2347
  },
1640
2348
  "indexes": {
1641
- "syncs_environment_idx": {
1642
- "name": "syncs_environment_idx",
2349
+ "service_bindings_principal_idx": {
2350
+ "name": "service_bindings_principal_idx",
1643
2351
  "columns": [
1644
2352
  {
1645
- "expression": "environment_id",
2353
+ "expression": "principal",
2354
+ "isExpression": false,
2355
+ "asc": true,
2356
+ "nulls": "last"
2357
+ },
2358
+ {
2359
+ "expression": "issuer",
2360
+ "isExpression": false,
2361
+ "asc": true,
2362
+ "nulls": "last"
2363
+ }
2364
+ ],
2365
+ "isUnique": false,
2366
+ "concurrently": false,
2367
+ "method": "btree",
2368
+ "with": {}
2369
+ },
2370
+ "service_bindings_live_idx": {
2371
+ "name": "service_bindings_live_idx",
2372
+ "columns": [
2373
+ {
2374
+ "expression": "principal",
2375
+ "isExpression": false,
2376
+ "asc": true,
2377
+ "nulls": "last"
2378
+ },
2379
+ {
2380
+ "expression": "issuer",
2381
+ "isExpression": false,
2382
+ "asc": true,
2383
+ "nulls": "last"
2384
+ },
2385
+ {
2386
+ "expression": "generation",
2387
+ "isExpression": false,
2388
+ "asc": true,
2389
+ "nulls": "last"
2390
+ },
2391
+ {
2392
+ "expression": "created_at",
2393
+ "isExpression": false,
2394
+ "asc": true,
2395
+ "nulls": "last"
2396
+ },
2397
+ {
2398
+ "expression": "id",
1646
2399
  "isExpression": false,
1647
2400
  "asc": true,
1648
2401
  "nulls": "last"
1649
2402
  }
1650
2403
  ],
1651
2404
  "isUnique": false,
2405
+ "where": "\"service_bindings\".\"revoked_at\" IS NULL",
1652
2406
  "concurrently": false,
1653
2407
  "method": "btree",
1654
2408
  "with": {}
1655
2409
  }
1656
2410
  },
1657
2411
  "foreignKeys": {
1658
- "syncs_environment_in_project": {
1659
- "name": "syncs_environment_in_project",
1660
- "tableFrom": "syncs",
1661
- "tableTo": "environments",
1662
- "columnsFrom": [
1663
- "environment_id",
1664
- "project_id"
1665
- ],
1666
- "columnsTo": [
1667
- "id",
1668
- "project_id"
1669
- ],
1670
- "onDelete": "restrict",
1671
- "onUpdate": "no action"
1672
- },
1673
- "syncs_credential_secret_id_fkey": {
1674
- "name": "syncs_credential_secret_id_fkey",
1675
- "tableFrom": "syncs",
1676
- "tableTo": "secrets",
2412
+ "service_bindings_principal_fkey": {
2413
+ "name": "service_bindings_principal_fkey",
2414
+ "tableFrom": "service_bindings",
2415
+ "tableTo": "vault_members",
1677
2416
  "columnsFrom": [
1678
- "credential_secret_id"
2417
+ "principal"
1679
2418
  ],
1680
2419
  "columnsTo": [
1681
- "id"
2420
+ "principal"
1682
2421
  ],
1683
2422
  "onDelete": "restrict",
1684
2423
  "onUpdate": "no action"
@@ -1688,13 +2427,17 @@
1688
2427
  "uniqueConstraints": {},
1689
2428
  "policies": {},
1690
2429
  "checkConstraints": {
1691
- "syncs_config_check": {
1692
- "name": "syncs_config_check",
1693
- "value": "\"syncs\".\"config\"::jsonb IS NOT NULL"
2430
+ "service_bindings_principal_check": {
2431
+ "name": "service_bindings_principal_check",
2432
+ "value": "\"service_bindings\".\"principal\" LIKE 'token:%'"
2433
+ },
2434
+ "service_bindings_auth_mac_check": {
2435
+ "name": "service_bindings_auth_mac_check",
2436
+ "value": "octet_length(\"service_bindings\".\"auth_mac\") = 32"
1694
2437
  },
1695
- "syncs_last_status_check": {
1696
- "name": "syncs_last_status_check",
1697
- "value": "\"syncs\".\"last_status\" IS NULL OR \"syncs\".\"last_status\" IN ('ok', 'partial', 'failed')"
2438
+ "service_bindings_claims_check": {
2439
+ "name": "service_bindings_claims_check",
2440
+ "value": "\"service_bindings\".\"claims\"::jsonb IS NOT NULL"
1698
2441
  }
1699
2442
  },
1700
2443
  "isRLSEnabled": false
@@ -1721,6 +2464,12 @@
1721
2464
  "primaryKey": false,
1722
2465
  "notNull": false
1723
2466
  },
2467
+ "environment_slug": {
2468
+ "name": "environment_slug",
2469
+ "type": "text",
2470
+ "primaryKey": false,
2471
+ "notNull": false
2472
+ },
1724
2473
  "role": {
1725
2474
  "name": "role",
1726
2475
  "type": "text",
@@ -1746,7 +2495,24 @@
1746
2495
  "notNull": true
1747
2496
  }
1748
2497
  },
1749
- "indexes": {},
2498
+ "indexes": {
2499
+ "vault_grants_on_every_project": {
2500
+ "name": "vault_grants_on_every_project",
2501
+ "columns": [
2502
+ {
2503
+ "expression": "principal",
2504
+ "isExpression": false,
2505
+ "asc": true,
2506
+ "nulls": "last"
2507
+ }
2508
+ ],
2509
+ "isUnique": true,
2510
+ "where": "\"vault_grants\".\"project_id\" IS NULL AND \"vault_grants\".\"environment_id\" IS NULL AND \"vault_grants\".\"environment_slug\" IS NULL",
2511
+ "concurrently": false,
2512
+ "method": "btree",
2513
+ "with": {}
2514
+ }
2515
+ },
1750
2516
  "foreignKeys": {
1751
2517
  "vault_grants_principal_fkey": {
1752
2518
  "name": "vault_grants_principal_fkey",
@@ -1805,13 +2571,25 @@
1805
2571
  "principal",
1806
2572
  "environment_id"
1807
2573
  ]
2574
+ },
2575
+ "vault_grants_on_environment_slug": {
2576
+ "name": "vault_grants_on_environment_slug",
2577
+ "nullsNotDistinct": false,
2578
+ "columns": [
2579
+ "principal",
2580
+ "environment_slug"
2581
+ ]
1808
2582
  }
1809
2583
  },
1810
2584
  "policies": {},
1811
2585
  "checkConstraints": {
1812
2586
  "vault_grants_one_place": {
1813
2587
  "name": "vault_grants_one_place",
1814
- "value": "(\"vault_grants\".\"project_id\" IS NULL) <> (\"vault_grants\".\"environment_id\" IS NULL)"
2588
+ "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)"
2589
+ },
2590
+ "vault_grants_environment_slug_check": {
2591
+ "name": "vault_grants_environment_slug_check",
2592
+ "value": "\"vault_grants\".\"environment_slug\" IS NULL OR \"vault_grants\".\"environment_slug\" ~ '^[a-z0-9][a-z0-9-]{0,62}$'"
1815
2593
  },
1816
2594
  "vault_grants_role_check": {
1817
2595
  "name": "vault_grants_role_check",
@@ -1819,7 +2597,7 @@
1819
2597
  },
1820
2598
  "vault_grants_environment_role_check": {
1821
2599
  "name": "vault_grants_environment_role_check",
1822
- "value": "\"vault_grants\".\"environment_id\" IS NULL OR \"vault_grants\".\"role\" IN ('viewer', 'developer', 'auditor')"
2600
+ "value": "(\"vault_grants\".\"environment_id\" IS NULL AND \"vault_grants\".\"environment_slug\" IS NULL) OR \"vault_grants\".\"role\" IN ('viewer', 'developer', 'auditor')"
1823
2601
  }
1824
2602
  },
1825
2603
  "isRLSEnabled": false
@@ -1903,7 +2681,7 @@
1903
2681
  },
1904
2682
  "vault_members_principal_check": {
1905
2683
  "name": "vault_members_principal_check",
1906
- "value": "\"vault_members\".\"principal\" ~ '^(user|token|sync):[^[:space:]:][^[:space:]]*$'"
2684
+ "value": "\"vault_members\".\"principal\" ~ '^(user|token):[^[:space:]:][^[:space:]]*$'"
1907
2685
  },
1908
2686
  "vault_members_user_lowercase": {
1909
2687
  "name": "vault_members_user_lowercase",