@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,8 +1,8 @@
1
1
  {
2
2
  "version": "6",
3
3
  "dialect": "sqlite",
4
- "id": "b24525b7-a286-4409-93b5-ec8b99033dac",
5
- "prevId": "6de9e286-f9d7-4c08-ac7d-e963092320c1",
4
+ "id": "703bfb7b-6231-4857-b4ba-7dc8ffdb4753",
5
+ "prevId": "77ab1ca5-1c82-4f95-a295-592dbe7c56e1",
6
6
  "tables": {
7
7
  "audit_chain_head": {
8
8
  "name": "audit_chain_head",
@@ -271,6 +271,57 @@
271
271
  "seq"
272
272
  ],
273
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"
274
325
  }
275
326
  },
276
327
  "foreignKeys": {
@@ -349,7 +400,7 @@
349
400
  },
350
401
  "audit_log_actor_check": {
351
402
  "name": "audit_log_actor_check",
352
- "value": "\"audit_log\".\"actor\" GLOB 'user:?*' OR \"audit_log\".\"actor\" GLOB 'token:?*' OR \"audit_log\".\"actor\" GLOB 'sync:?*' OR \"audit_log\".\"actor\" GLOB 'system:?*'"
403
+ "value": "\"audit_log\".\"actor\" GLOB 'user:?*' OR \"audit_log\".\"actor\" GLOB 'token:?*' OR \"audit_log\".\"actor\" GLOB 'system:?*'"
353
404
  },
354
405
  "audit_log_decision_check": {
355
406
  "name": "audit_log_decision_check",
@@ -373,6 +424,36 @@
373
424
  }
374
425
  }
375
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
+ },
376
457
  "credentials": {
377
458
  "name": "credentials",
378
459
  "columns": {
@@ -499,6 +580,24 @@
499
580
  ],
500
581
  "isUnique": false
501
582
  },
583
+ "credentials_live_idx": {
584
+ "name": "credentials_live_idx",
585
+ "columns": [
586
+ "principal",
587
+ "expires_at"
588
+ ],
589
+ "isUnique": false,
590
+ "where": "\"credentials\".\"revoked_at\" IS NULL"
591
+ },
592
+ "credentials_issued_by_idx": {
593
+ "name": "credentials_issued_by_idx",
594
+ "columns": [
595
+ "principal",
596
+ "created_by",
597
+ "created_at"
598
+ ],
599
+ "isUnique": false
600
+ },
502
601
  "credentials_token_hash_key": {
503
602
  "name": "credentials_token_hash_key",
504
603
  "columns": [
@@ -709,6 +808,86 @@
709
808
  }
710
809
  }
711
810
  },
811
+ "dismissed_keys": {
812
+ "name": "dismissed_keys",
813
+ "columns": {
814
+ "environment_id": {
815
+ "name": "environment_id",
816
+ "type": "text",
817
+ "primaryKey": false,
818
+ "notNull": true,
819
+ "autoincrement": false
820
+ },
821
+ "key": {
822
+ "name": "key",
823
+ "type": "text",
824
+ "primaryKey": false,
825
+ "notNull": true,
826
+ "autoincrement": false
827
+ },
828
+ "dismissed_at": {
829
+ "name": "dismissed_at",
830
+ "type": "integer",
831
+ "primaryKey": false,
832
+ "notNull": true,
833
+ "autoincrement": false,
834
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
835
+ },
836
+ "dismissed_by": {
837
+ "name": "dismissed_by",
838
+ "type": "text",
839
+ "primaryKey": false,
840
+ "notNull": true,
841
+ "autoincrement": false
842
+ },
843
+ "restored_at": {
844
+ "name": "restored_at",
845
+ "type": "integer",
846
+ "primaryKey": false,
847
+ "notNull": false,
848
+ "autoincrement": false
849
+ },
850
+ "restored_by": {
851
+ "name": "restored_by",
852
+ "type": "text",
853
+ "primaryKey": false,
854
+ "notNull": false,
855
+ "autoincrement": false
856
+ }
857
+ },
858
+ "indexes": {},
859
+ "foreignKeys": {
860
+ "dismissed_keys_environment_id_fkey": {
861
+ "name": "dismissed_keys_environment_id_fkey",
862
+ "tableFrom": "dismissed_keys",
863
+ "tableTo": "environments",
864
+ "columnsFrom": [
865
+ "environment_id"
866
+ ],
867
+ "columnsTo": [
868
+ "id"
869
+ ],
870
+ "onDelete": "restrict",
871
+ "onUpdate": "no action"
872
+ }
873
+ },
874
+ "compositePrimaryKeys": {
875
+ "dismissed_keys_pkey": {
876
+ "columns": [
877
+ "environment_id",
878
+ "key"
879
+ ],
880
+ "name": "dismissed_keys_pkey"
881
+ }
882
+ },
883
+ "uniqueConstraints": {},
884
+ "checkConstraints": {
885
+ "dismissed_keys_key_check": {
886
+ "name": "dismissed_keys_key_check",
887
+ "value": "length(\"dismissed_keys\".\"key\") BETWEEN 1 AND 128 AND \"dismissed_keys\".\"key\" GLOB '[A-Za-z_]*' AND \"dismissed_keys\".\"key\" NOT GLOB '*[^A-Za-z0-9_]*'"
888
+ }
889
+ }
890
+ },
712
891
  "environments": {
713
892
  "name": "environments",
714
893
  "columns": {
@@ -794,7 +973,7 @@
794
973
  "checkConstraints": {
795
974
  "environments_slug_check": {
796
975
  "name": "environments_slug_check",
797
- "value": "length(\"environments\".\"slug\") BETWEEN 1 AND 63 AND \"environments\".\"slug\" GLOB '[a-z0-9]*' AND \"environments\".\"slug\" NOT GLOB '*[^a-z0-9-]*'"
976
+ "value": "(length(\"environments\".\"slug\") BETWEEN 1 AND 63 AND \"environments\".\"slug\" GLOB '[a-z0-9]*' AND \"environments\".\"slug\" NOT GLOB '*[^a-z0-9-]*') OR (instr(\"environments\".\"slug\", '~') BETWEEN 2 AND 64 AND substr(\"environments\".\"slug\", 1, instr(\"environments\".\"slug\", '~') - 1) GLOB '[a-z0-9]*' AND substr(\"environments\".\"slug\", 1, instr(\"environments\".\"slug\", '~') - 1) NOT GLOB '*[^a-z0-9-]*' AND length(substr(\"environments\".\"slug\", instr(\"environments\".\"slug\", '~') + 1)) BETWEEN 1 AND 40 AND substr(\"environments\".\"slug\", instr(\"environments\".\"slug\", '~') + 1) NOT GLOB '*[^a-z0-9-]*')"
798
977
  }
799
978
  }
800
979
  },
@@ -965,8 +1144,8 @@
965
1144
  }
966
1145
  }
967
1146
  },
968
- "projects": {
969
- "name": "projects",
1147
+ "mcp_approvals": {
1148
+ "name": "mcp_approvals",
970
1149
  "columns": {
971
1150
  "id": {
972
1151
  "name": "id",
@@ -975,20 +1154,49 @@
975
1154
  "notNull": true,
976
1155
  "autoincrement": false
977
1156
  },
978
- "slug": {
979
- "name": "slug",
1157
+ "connection_id": {
1158
+ "name": "connection_id",
980
1159
  "type": "text",
981
1160
  "primaryKey": false,
982
1161
  "notNull": true,
983
1162
  "autoincrement": false
984
1163
  },
985
- "name": {
986
- "name": "name",
1164
+ "tool": {
1165
+ "name": "tool",
1166
+ "type": "text",
1167
+ "primaryKey": false,
1168
+ "notNull": true,
1169
+ "autoincrement": false
1170
+ },
1171
+ "arguments": {
1172
+ "name": "arguments",
987
1173
  "type": "text",
988
1174
  "primaryKey": false,
989
1175
  "notNull": true,
990
1176
  "autoincrement": false
991
1177
  },
1178
+ "digest": {
1179
+ "name": "digest",
1180
+ "type": "blob",
1181
+ "primaryKey": false,
1182
+ "notNull": true,
1183
+ "autoincrement": false
1184
+ },
1185
+ "status": {
1186
+ "name": "status",
1187
+ "type": "text",
1188
+ "primaryKey": false,
1189
+ "notNull": true,
1190
+ "autoincrement": false,
1191
+ "default": "'pending'"
1192
+ },
1193
+ "outcome": {
1194
+ "name": "outcome",
1195
+ "type": "text",
1196
+ "primaryKey": false,
1197
+ "notNull": false,
1198
+ "autoincrement": false
1199
+ },
992
1200
  "created_at": {
993
1201
  "name": "created_at",
994
1202
  "type": "integer",
@@ -997,8 +1205,22 @@
997
1205
  "autoincrement": false,
998
1206
  "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
999
1207
  },
1000
- "archived_at": {
1001
- "name": "archived_at",
1208
+ "expires_at": {
1209
+ "name": "expires_at",
1210
+ "type": "integer",
1211
+ "primaryKey": false,
1212
+ "notNull": true,
1213
+ "autoincrement": false
1214
+ },
1215
+ "decided_at": {
1216
+ "name": "decided_at",
1217
+ "type": "integer",
1218
+ "primaryKey": false,
1219
+ "notNull": false,
1220
+ "autoincrement": false
1221
+ },
1222
+ "reported_at": {
1223
+ "name": "reported_at",
1002
1224
  "type": "integer",
1003
1225
  "primaryKey": false,
1004
1226
  "notNull": false,
@@ -1006,26 +1228,50 @@
1006
1228
  }
1007
1229
  },
1008
1230
  "indexes": {
1009
- "projects_slug_key": {
1010
- "name": "projects_slug_key",
1231
+ "mcp_approvals_open_idx": {
1232
+ "name": "mcp_approvals_open_idx",
1011
1233
  "columns": [
1012
- "slug"
1234
+ "connection_id",
1235
+ "digest"
1013
1236
  ],
1014
- "isUnique": true
1237
+ "isUnique": false,
1238
+ "where": "\"mcp_approvals\".\"reported_at\" IS NULL"
1239
+ }
1240
+ },
1241
+ "foreignKeys": {
1242
+ "mcp_approvals_connection_fkey": {
1243
+ "name": "mcp_approvals_connection_fkey",
1244
+ "tableFrom": "mcp_approvals",
1245
+ "tableTo": "mcp_connections",
1246
+ "columnsFrom": [
1247
+ "connection_id"
1248
+ ],
1249
+ "columnsTo": [
1250
+ "id"
1251
+ ],
1252
+ "onDelete": "restrict",
1253
+ "onUpdate": "no action"
1015
1254
  }
1016
1255
  },
1017
- "foreignKeys": {},
1018
1256
  "compositePrimaryKeys": {},
1019
1257
  "uniqueConstraints": {},
1020
1258
  "checkConstraints": {
1021
- "projects_slug_check": {
1022
- "name": "projects_slug_check",
1023
- "value": "length(\"projects\".\"slug\") BETWEEN 1 AND 63 AND \"projects\".\"slug\" GLOB '[a-z0-9]*' AND \"projects\".\"slug\" NOT GLOB '*[^a-z0-9-]*'"
1259
+ "mcp_approvals_status_check": {
1260
+ "name": "mcp_approvals_status_check",
1261
+ "value": "\"mcp_approvals\".\"status\" IN ('pending', 'approved', 'denied', 'cancelled', 'failed')"
1262
+ },
1263
+ "mcp_approvals_digest_check": {
1264
+ "name": "mcp_approvals_digest_check",
1265
+ "value": "octet_length(\"mcp_approvals\".\"digest\") = 32"
1266
+ },
1267
+ "mcp_approvals_arguments_check": {
1268
+ "name": "mcp_approvals_arguments_check",
1269
+ "value": "json_valid(\"mcp_approvals\".\"arguments\")"
1024
1270
  }
1025
1271
  }
1026
1272
  },
1027
- "secret_versions": {
1028
- "name": "secret_versions",
1273
+ "mcp_connections": {
1274
+ "name": "mcp_connections",
1029
1275
  "columns": {
1030
1276
  "id": {
1031
1277
  "name": "id",
@@ -1034,73 +1280,108 @@
1034
1280
  "notNull": true,
1035
1281
  "autoincrement": false
1036
1282
  },
1037
- "secret_id": {
1038
- "name": "secret_id",
1039
- "type": "text",
1283
+ "auth_mac": {
1284
+ "name": "auth_mac",
1285
+ "type": "blob",
1040
1286
  "primaryKey": false,
1041
1287
  "notNull": true,
1042
1288
  "autoincrement": false
1043
1289
  },
1044
- "version": {
1045
- "name": "version",
1046
- "type": "integer",
1290
+ "principal": {
1291
+ "name": "principal",
1292
+ "type": "text",
1047
1293
  "primaryKey": false,
1048
1294
  "notNull": true,
1049
1295
  "autoincrement": false
1050
1296
  },
1051
- "envelope_version": {
1052
- "name": "envelope_version",
1297
+ "generation": {
1298
+ "name": "generation",
1053
1299
  "type": "integer",
1054
1300
  "primaryKey": false,
1055
1301
  "notNull": true,
1056
1302
  "autoincrement": false
1057
1303
  },
1058
- "ciphertext": {
1059
- "name": "ciphertext",
1060
- "type": "blob",
1304
+ "client_id": {
1305
+ "name": "client_id",
1306
+ "type": "text",
1061
1307
  "primaryKey": false,
1062
1308
  "notNull": true,
1063
1309
  "autoincrement": false
1064
1310
  },
1065
- "iv": {
1066
- "name": "iv",
1067
- "type": "blob",
1311
+ "client_name": {
1312
+ "name": "client_name",
1313
+ "type": "text",
1068
1314
  "primaryKey": false,
1069
1315
  "notNull": true,
1070
1316
  "autoincrement": false
1071
1317
  },
1072
- "auth_tag": {
1073
- "name": "auth_tag",
1074
- "type": "blob",
1318
+ "client_host": {
1319
+ "name": "client_host",
1320
+ "type": "text",
1075
1321
  "primaryKey": false,
1076
- "notNull": true,
1322
+ "notNull": false,
1077
1323
  "autoincrement": false
1078
1324
  },
1079
- "wrapped_dek": {
1080
- "name": "wrapped_dek",
1081
- "type": "blob",
1325
+ "registration": {
1326
+ "name": "registration",
1327
+ "type": "text",
1082
1328
  "primaryKey": false,
1083
1329
  "notNull": true,
1084
1330
  "autoincrement": false
1085
1331
  },
1086
- "kek_provider": {
1087
- "name": "kek_provider",
1332
+ "scopes": {
1333
+ "name": "scopes",
1088
1334
  "type": "text",
1089
1335
  "primaryKey": false,
1090
1336
  "notNull": true,
1091
1337
  "autoincrement": false
1092
1338
  },
1093
- "kek_id": {
1094
- "name": "kek_id",
1339
+ "redirect_uri": {
1340
+ "name": "redirect_uri",
1095
1341
  "type": "text",
1096
1342
  "primaryKey": false,
1097
1343
  "notNull": true,
1098
1344
  "autoincrement": false
1099
1345
  },
1100
- "kek_version": {
1101
- "name": "kek_version",
1346
+ "code_hash": {
1347
+ "name": "code_hash",
1348
+ "type": "blob",
1349
+ "primaryKey": false,
1350
+ "notNull": false,
1351
+ "autoincrement": false
1352
+ },
1353
+ "code_challenge": {
1354
+ "name": "code_challenge",
1102
1355
  "type": "text",
1103
1356
  "primaryKey": false,
1357
+ "notNull": false,
1358
+ "autoincrement": false
1359
+ },
1360
+ "code_expires_at": {
1361
+ "name": "code_expires_at",
1362
+ "type": "integer",
1363
+ "primaryKey": false,
1364
+ "notNull": false,
1365
+ "autoincrement": false
1366
+ },
1367
+ "refresh_hash": {
1368
+ "name": "refresh_hash",
1369
+ "type": "blob",
1370
+ "primaryKey": false,
1371
+ "notNull": false,
1372
+ "autoincrement": false
1373
+ },
1374
+ "refresh_previous_hash": {
1375
+ "name": "refresh_previous_hash",
1376
+ "type": "blob",
1377
+ "primaryKey": false,
1378
+ "notNull": false,
1379
+ "autoincrement": false
1380
+ },
1381
+ "expires_at": {
1382
+ "name": "expires_at",
1383
+ "type": "integer",
1384
+ "primaryKey": false,
1104
1385
  "notNull": true,
1105
1386
  "autoincrement": false
1106
1387
  },
@@ -1112,11 +1393,504 @@
1112
1393
  "autoincrement": false,
1113
1394
  "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1114
1395
  },
1115
- "created_by": {
1116
- "name": "created_by",
1117
- "type": "text",
1396
+ "last_used_at": {
1397
+ "name": "last_used_at",
1398
+ "type": "integer",
1118
1399
  "primaryKey": false,
1119
- "notNull": true,
1400
+ "notNull": false,
1401
+ "autoincrement": false
1402
+ },
1403
+ "last_used_ip": {
1404
+ "name": "last_used_ip",
1405
+ "type": "text",
1406
+ "primaryKey": false,
1407
+ "notNull": false,
1408
+ "autoincrement": false
1409
+ },
1410
+ "revoked_at": {
1411
+ "name": "revoked_at",
1412
+ "type": "integer",
1413
+ "primaryKey": false,
1414
+ "notNull": false,
1415
+ "autoincrement": false
1416
+ },
1417
+ "revoked_by": {
1418
+ "name": "revoked_by",
1419
+ "type": "text",
1420
+ "primaryKey": false,
1421
+ "notNull": false,
1422
+ "autoincrement": false
1423
+ }
1424
+ },
1425
+ "indexes": {
1426
+ "mcp_connections_refresh_previous_idx": {
1427
+ "name": "mcp_connections_refresh_previous_idx",
1428
+ "columns": [
1429
+ "refresh_previous_hash"
1430
+ ],
1431
+ "isUnique": false
1432
+ },
1433
+ "mcp_connections_live_idx": {
1434
+ "name": "mcp_connections_live_idx",
1435
+ "columns": [
1436
+ "principal",
1437
+ "expires_at"
1438
+ ],
1439
+ "isUnique": false,
1440
+ "where": "\"mcp_connections\".\"revoked_at\" IS NULL"
1441
+ },
1442
+ "mcp_connections_code_hash_key": {
1443
+ "name": "mcp_connections_code_hash_key",
1444
+ "columns": [
1445
+ "code_hash"
1446
+ ],
1447
+ "isUnique": true
1448
+ },
1449
+ "mcp_connections_refresh_hash_key": {
1450
+ "name": "mcp_connections_refresh_hash_key",
1451
+ "columns": [
1452
+ "refresh_hash"
1453
+ ],
1454
+ "isUnique": true
1455
+ }
1456
+ },
1457
+ "foreignKeys": {
1458
+ "mcp_connections_principal_fkey": {
1459
+ "name": "mcp_connections_principal_fkey",
1460
+ "tableFrom": "mcp_connections",
1461
+ "tableTo": "vault_members",
1462
+ "columnsFrom": [
1463
+ "principal"
1464
+ ],
1465
+ "columnsTo": [
1466
+ "principal"
1467
+ ],
1468
+ "onDelete": "restrict",
1469
+ "onUpdate": "no action"
1470
+ }
1471
+ },
1472
+ "compositePrimaryKeys": {},
1473
+ "uniqueConstraints": {},
1474
+ "checkConstraints": {
1475
+ "mcp_connections_principal_check": {
1476
+ "name": "mcp_connections_principal_check",
1477
+ "value": "\"mcp_connections\".\"principal\" LIKE 'user:%'"
1478
+ },
1479
+ "mcp_connections_registration_check": {
1480
+ "name": "mcp_connections_registration_check",
1481
+ "value": "\"mcp_connections\".\"registration\" IN ('cimd', 'dcr')"
1482
+ },
1483
+ "mcp_connections_auth_mac_check": {
1484
+ "name": "mcp_connections_auth_mac_check",
1485
+ "value": "octet_length(\"mcp_connections\".\"auth_mac\") = 32"
1486
+ },
1487
+ "mcp_connections_code_hash_check": {
1488
+ "name": "mcp_connections_code_hash_check",
1489
+ "value": "\"mcp_connections\".\"code_hash\" IS NULL OR octet_length(\"mcp_connections\".\"code_hash\") = 32"
1490
+ },
1491
+ "mcp_connections_refresh_hash_check": {
1492
+ "name": "mcp_connections_refresh_hash_check",
1493
+ "value": "\"mcp_connections\".\"refresh_hash\" IS NULL OR octet_length(\"mcp_connections\".\"refresh_hash\") = 32"
1494
+ }
1495
+ }
1496
+ },
1497
+ "oauth_clients": {
1498
+ "name": "oauth_clients",
1499
+ "columns": {
1500
+ "id": {
1501
+ "name": "id",
1502
+ "type": "text",
1503
+ "primaryKey": true,
1504
+ "notNull": true,
1505
+ "autoincrement": false
1506
+ },
1507
+ "auth_mac": {
1508
+ "name": "auth_mac",
1509
+ "type": "blob",
1510
+ "primaryKey": false,
1511
+ "notNull": true,
1512
+ "autoincrement": false
1513
+ },
1514
+ "name": {
1515
+ "name": "name",
1516
+ "type": "text",
1517
+ "primaryKey": false,
1518
+ "notNull": true,
1519
+ "autoincrement": false
1520
+ },
1521
+ "redirect_uris": {
1522
+ "name": "redirect_uris",
1523
+ "type": "text",
1524
+ "primaryKey": false,
1525
+ "notNull": true,
1526
+ "autoincrement": false
1527
+ },
1528
+ "created_at": {
1529
+ "name": "created_at",
1530
+ "type": "integer",
1531
+ "primaryKey": false,
1532
+ "notNull": true,
1533
+ "autoincrement": false,
1534
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1535
+ },
1536
+ "created_ip": {
1537
+ "name": "created_ip",
1538
+ "type": "text",
1539
+ "primaryKey": false,
1540
+ "notNull": false,
1541
+ "autoincrement": false
1542
+ },
1543
+ "revoked_at": {
1544
+ "name": "revoked_at",
1545
+ "type": "integer",
1546
+ "primaryKey": false,
1547
+ "notNull": false,
1548
+ "autoincrement": false
1549
+ }
1550
+ },
1551
+ "indexes": {},
1552
+ "foreignKeys": {},
1553
+ "compositePrimaryKeys": {},
1554
+ "uniqueConstraints": {},
1555
+ "checkConstraints": {
1556
+ "oauth_clients_auth_mac_check": {
1557
+ "name": "oauth_clients_auth_mac_check",
1558
+ "value": "octet_length(\"oauth_clients\".\"auth_mac\") = 32"
1559
+ },
1560
+ "oauth_clients_redirect_uris_check": {
1561
+ "name": "oauth_clients_redirect_uris_check",
1562
+ "value": "json_valid(\"oauth_clients\".\"redirect_uris\")"
1563
+ }
1564
+ }
1565
+ },
1566
+ "projects": {
1567
+ "name": "projects",
1568
+ "columns": {
1569
+ "id": {
1570
+ "name": "id",
1571
+ "type": "text",
1572
+ "primaryKey": true,
1573
+ "notNull": true,
1574
+ "autoincrement": false
1575
+ },
1576
+ "slug": {
1577
+ "name": "slug",
1578
+ "type": "text",
1579
+ "primaryKey": false,
1580
+ "notNull": true,
1581
+ "autoincrement": false
1582
+ },
1583
+ "name": {
1584
+ "name": "name",
1585
+ "type": "text",
1586
+ "primaryKey": false,
1587
+ "notNull": true,
1588
+ "autoincrement": false
1589
+ },
1590
+ "created_at": {
1591
+ "name": "created_at",
1592
+ "type": "integer",
1593
+ "primaryKey": false,
1594
+ "notNull": true,
1595
+ "autoincrement": false,
1596
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1597
+ },
1598
+ "archived_at": {
1599
+ "name": "archived_at",
1600
+ "type": "integer",
1601
+ "primaryKey": false,
1602
+ "notNull": false,
1603
+ "autoincrement": false
1604
+ },
1605
+ "folder": {
1606
+ "name": "folder",
1607
+ "type": "text",
1608
+ "primaryKey": false,
1609
+ "notNull": false,
1610
+ "autoincrement": false
1611
+ }
1612
+ },
1613
+ "indexes": {
1614
+ "projects_slug_key": {
1615
+ "name": "projects_slug_key",
1616
+ "columns": [
1617
+ "slug"
1618
+ ],
1619
+ "isUnique": true
1620
+ }
1621
+ },
1622
+ "foreignKeys": {},
1623
+ "compositePrimaryKeys": {},
1624
+ "uniqueConstraints": {},
1625
+ "checkConstraints": {
1626
+ "projects_slug_check": {
1627
+ "name": "projects_slug_check",
1628
+ "value": "(length(\"projects\".\"slug\") BETWEEN 1 AND 63 AND \"projects\".\"slug\" GLOB '[a-z0-9]*' AND \"projects\".\"slug\" NOT GLOB '*[^a-z0-9-]*') OR (instr(\"projects\".\"slug\", '~') BETWEEN 2 AND 64 AND substr(\"projects\".\"slug\", 1, instr(\"projects\".\"slug\", '~') - 1) GLOB '[a-z0-9]*' AND substr(\"projects\".\"slug\", 1, instr(\"projects\".\"slug\", '~') - 1) NOT GLOB '*[^a-z0-9-]*' AND length(substr(\"projects\".\"slug\", instr(\"projects\".\"slug\", '~') + 1)) BETWEEN 1 AND 40 AND substr(\"projects\".\"slug\", instr(\"projects\".\"slug\", '~') + 1) NOT GLOB '*[^a-z0-9-]*')"
1629
+ },
1630
+ "projects_folder_check": {
1631
+ "name": "projects_folder_check",
1632
+ "value": "\"projects\".\"folder\" IS NULL OR (length(\"projects\".\"folder\") BETWEEN 1 AND 64 AND \"projects\".\"folder\" NOT GLOB '*/*' AND \"projects\".\"folder\" = trim(\"projects\".\"folder\"))"
1633
+ }
1634
+ }
1635
+ },
1636
+ "secret_references": {
1637
+ "name": "secret_references",
1638
+ "columns": {
1639
+ "id": {
1640
+ "name": "id",
1641
+ "type": "text",
1642
+ "primaryKey": true,
1643
+ "notNull": true,
1644
+ "autoincrement": false
1645
+ },
1646
+ "project_id": {
1647
+ "name": "project_id",
1648
+ "type": "text",
1649
+ "primaryKey": false,
1650
+ "notNull": true,
1651
+ "autoincrement": false
1652
+ },
1653
+ "environment_id": {
1654
+ "name": "environment_id",
1655
+ "type": "text",
1656
+ "primaryKey": false,
1657
+ "notNull": true,
1658
+ "autoincrement": false
1659
+ },
1660
+ "secret_id": {
1661
+ "name": "secret_id",
1662
+ "type": "text",
1663
+ "primaryKey": false,
1664
+ "notNull": true,
1665
+ "autoincrement": false
1666
+ },
1667
+ "source_project_id": {
1668
+ "name": "source_project_id",
1669
+ "type": "text",
1670
+ "primaryKey": false,
1671
+ "notNull": true,
1672
+ "autoincrement": false
1673
+ },
1674
+ "source_environment_id": {
1675
+ "name": "source_environment_id",
1676
+ "type": "text",
1677
+ "primaryKey": false,
1678
+ "notNull": true,
1679
+ "autoincrement": false
1680
+ },
1681
+ "source_secret_id": {
1682
+ "name": "source_secret_id",
1683
+ "type": "text",
1684
+ "primaryKey": false,
1685
+ "notNull": true,
1686
+ "autoincrement": false
1687
+ },
1688
+ "created_seq": {
1689
+ "name": "created_seq",
1690
+ "type": "integer",
1691
+ "primaryKey": false,
1692
+ "notNull": true,
1693
+ "autoincrement": false
1694
+ },
1695
+ "created_at": {
1696
+ "name": "created_at",
1697
+ "type": "integer",
1698
+ "primaryKey": false,
1699
+ "notNull": true,
1700
+ "autoincrement": false,
1701
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1702
+ },
1703
+ "created_by": {
1704
+ "name": "created_by",
1705
+ "type": "text",
1706
+ "primaryKey": false,
1707
+ "notNull": true,
1708
+ "autoincrement": false
1709
+ }
1710
+ },
1711
+ "indexes": {
1712
+ "secret_references_holder_idx": {
1713
+ "name": "secret_references_holder_idx",
1714
+ "columns": [
1715
+ "secret_id",
1716
+ "created_seq"
1717
+ ],
1718
+ "isUnique": false
1719
+ },
1720
+ "secret_references_source_idx": {
1721
+ "name": "secret_references_source_idx",
1722
+ "columns": [
1723
+ "source_secret_id"
1724
+ ],
1725
+ "isUnique": false
1726
+ },
1727
+ "secret_references_project_idx": {
1728
+ "name": "secret_references_project_idx",
1729
+ "columns": [
1730
+ "project_id"
1731
+ ],
1732
+ "isUnique": false
1733
+ },
1734
+ "secret_references_source_project_idx": {
1735
+ "name": "secret_references_source_project_idx",
1736
+ "columns": [
1737
+ "source_project_id"
1738
+ ],
1739
+ "isUnique": false
1740
+ },
1741
+ "secret_references_created_by_idx": {
1742
+ "name": "secret_references_created_by_idx",
1743
+ "columns": [
1744
+ "created_by"
1745
+ ],
1746
+ "isUnique": false
1747
+ },
1748
+ "secret_references_created_seq_key": {
1749
+ "name": "secret_references_created_seq_key",
1750
+ "columns": [
1751
+ "created_seq"
1752
+ ],
1753
+ "isUnique": true
1754
+ }
1755
+ },
1756
+ "foreignKeys": {
1757
+ "secret_references_secret_id_fkey": {
1758
+ "name": "secret_references_secret_id_fkey",
1759
+ "tableFrom": "secret_references",
1760
+ "tableTo": "secrets",
1761
+ "columnsFrom": [
1762
+ "secret_id"
1763
+ ],
1764
+ "columnsTo": [
1765
+ "id"
1766
+ ],
1767
+ "onDelete": "restrict",
1768
+ "onUpdate": "no action"
1769
+ },
1770
+ "secret_references_source_secret_id_fkey": {
1771
+ "name": "secret_references_source_secret_id_fkey",
1772
+ "tableFrom": "secret_references",
1773
+ "tableTo": "secrets",
1774
+ "columnsFrom": [
1775
+ "source_secret_id"
1776
+ ],
1777
+ "columnsTo": [
1778
+ "id"
1779
+ ],
1780
+ "onDelete": "restrict",
1781
+ "onUpdate": "no action"
1782
+ },
1783
+ "secret_references_created_seq_fkey": {
1784
+ "name": "secret_references_created_seq_fkey",
1785
+ "tableFrom": "secret_references",
1786
+ "tableTo": "audit_log",
1787
+ "columnsFrom": [
1788
+ "created_seq"
1789
+ ],
1790
+ "columnsTo": [
1791
+ "seq"
1792
+ ],
1793
+ "onDelete": "restrict",
1794
+ "onUpdate": "no action"
1795
+ }
1796
+ },
1797
+ "compositePrimaryKeys": {},
1798
+ "uniqueConstraints": {},
1799
+ "checkConstraints": {}
1800
+ },
1801
+ "secret_versions": {
1802
+ "name": "secret_versions",
1803
+ "columns": {
1804
+ "id": {
1805
+ "name": "id",
1806
+ "type": "text",
1807
+ "primaryKey": true,
1808
+ "notNull": true,
1809
+ "autoincrement": false
1810
+ },
1811
+ "secret_id": {
1812
+ "name": "secret_id",
1813
+ "type": "text",
1814
+ "primaryKey": false,
1815
+ "notNull": true,
1816
+ "autoincrement": false
1817
+ },
1818
+ "version": {
1819
+ "name": "version",
1820
+ "type": "integer",
1821
+ "primaryKey": false,
1822
+ "notNull": true,
1823
+ "autoincrement": false
1824
+ },
1825
+ "envelope_version": {
1826
+ "name": "envelope_version",
1827
+ "type": "integer",
1828
+ "primaryKey": false,
1829
+ "notNull": true,
1830
+ "autoincrement": false
1831
+ },
1832
+ "ciphertext": {
1833
+ "name": "ciphertext",
1834
+ "type": "blob",
1835
+ "primaryKey": false,
1836
+ "notNull": true,
1837
+ "autoincrement": false
1838
+ },
1839
+ "iv": {
1840
+ "name": "iv",
1841
+ "type": "blob",
1842
+ "primaryKey": false,
1843
+ "notNull": true,
1844
+ "autoincrement": false
1845
+ },
1846
+ "auth_tag": {
1847
+ "name": "auth_tag",
1848
+ "type": "blob",
1849
+ "primaryKey": false,
1850
+ "notNull": true,
1851
+ "autoincrement": false
1852
+ },
1853
+ "wrapped_dek": {
1854
+ "name": "wrapped_dek",
1855
+ "type": "blob",
1856
+ "primaryKey": false,
1857
+ "notNull": true,
1858
+ "autoincrement": false
1859
+ },
1860
+ "kek_provider": {
1861
+ "name": "kek_provider",
1862
+ "type": "text",
1863
+ "primaryKey": false,
1864
+ "notNull": true,
1865
+ "autoincrement": false
1866
+ },
1867
+ "kek_id": {
1868
+ "name": "kek_id",
1869
+ "type": "text",
1870
+ "primaryKey": false,
1871
+ "notNull": true,
1872
+ "autoincrement": false
1873
+ },
1874
+ "kek_version": {
1875
+ "name": "kek_version",
1876
+ "type": "text",
1877
+ "primaryKey": false,
1878
+ "notNull": true,
1879
+ "autoincrement": false
1880
+ },
1881
+ "created_at": {
1882
+ "name": "created_at",
1883
+ "type": "integer",
1884
+ "primaryKey": false,
1885
+ "notNull": true,
1886
+ "autoincrement": false,
1887
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1888
+ },
1889
+ "created_by": {
1890
+ "name": "created_by",
1891
+ "type": "text",
1892
+ "primaryKey": false,
1893
+ "notNull": true,
1120
1894
  "autoincrement": false
1121
1895
  }
1122
1896
  },
@@ -1238,6 +2012,13 @@
1238
2012
  "primaryKey": false,
1239
2013
  "notNull": false,
1240
2014
  "autoincrement": false
2015
+ },
2016
+ "folder": {
2017
+ "name": "folder",
2018
+ "type": "text",
2019
+ "primaryKey": false,
2020
+ "notNull": false,
2021
+ "autoincrement": false
1241
2022
  }
1242
2023
  },
1243
2024
  "indexes": {
@@ -1322,6 +2103,167 @@
1322
2103
  "secrets_key_check": {
1323
2104
  "name": "secrets_key_check",
1324
2105
  "value": "length(\"secrets\".\"key\") BETWEEN 1 AND 128 AND \"secrets\".\"key\" GLOB '[A-Za-z_]*' AND \"secrets\".\"key\" NOT GLOB '*[^A-Za-z0-9_]*'"
2106
+ },
2107
+ "secrets_folder_check": {
2108
+ "name": "secrets_folder_check",
2109
+ "value": "\"secrets\".\"folder\" IS NULL OR (length(\"secrets\".\"folder\") BETWEEN 1 AND 64 AND \"secrets\".\"folder\" NOT GLOB '*/*' AND \"secrets\".\"folder\" = trim(\"secrets\".\"folder\"))"
2110
+ }
2111
+ }
2112
+ },
2113
+ "service_bindings": {
2114
+ "name": "service_bindings",
2115
+ "columns": {
2116
+ "id": {
2117
+ "name": "id",
2118
+ "type": "text",
2119
+ "primaryKey": true,
2120
+ "notNull": true,
2121
+ "autoincrement": false
2122
+ },
2123
+ "auth_mac": {
2124
+ "name": "auth_mac",
2125
+ "type": "blob",
2126
+ "primaryKey": false,
2127
+ "notNull": true,
2128
+ "autoincrement": false
2129
+ },
2130
+ "principal": {
2131
+ "name": "principal",
2132
+ "type": "text",
2133
+ "primaryKey": false,
2134
+ "notNull": true,
2135
+ "autoincrement": false
2136
+ },
2137
+ "generation": {
2138
+ "name": "generation",
2139
+ "type": "integer",
2140
+ "primaryKey": false,
2141
+ "notNull": true,
2142
+ "autoincrement": false
2143
+ },
2144
+ "profile": {
2145
+ "name": "profile",
2146
+ "type": "text",
2147
+ "primaryKey": false,
2148
+ "notNull": true,
2149
+ "autoincrement": false
2150
+ },
2151
+ "issuer": {
2152
+ "name": "issuer",
2153
+ "type": "text",
2154
+ "primaryKey": false,
2155
+ "notNull": true,
2156
+ "autoincrement": false
2157
+ },
2158
+ "jwks_uri": {
2159
+ "name": "jwks_uri",
2160
+ "type": "text",
2161
+ "primaryKey": false,
2162
+ "notNull": true,
2163
+ "autoincrement": false
2164
+ },
2165
+ "claims": {
2166
+ "name": "claims",
2167
+ "type": "text",
2168
+ "primaryKey": false,
2169
+ "notNull": true,
2170
+ "autoincrement": false
2171
+ },
2172
+ "label": {
2173
+ "name": "label",
2174
+ "type": "text",
2175
+ "primaryKey": false,
2176
+ "notNull": false,
2177
+ "autoincrement": false
2178
+ },
2179
+ "created_at": {
2180
+ "name": "created_at",
2181
+ "type": "integer",
2182
+ "primaryKey": false,
2183
+ "notNull": true,
2184
+ "autoincrement": false,
2185
+ "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
2186
+ },
2187
+ "created_by": {
2188
+ "name": "created_by",
2189
+ "type": "text",
2190
+ "primaryKey": false,
2191
+ "notNull": true,
2192
+ "autoincrement": false
2193
+ },
2194
+ "last_used_at": {
2195
+ "name": "last_used_at",
2196
+ "type": "integer",
2197
+ "primaryKey": false,
2198
+ "notNull": false,
2199
+ "autoincrement": false
2200
+ },
2201
+ "revoked_at": {
2202
+ "name": "revoked_at",
2203
+ "type": "integer",
2204
+ "primaryKey": false,
2205
+ "notNull": false,
2206
+ "autoincrement": false
2207
+ },
2208
+ "revoked_by": {
2209
+ "name": "revoked_by",
2210
+ "type": "text",
2211
+ "primaryKey": false,
2212
+ "notNull": false,
2213
+ "autoincrement": false
2214
+ }
2215
+ },
2216
+ "indexes": {
2217
+ "service_bindings_principal_idx": {
2218
+ "name": "service_bindings_principal_idx",
2219
+ "columns": [
2220
+ "principal",
2221
+ "issuer"
2222
+ ],
2223
+ "isUnique": false
2224
+ },
2225
+ "service_bindings_live_idx": {
2226
+ "name": "service_bindings_live_idx",
2227
+ "columns": [
2228
+ "principal",
2229
+ "issuer",
2230
+ "generation",
2231
+ "created_at",
2232
+ "id"
2233
+ ],
2234
+ "isUnique": false,
2235
+ "where": "\"service_bindings\".\"revoked_at\" IS NULL"
2236
+ }
2237
+ },
2238
+ "foreignKeys": {
2239
+ "service_bindings_principal_fkey": {
2240
+ "name": "service_bindings_principal_fkey",
2241
+ "tableFrom": "service_bindings",
2242
+ "tableTo": "vault_members",
2243
+ "columnsFrom": [
2244
+ "principal"
2245
+ ],
2246
+ "columnsTo": [
2247
+ "principal"
2248
+ ],
2249
+ "onDelete": "restrict",
2250
+ "onUpdate": "no action"
2251
+ }
2252
+ },
2253
+ "compositePrimaryKeys": {},
2254
+ "uniqueConstraints": {},
2255
+ "checkConstraints": {
2256
+ "service_bindings_principal_check": {
2257
+ "name": "service_bindings_principal_check",
2258
+ "value": "\"service_bindings\".\"principal\" LIKE 'token:%'"
2259
+ },
2260
+ "service_bindings_auth_mac_check": {
2261
+ "name": "service_bindings_auth_mac_check",
2262
+ "value": "octet_length(\"service_bindings\".\"auth_mac\") = 32"
2263
+ },
2264
+ "service_bindings_claims_check": {
2265
+ "name": "service_bindings_claims_check",
2266
+ "value": "json_valid(\"service_bindings\".\"claims\")"
1325
2267
  }
1326
2268
  }
1327
2269
  },
@@ -1349,6 +2291,13 @@
1349
2291
  "notNull": false,
1350
2292
  "autoincrement": false
1351
2293
  },
2294
+ "environment_slug": {
2295
+ "name": "environment_slug",
2296
+ "type": "text",
2297
+ "primaryKey": false,
2298
+ "notNull": false,
2299
+ "autoincrement": false
2300
+ },
1352
2301
  "role": {
1353
2302
  "name": "role",
1354
2303
  "type": "text",
@@ -1379,6 +2328,14 @@
1379
2328
  }
1380
2329
  },
1381
2330
  "indexes": {
2331
+ "vault_grants_on_every_project": {
2332
+ "name": "vault_grants_on_every_project",
2333
+ "columns": [
2334
+ "principal"
2335
+ ],
2336
+ "isUnique": true,
2337
+ "where": "\"vault_grants\".\"project_id\" IS NULL AND \"vault_grants\".\"environment_id\" IS NULL AND \"vault_grants\".\"environment_slug\" IS NULL"
2338
+ },
1382
2339
  "vault_grants_on_project": {
1383
2340
  "name": "vault_grants_on_project",
1384
2341
  "columns": [
@@ -1394,6 +2351,14 @@
1394
2351
  "environment_id"
1395
2352
  ],
1396
2353
  "isUnique": true
2354
+ },
2355
+ "vault_grants_on_environment_slug": {
2356
+ "name": "vault_grants_on_environment_slug",
2357
+ "columns": [
2358
+ "principal",
2359
+ "environment_slug"
2360
+ ],
2361
+ "isUnique": true
1397
2362
  }
1398
2363
  },
1399
2364
  "foreignKeys": {
@@ -1442,7 +2407,11 @@
1442
2407
  "checkConstraints": {
1443
2408
  "vault_grants_one_place": {
1444
2409
  "name": "vault_grants_one_place",
1445
- "value": "(\"vault_grants\".\"project_id\" IS NULL) <> (\"vault_grants\".\"environment_id\" IS NULL)"
2410
+ "value": "((\"vault_grants\".\"project_id\" IS NULL) <> (\"vault_grants\".\"environment_id\" IS NULL) AND \"vault_grants\".\"environment_slug\" IS NULL) OR (\"vault_grants\".\"project_id\" IS NULL AND \"vault_grants\".\"environment_id\" IS NULL)"
2411
+ },
2412
+ "vault_grants_environment_slug_check": {
2413
+ "name": "vault_grants_environment_slug_check",
2414
+ "value": "\"vault_grants\".\"environment_slug\" IS NULL OR (length(\"vault_grants\".\"environment_slug\") BETWEEN 1 AND 63 AND \"vault_grants\".\"environment_slug\" GLOB '[a-z0-9]*' AND \"vault_grants\".\"environment_slug\" NOT GLOB '*[^a-z0-9-]*')"
1446
2415
  },
1447
2416
  "vault_grants_role_check": {
1448
2417
  "name": "vault_grants_role_check",
@@ -1450,7 +2419,7 @@
1450
2419
  },
1451
2420
  "vault_grants_environment_role_check": {
1452
2421
  "name": "vault_grants_environment_role_check",
1453
- "value": "\"vault_grants\".\"environment_id\" IS NULL OR \"vault_grants\".\"role\" IN ('viewer', 'developer', 'auditor')"
2422
+ "value": "(\"vault_grants\".\"environment_id\" IS NULL AND \"vault_grants\".\"environment_slug\" IS NULL) OR \"vault_grants\".\"role\" IN ('viewer', 'developer', 'auditor')"
1454
2423
  }
1455
2424
  }
1456
2425
  },
@@ -1541,7 +2510,7 @@
1541
2510
  },
1542
2511
  "vault_members_principal_check": {
1543
2512
  "name": "vault_members_principal_check",
1544
- "value": "(\"vault_members\".\"principal\" GLOB 'user:?*' OR \"vault_members\".\"principal\" GLOB 'token:?*' OR \"vault_members\".\"principal\" GLOB 'sync:?*')\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"
2513
+ "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"
1545
2514
  },
1546
2515
  "vault_members_user_lowercase": {
1547
2516
  "name": "vault_members_user_lowercase",
@@ -1570,6 +2539,42 @@
1570
2539
  "columns": {}
1571
2540
  },
1572
2541
  "internal": {
1573
- "indexes": {}
2542
+ "indexes": {
2543
+ "audit_log_unbind_idx": {
2544
+ "columns": {
2545
+ "json_extract(\"metadata\", '$.bindingId')": {
2546
+ "isExpression": true
2547
+ }
2548
+ }
2549
+ },
2550
+ "audit_log_exchange_idx": {
2551
+ "columns": {
2552
+ "json_extract(\"metadata\", '$.credentialId')": {
2553
+ "isExpression": true
2554
+ }
2555
+ }
2556
+ },
2557
+ "audit_log_also_project_idx": {
2558
+ "columns": {
2559
+ "json_extract(\"metadata\", '$.also.projectId')": {
2560
+ "isExpression": true
2561
+ }
2562
+ }
2563
+ },
2564
+ "audit_log_also_environment_idx": {
2565
+ "columns": {
2566
+ "json_extract(\"metadata\", '$.also.environmentId')": {
2567
+ "isExpression": true
2568
+ }
2569
+ }
2570
+ },
2571
+ "audit_log_also_secret_idx": {
2572
+ "columns": {
2573
+ "json_extract(\"metadata\", '$.also.secretId')": {
2574
+ "isExpression": true
2575
+ }
2576
+ }
2577
+ }
2578
+ }
1574
2579
  }
1575
2580
  }