@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,1811 +0,0 @@
1
- {
2
- "version": "6",
3
- "dialect": "sqlite",
4
- "id": "872b6cf5-b4f3-48e4-ac6b-4cc7b6479ecd",
5
- "prevId": "cb1471ad-69ff-4ca5-bd54-361c9b9f0168",
6
- "tables": {
7
- "audit_chain_head": {
8
- "name": "audit_chain_head",
9
- "columns": {
10
- "only_row": {
11
- "name": "only_row",
12
- "type": "integer",
13
- "primaryKey": true,
14
- "notNull": true,
15
- "autoincrement": false,
16
- "default": true
17
- },
18
- "next_seq": {
19
- "name": "next_seq",
20
- "type": "integer",
21
- "primaryKey": false,
22
- "notNull": true,
23
- "autoincrement": false,
24
- "default": "0"
25
- },
26
- "head_hash": {
27
- "name": "head_hash",
28
- "type": "blob",
29
- "primaryKey": false,
30
- "notNull": true,
31
- "autoincrement": false
32
- }
33
- },
34
- "indexes": {},
35
- "foreignKeys": {},
36
- "compositePrimaryKeys": {},
37
- "uniqueConstraints": {},
38
- "checkConstraints": {
39
- "audit_chain_head_only_row_check": {
40
- "name": "audit_chain_head_only_row_check",
41
- "value": "\"audit_chain_head\".\"only_row\""
42
- },
43
- "audit_chain_head_next_seq_check": {
44
- "name": "audit_chain_head_next_seq_check",
45
- "value": "\"audit_chain_head\".\"next_seq\" >= 0"
46
- },
47
- "audit_chain_head_head_hash_check": {
48
- "name": "audit_chain_head_head_hash_check",
49
- "value": "octet_length(\"audit_chain_head\".\"head_hash\") = 32"
50
- }
51
- }
52
- },
53
- "audit_log": {
54
- "name": "audit_log",
55
- "columns": {
56
- "seq": {
57
- "name": "seq",
58
- "type": "integer",
59
- "primaryKey": true,
60
- "notNull": true,
61
- "autoincrement": false
62
- },
63
- "author": {
64
- "name": "author",
65
- "type": "text",
66
- "primaryKey": false,
67
- "notNull": true,
68
- "autoincrement": false
69
- },
70
- "key_id": {
71
- "name": "key_id",
72
- "type": "text",
73
- "primaryKey": false,
74
- "notNull": true,
75
- "autoincrement": false
76
- },
77
- "occurred_at": {
78
- "name": "occurred_at",
79
- "type": "integer",
80
- "primaryKey": false,
81
- "notNull": true,
82
- "autoincrement": false
83
- },
84
- "actor": {
85
- "name": "actor",
86
- "type": "text",
87
- "primaryKey": false,
88
- "notNull": true,
89
- "autoincrement": false
90
- },
91
- "action": {
92
- "name": "action",
93
- "type": "text",
94
- "primaryKey": false,
95
- "notNull": true,
96
- "autoincrement": false
97
- },
98
- "decision": {
99
- "name": "decision",
100
- "type": "text",
101
- "primaryKey": false,
102
- "notNull": true,
103
- "autoincrement": false
104
- },
105
- "code": {
106
- "name": "code",
107
- "type": "text",
108
- "primaryKey": false,
109
- "notNull": false,
110
- "autoincrement": false
111
- },
112
- "subject_principal": {
113
- "name": "subject_principal",
114
- "type": "text",
115
- "primaryKey": false,
116
- "notNull": false,
117
- "autoincrement": false
118
- },
119
- "project_id": {
120
- "name": "project_id",
121
- "type": "text",
122
- "primaryKey": false,
123
- "notNull": false,
124
- "autoincrement": false
125
- },
126
- "environment_id": {
127
- "name": "environment_id",
128
- "type": "text",
129
- "primaryKey": false,
130
- "notNull": false,
131
- "autoincrement": false
132
- },
133
- "secret_id": {
134
- "name": "secret_id",
135
- "type": "text",
136
- "primaryKey": false,
137
- "notNull": false,
138
- "autoincrement": false
139
- },
140
- "secret_version_id": {
141
- "name": "secret_version_id",
142
- "type": "text",
143
- "primaryKey": false,
144
- "notNull": false,
145
- "autoincrement": false
146
- },
147
- "operation_id": {
148
- "name": "operation_id",
149
- "type": "text",
150
- "primaryKey": false,
151
- "notNull": false,
152
- "autoincrement": false
153
- },
154
- "request_id": {
155
- "name": "request_id",
156
- "type": "text",
157
- "primaryKey": false,
158
- "notNull": false,
159
- "autoincrement": false
160
- },
161
- "source_ip": {
162
- "name": "source_ip",
163
- "type": "text",
164
- "primaryKey": false,
165
- "notNull": false,
166
- "autoincrement": false
167
- },
168
- "related_seq": {
169
- "name": "related_seq",
170
- "type": "integer",
171
- "primaryKey": false,
172
- "notNull": false,
173
- "autoincrement": false
174
- },
175
- "metadata": {
176
- "name": "metadata",
177
- "type": "text",
178
- "primaryKey": false,
179
- "notNull": true,
180
- "autoincrement": false,
181
- "default": "'{}'"
182
- },
183
- "prev_hash": {
184
- "name": "prev_hash",
185
- "type": "blob",
186
- "primaryKey": false,
187
- "notNull": true,
188
- "autoincrement": false
189
- },
190
- "mac": {
191
- "name": "mac",
192
- "type": "blob",
193
- "primaryKey": false,
194
- "notNull": true,
195
- "autoincrement": false
196
- },
197
- "hash": {
198
- "name": "hash",
199
- "type": "blob",
200
- "primaryKey": false,
201
- "notNull": true,
202
- "autoincrement": false
203
- }
204
- },
205
- "indexes": {
206
- "audit_log_project_idx": {
207
- "name": "audit_log_project_idx",
208
- "columns": [
209
- "project_id",
210
- "seq"
211
- ],
212
- "isUnique": false
213
- },
214
- "audit_log_environment_idx": {
215
- "name": "audit_log_environment_idx",
216
- "columns": [
217
- "environment_id",
218
- "seq"
219
- ],
220
- "isUnique": false
221
- },
222
- "audit_log_secret_idx": {
223
- "name": "audit_log_secret_idx",
224
- "columns": [
225
- "secret_id",
226
- "seq"
227
- ],
228
- "isUnique": false
229
- },
230
- "audit_log_actor_idx": {
231
- "name": "audit_log_actor_idx",
232
- "columns": [
233
- "actor",
234
- "seq"
235
- ],
236
- "isUnique": false
237
- },
238
- "audit_log_operation_idx": {
239
- "name": "audit_log_operation_idx",
240
- "columns": [
241
- "operation_id",
242
- "seq"
243
- ],
244
- "isUnique": false
245
- },
246
- "audit_log_action_idx": {
247
- "name": "audit_log_action_idx",
248
- "columns": [
249
- "author",
250
- "action",
251
- "seq"
252
- ],
253
- "isUnique": false
254
- },
255
- "audit_log_releases_idx": {
256
- "name": "audit_log_releases_idx",
257
- "columns": [
258
- "author",
259
- "actor",
260
- "action",
261
- "decision",
262
- "occurred_at"
263
- ],
264
- "isUnique": false
265
- },
266
- "audit_log_subject_idx": {
267
- "name": "audit_log_subject_idx",
268
- "columns": [
269
- "author",
270
- "subject_principal",
271
- "seq"
272
- ],
273
- "isUnique": false
274
- },
275
- "audit_log_unbind_idx": {
276
- "name": "audit_log_unbind_idx",
277
- "columns": [
278
- "json_extract(\"metadata\", '$.bindingId')"
279
- ],
280
- "isUnique": false,
281
- "where": "\"audit_log\".\"author\" = 'app' AND \"audit_log\".\"action\" = 'token.unbind' AND \"audit_log\".\"decision\" = 'allow'"
282
- },
283
- "audit_log_exchange_idx": {
284
- "name": "audit_log_exchange_idx",
285
- "columns": [
286
- "json_extract(\"metadata\", '$.credentialId')"
287
- ],
288
- "isUnique": false,
289
- "where": "\"audit_log\".\"author\" = 'app' AND \"audit_log\".\"action\" = 'token.exchange' AND \"audit_log\".\"decision\" = 'allow'"
290
- }
291
- },
292
- "foreignKeys": {
293
- "audit_log_project_id_fkey": {
294
- "name": "audit_log_project_id_fkey",
295
- "tableFrom": "audit_log",
296
- "tableTo": "projects",
297
- "columnsFrom": [
298
- "project_id"
299
- ],
300
- "columnsTo": [
301
- "id"
302
- ],
303
- "onDelete": "restrict",
304
- "onUpdate": "no action"
305
- },
306
- "audit_log_environment_id_fkey": {
307
- "name": "audit_log_environment_id_fkey",
308
- "tableFrom": "audit_log",
309
- "tableTo": "environments",
310
- "columnsFrom": [
311
- "environment_id"
312
- ],
313
- "columnsTo": [
314
- "id"
315
- ],
316
- "onDelete": "restrict",
317
- "onUpdate": "no action"
318
- },
319
- "audit_log_secret_id_fkey": {
320
- "name": "audit_log_secret_id_fkey",
321
- "tableFrom": "audit_log",
322
- "tableTo": "secrets",
323
- "columnsFrom": [
324
- "secret_id"
325
- ],
326
- "columnsTo": [
327
- "id"
328
- ],
329
- "onDelete": "restrict",
330
- "onUpdate": "no action"
331
- },
332
- "audit_log_secret_version_id_fkey": {
333
- "name": "audit_log_secret_version_id_fkey",
334
- "tableFrom": "audit_log",
335
- "tableTo": "secret_versions",
336
- "columnsFrom": [
337
- "secret_version_id"
338
- ],
339
- "columnsTo": [
340
- "id"
341
- ],
342
- "onDelete": "restrict",
343
- "onUpdate": "no action"
344
- },
345
- "audit_log_related_seq_fkey": {
346
- "name": "audit_log_related_seq_fkey",
347
- "tableFrom": "audit_log",
348
- "tableTo": "audit_log",
349
- "columnsFrom": [
350
- "related_seq"
351
- ],
352
- "columnsTo": [
353
- "seq"
354
- ],
355
- "onDelete": "restrict",
356
- "onUpdate": "no action"
357
- }
358
- },
359
- "compositePrimaryKeys": {},
360
- "uniqueConstraints": {},
361
- "checkConstraints": {
362
- "audit_log_author_check": {
363
- "name": "audit_log_author_check",
364
- "value": "\"audit_log\".\"author\" IN ('app', 'vault')"
365
- },
366
- "audit_log_actor_check": {
367
- "name": "audit_log_actor_check",
368
- "value": "\"audit_log\".\"actor\" GLOB 'user:?*' OR \"audit_log\".\"actor\" GLOB 'token:?*' OR \"audit_log\".\"actor\" GLOB 'sync:?*' OR \"audit_log\".\"actor\" GLOB 'system:?*'"
369
- },
370
- "audit_log_decision_check": {
371
- "name": "audit_log_decision_check",
372
- "value": "\"audit_log\".\"decision\" IN ('allow', 'deny')"
373
- },
374
- "audit_log_metadata_check": {
375
- "name": "audit_log_metadata_check",
376
- "value": "json_valid(\"audit_log\".\"metadata\")"
377
- },
378
- "audit_log_prev_hash_check": {
379
- "name": "audit_log_prev_hash_check",
380
- "value": "octet_length(\"audit_log\".\"prev_hash\") = 32"
381
- },
382
- "audit_log_mac_check": {
383
- "name": "audit_log_mac_check",
384
- "value": "octet_length(\"audit_log\".\"mac\") = 32"
385
- },
386
- "audit_log_hash_check": {
387
- "name": "audit_log_hash_check",
388
- "value": "octet_length(\"audit_log\".\"hash\") = 32"
389
- }
390
- }
391
- },
392
- "consumed_tokens": {
393
- "name": "consumed_tokens",
394
- "columns": {
395
- "hash": {
396
- "name": "hash",
397
- "type": "blob",
398
- "primaryKey": true,
399
- "notNull": true,
400
- "autoincrement": false
401
- },
402
- "consumed_at": {
403
- "name": "consumed_at",
404
- "type": "integer",
405
- "primaryKey": false,
406
- "notNull": true,
407
- "autoincrement": false,
408
- "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
409
- }
410
- },
411
- "indexes": {},
412
- "foreignKeys": {},
413
- "compositePrimaryKeys": {},
414
- "uniqueConstraints": {},
415
- "checkConstraints": {
416
- "consumed_tokens_hash_check": {
417
- "name": "consumed_tokens_hash_check",
418
- "value": "octet_length(\"consumed_tokens\".\"hash\") = 32"
419
- }
420
- }
421
- },
422
- "credentials": {
423
- "name": "credentials",
424
- "columns": {
425
- "id": {
426
- "name": "id",
427
- "type": "text",
428
- "primaryKey": true,
429
- "notNull": true,
430
- "autoincrement": false
431
- },
432
- "kind": {
433
- "name": "kind",
434
- "type": "text",
435
- "primaryKey": false,
436
- "notNull": true,
437
- "autoincrement": false
438
- },
439
- "auth_mac": {
440
- "name": "auth_mac",
441
- "type": "blob",
442
- "primaryKey": false,
443
- "notNull": true,
444
- "autoincrement": false
445
- },
446
- "token_hash": {
447
- "name": "token_hash",
448
- "type": "blob",
449
- "primaryKey": false,
450
- "notNull": true,
451
- "autoincrement": false
452
- },
453
- "token_hint": {
454
- "name": "token_hint",
455
- "type": "text",
456
- "primaryKey": false,
457
- "notNull": true,
458
- "autoincrement": false
459
- },
460
- "generation": {
461
- "name": "generation",
462
- "type": "integer",
463
- "primaryKey": false,
464
- "notNull": true,
465
- "autoincrement": false
466
- },
467
- "principal": {
468
- "name": "principal",
469
- "type": "text",
470
- "primaryKey": false,
471
- "notNull": true,
472
- "autoincrement": false
473
- },
474
- "identity_id": {
475
- "name": "identity_id",
476
- "type": "text",
477
- "primaryKey": false,
478
- "notNull": false,
479
- "autoincrement": false
480
- },
481
- "label": {
482
- "name": "label",
483
- "type": "text",
484
- "primaryKey": false,
485
- "notNull": false,
486
- "autoincrement": false
487
- },
488
- "created_at": {
489
- "name": "created_at",
490
- "type": "integer",
491
- "primaryKey": false,
492
- "notNull": true,
493
- "autoincrement": false,
494
- "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
495
- },
496
- "created_by": {
497
- "name": "created_by",
498
- "type": "text",
499
- "primaryKey": false,
500
- "notNull": true,
501
- "autoincrement": false
502
- },
503
- "expires_at": {
504
- "name": "expires_at",
505
- "type": "integer",
506
- "primaryKey": false,
507
- "notNull": true,
508
- "autoincrement": false
509
- },
510
- "last_used_at": {
511
- "name": "last_used_at",
512
- "type": "integer",
513
- "primaryKey": false,
514
- "notNull": false,
515
- "autoincrement": false
516
- },
517
- "last_used_ip": {
518
- "name": "last_used_ip",
519
- "type": "text",
520
- "primaryKey": false,
521
- "notNull": false,
522
- "autoincrement": false
523
- },
524
- "revoked_at": {
525
- "name": "revoked_at",
526
- "type": "integer",
527
- "primaryKey": false,
528
- "notNull": false,
529
- "autoincrement": false
530
- },
531
- "revoked_by": {
532
- "name": "revoked_by",
533
- "type": "text",
534
- "primaryKey": false,
535
- "notNull": false,
536
- "autoincrement": false
537
- }
538
- },
539
- "indexes": {
540
- "credentials_principal_idx": {
541
- "name": "credentials_principal_idx",
542
- "columns": [
543
- "principal",
544
- "generation"
545
- ],
546
- "isUnique": false
547
- },
548
- "credentials_live_idx": {
549
- "name": "credentials_live_idx",
550
- "columns": [
551
- "principal",
552
- "expires_at"
553
- ],
554
- "isUnique": false,
555
- "where": "\"credentials\".\"revoked_at\" IS NULL"
556
- },
557
- "credentials_issued_by_idx": {
558
- "name": "credentials_issued_by_idx",
559
- "columns": [
560
- "principal",
561
- "created_by",
562
- "created_at"
563
- ],
564
- "isUnique": false
565
- },
566
- "credentials_token_hash_key": {
567
- "name": "credentials_token_hash_key",
568
- "columns": [
569
- "token_hash"
570
- ],
571
- "isUnique": true
572
- }
573
- },
574
- "foreignKeys": {
575
- "credentials_principal_fkey": {
576
- "name": "credentials_principal_fkey",
577
- "tableFrom": "credentials",
578
- "tableTo": "vault_members",
579
- "columnsFrom": [
580
- "principal"
581
- ],
582
- "columnsTo": [
583
- "principal"
584
- ],
585
- "onDelete": "restrict",
586
- "onUpdate": "no action"
587
- },
588
- "credentials_identity_id_fkey": {
589
- "name": "credentials_identity_id_fkey",
590
- "tableFrom": "credentials",
591
- "tableTo": "identities",
592
- "columnsFrom": [
593
- "identity_id",
594
- "principal",
595
- "generation"
596
- ],
597
- "columnsTo": [
598
- "id",
599
- "principal",
600
- "generation"
601
- ],
602
- "onDelete": "restrict",
603
- "onUpdate": "no action"
604
- }
605
- },
606
- "compositePrimaryKeys": {},
607
- "uniqueConstraints": {},
608
- "checkConstraints": {
609
- "credentials_kind_check": {
610
- "name": "credentials_kind_check",
611
- "value": "\"credentials\".\"kind\" IN ('browser', 'cli', 'service')"
612
- },
613
- "credentials_principal_check": {
614
- "name": "credentials_principal_check",
615
- "value": "\"credentials\".\"principal\" LIKE 'user:%' OR \"credentials\".\"principal\" LIKE 'token:%'"
616
- },
617
- "credentials_kind_matches_principal": {
618
- "name": "credentials_kind_matches_principal",
619
- "value": "(\"credentials\".\"kind\" = 'service') = (\"credentials\".\"principal\" LIKE 'token:%')"
620
- },
621
- "credentials_token_hash_check": {
622
- "name": "credentials_token_hash_check",
623
- "value": "octet_length(\"credentials\".\"token_hash\") = 32"
624
- },
625
- "credentials_auth_mac_check": {
626
- "name": "credentials_auth_mac_check",
627
- "value": "octet_length(\"credentials\".\"auth_mac\") = 32"
628
- }
629
- }
630
- },
631
- "device_authorizations": {
632
- "name": "device_authorizations",
633
- "columns": {
634
- "id": {
635
- "name": "id",
636
- "type": "text",
637
- "primaryKey": true,
638
- "notNull": true,
639
- "autoincrement": false
640
- },
641
- "device_code_hash": {
642
- "name": "device_code_hash",
643
- "type": "blob",
644
- "primaryKey": false,
645
- "notNull": true,
646
- "autoincrement": false
647
- },
648
- "auth_mac": {
649
- "name": "auth_mac",
650
- "type": "blob",
651
- "primaryKey": false,
652
- "notNull": true,
653
- "autoincrement": false
654
- },
655
- "user_code": {
656
- "name": "user_code",
657
- "type": "text",
658
- "primaryKey": false,
659
- "notNull": true,
660
- "autoincrement": false
661
- },
662
- "client_label": {
663
- "name": "client_label",
664
- "type": "text",
665
- "primaryKey": false,
666
- "notNull": false,
667
- "autoincrement": false
668
- },
669
- "client_ip": {
670
- "name": "client_ip",
671
- "type": "text",
672
- "primaryKey": false,
673
- "notNull": false,
674
- "autoincrement": false
675
- },
676
- "created_at": {
677
- "name": "created_at",
678
- "type": "integer",
679
- "primaryKey": false,
680
- "notNull": true,
681
- "autoincrement": false,
682
- "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
683
- },
684
- "expires_at": {
685
- "name": "expires_at",
686
- "type": "integer",
687
- "primaryKey": false,
688
- "notNull": true,
689
- "autoincrement": false
690
- },
691
- "decided_at": {
692
- "name": "decided_at",
693
- "type": "integer",
694
- "primaryKey": false,
695
- "notNull": false,
696
- "autoincrement": false
697
- },
698
- "decision": {
699
- "name": "decision",
700
- "type": "text",
701
- "primaryKey": false,
702
- "notNull": false,
703
- "autoincrement": false
704
- },
705
- "generation": {
706
- "name": "generation",
707
- "type": "integer",
708
- "primaryKey": false,
709
- "notNull": true,
710
- "autoincrement": false,
711
- "default": 0
712
- },
713
- "principal": {
714
- "name": "principal",
715
- "type": "text",
716
- "primaryKey": false,
717
- "notNull": false,
718
- "autoincrement": false
719
- },
720
- "consumed_at": {
721
- "name": "consumed_at",
722
- "type": "integer",
723
- "primaryKey": false,
724
- "notNull": false,
725
- "autoincrement": false
726
- }
727
- },
728
- "indexes": {
729
- "device_authorizations_device_code_hash_key": {
730
- "name": "device_authorizations_device_code_hash_key",
731
- "columns": [
732
- "device_code_hash"
733
- ],
734
- "isUnique": true
735
- },
736
- "device_authorizations_user_code_key": {
737
- "name": "device_authorizations_user_code_key",
738
- "columns": [
739
- "user_code"
740
- ],
741
- "isUnique": true
742
- }
743
- },
744
- "foreignKeys": {
745
- "device_authorizations_principal_fkey": {
746
- "name": "device_authorizations_principal_fkey",
747
- "tableFrom": "device_authorizations",
748
- "tableTo": "vault_members",
749
- "columnsFrom": [
750
- "principal"
751
- ],
752
- "columnsTo": [
753
- "principal"
754
- ],
755
- "onDelete": "restrict",
756
- "onUpdate": "no action"
757
- }
758
- },
759
- "compositePrimaryKeys": {},
760
- "uniqueConstraints": {},
761
- "checkConstraints": {
762
- "device_authorizations_auth_mac_check": {
763
- "name": "device_authorizations_auth_mac_check",
764
- "value": "octet_length(\"device_authorizations\".\"auth_mac\") = 32"
765
- },
766
- "device_authorizations_decision_check": {
767
- "name": "device_authorizations_decision_check",
768
- "value": "\"device_authorizations\".\"decision\" IS NULL OR \"device_authorizations\".\"decision\" IN ('approved', 'denied')"
769
- },
770
- "device_authorizations_approval_names_principal": {
771
- "name": "device_authorizations_approval_names_principal",
772
- "value": "(\"device_authorizations\".\"decision\" IS NULL AND \"device_authorizations\".\"decided_at\" IS NULL AND \"device_authorizations\".\"principal\" IS NULL AND \"device_authorizations\".\"generation\" = 0 AND \"device_authorizations\".\"consumed_at\" IS NULL)\n OR (\"device_authorizations\".\"decision\" IS NOT NULL AND \"device_authorizations\".\"decided_at\" IS NOT NULL AND (\n (\"device_authorizations\".\"decision\" = 'denied' AND \"device_authorizations\".\"principal\" IS NULL AND \"device_authorizations\".\"generation\" = 0 AND \"device_authorizations\".\"consumed_at\" IS NULL)\n OR (\"device_authorizations\".\"decision\" = 'approved' AND \"device_authorizations\".\"principal\" IS NOT NULL AND \"device_authorizations\".\"principal\" LIKE 'user:%')\n ))"
773
- }
774
- }
775
- },
776
- "environments": {
777
- "name": "environments",
778
- "columns": {
779
- "id": {
780
- "name": "id",
781
- "type": "text",
782
- "primaryKey": true,
783
- "notNull": true,
784
- "autoincrement": false
785
- },
786
- "project_id": {
787
- "name": "project_id",
788
- "type": "text",
789
- "primaryKey": false,
790
- "notNull": true,
791
- "autoincrement": false
792
- },
793
- "slug": {
794
- "name": "slug",
795
- "type": "text",
796
- "primaryKey": false,
797
- "notNull": true,
798
- "autoincrement": false
799
- },
800
- "name": {
801
- "name": "name",
802
- "type": "text",
803
- "primaryKey": false,
804
- "notNull": true,
805
- "autoincrement": false
806
- },
807
- "created_at": {
808
- "name": "created_at",
809
- "type": "integer",
810
- "primaryKey": false,
811
- "notNull": true,
812
- "autoincrement": false,
813
- "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
814
- },
815
- "archived_at": {
816
- "name": "archived_at",
817
- "type": "integer",
818
- "primaryKey": false,
819
- "notNull": false,
820
- "autoincrement": false
821
- }
822
- },
823
- "indexes": {
824
- "environments_project_id_slug_key": {
825
- "name": "environments_project_id_slug_key",
826
- "columns": [
827
- "project_id",
828
- "slug"
829
- ],
830
- "isUnique": true
831
- },
832
- "environments_project_scoped": {
833
- "name": "environments_project_scoped",
834
- "columns": [
835
- "id",
836
- "project_id"
837
- ],
838
- "isUnique": true
839
- }
840
- },
841
- "foreignKeys": {
842
- "environments_project_id_fkey": {
843
- "name": "environments_project_id_fkey",
844
- "tableFrom": "environments",
845
- "tableTo": "projects",
846
- "columnsFrom": [
847
- "project_id"
848
- ],
849
- "columnsTo": [
850
- "id"
851
- ],
852
- "onDelete": "restrict",
853
- "onUpdate": "no action"
854
- }
855
- },
856
- "compositePrimaryKeys": {},
857
- "uniqueConstraints": {},
858
- "checkConstraints": {
859
- "environments_slug_check": {
860
- "name": "environments_slug_check",
861
- "value": "length(\"environments\".\"slug\") BETWEEN 1 AND 63 AND \"environments\".\"slug\" GLOB '[a-z0-9]*' AND \"environments\".\"slug\" NOT GLOB '*[^a-z0-9-]*'"
862
- }
863
- }
864
- },
865
- "identities": {
866
- "name": "identities",
867
- "columns": {
868
- "id": {
869
- "name": "id",
870
- "type": "text",
871
- "primaryKey": true,
872
- "notNull": true,
873
- "autoincrement": false
874
- },
875
- "provider": {
876
- "name": "provider",
877
- "type": "text",
878
- "primaryKey": false,
879
- "notNull": true,
880
- "autoincrement": false
881
- },
882
- "auth_mac": {
883
- "name": "auth_mac",
884
- "type": "blob",
885
- "primaryKey": false,
886
- "notNull": true,
887
- "autoincrement": false
888
- },
889
- "subject": {
890
- "name": "subject",
891
- "type": "text",
892
- "primaryKey": false,
893
- "notNull": true,
894
- "autoincrement": false
895
- },
896
- "issuer_hash": {
897
- "name": "issuer_hash",
898
- "type": "text",
899
- "primaryKey": false,
900
- "notNull": true,
901
- "autoincrement": false
902
- },
903
- "generation": {
904
- "name": "generation",
905
- "type": "integer",
906
- "primaryKey": false,
907
- "notNull": true,
908
- "autoincrement": false
909
- },
910
- "principal": {
911
- "name": "principal",
912
- "type": "text",
913
- "primaryKey": false,
914
- "notNull": true,
915
- "autoincrement": false
916
- },
917
- "email": {
918
- "name": "email",
919
- "type": "text",
920
- "primaryKey": false,
921
- "notNull": false,
922
- "autoincrement": false
923
- },
924
- "created_at": {
925
- "name": "created_at",
926
- "type": "integer",
927
- "primaryKey": false,
928
- "notNull": true,
929
- "autoincrement": false,
930
- "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
931
- },
932
- "created_by": {
933
- "name": "created_by",
934
- "type": "text",
935
- "primaryKey": false,
936
- "notNull": true,
937
- "autoincrement": false
938
- },
939
- "last_sign_in_at": {
940
- "name": "last_sign_in_at",
941
- "type": "integer",
942
- "primaryKey": false,
943
- "notNull": false,
944
- "autoincrement": false
945
- },
946
- "revoked_at": {
947
- "name": "revoked_at",
948
- "type": "integer",
949
- "primaryKey": false,
950
- "notNull": false,
951
- "autoincrement": false
952
- },
953
- "revoked_by": {
954
- "name": "revoked_by",
955
- "type": "text",
956
- "primaryKey": false,
957
- "notNull": false,
958
- "autoincrement": false
959
- },
960
- "active_subject": {
961
- "name": "active_subject",
962
- "type": "text",
963
- "primaryKey": false,
964
- "notNull": false,
965
- "autoincrement": false,
966
- "generated": {
967
- "as": "(CASE WHEN revoked_at IS NULL THEN subject END)",
968
- "type": "stored"
969
- }
970
- }
971
- },
972
- "indexes": {
973
- "identities_active_subject": {
974
- "name": "identities_active_subject",
975
- "columns": [
976
- "provider",
977
- "issuer_hash",
978
- "active_subject"
979
- ],
980
- "isUnique": true
981
- },
982
- "identities_principal_idx": {
983
- "name": "identities_principal_idx",
984
- "columns": [
985
- "principal",
986
- "generation"
987
- ],
988
- "isUnique": false
989
- },
990
- "identities_member_generation_key": {
991
- "name": "identities_member_generation_key",
992
- "columns": [
993
- "id",
994
- "principal",
995
- "generation"
996
- ],
997
- "isUnique": true
998
- }
999
- },
1000
- "foreignKeys": {
1001
- "identities_principal_fkey": {
1002
- "name": "identities_principal_fkey",
1003
- "tableFrom": "identities",
1004
- "tableTo": "vault_members",
1005
- "columnsFrom": [
1006
- "principal"
1007
- ],
1008
- "columnsTo": [
1009
- "principal"
1010
- ],
1011
- "onDelete": "restrict",
1012
- "onUpdate": "no action"
1013
- }
1014
- },
1015
- "compositePrimaryKeys": {},
1016
- "uniqueConstraints": {},
1017
- "checkConstraints": {
1018
- "identities_principal_check": {
1019
- "name": "identities_principal_check",
1020
- "value": "\"identities\".\"principal\" LIKE 'user:%'"
1021
- },
1022
- "identities_provider_check": {
1023
- "name": "identities_provider_check",
1024
- "value": "length(\"identities\".\"provider\") BETWEEN 1 AND 32 AND \"identities\".\"provider\" GLOB '[a-z0-9]*' AND \"identities\".\"provider\" NOT GLOB '*[^a-z0-9-]*'"
1025
- },
1026
- "identities_auth_mac_check": {
1027
- "name": "identities_auth_mac_check",
1028
- "value": "octet_length(\"identities\".\"auth_mac\") = 32"
1029
- }
1030
- }
1031
- },
1032
- "projects": {
1033
- "name": "projects",
1034
- "columns": {
1035
- "id": {
1036
- "name": "id",
1037
- "type": "text",
1038
- "primaryKey": true,
1039
- "notNull": true,
1040
- "autoincrement": false
1041
- },
1042
- "slug": {
1043
- "name": "slug",
1044
- "type": "text",
1045
- "primaryKey": false,
1046
- "notNull": true,
1047
- "autoincrement": false
1048
- },
1049
- "name": {
1050
- "name": "name",
1051
- "type": "text",
1052
- "primaryKey": false,
1053
- "notNull": true,
1054
- "autoincrement": false
1055
- },
1056
- "created_at": {
1057
- "name": "created_at",
1058
- "type": "integer",
1059
- "primaryKey": false,
1060
- "notNull": true,
1061
- "autoincrement": false,
1062
- "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1063
- },
1064
- "archived_at": {
1065
- "name": "archived_at",
1066
- "type": "integer",
1067
- "primaryKey": false,
1068
- "notNull": false,
1069
- "autoincrement": false
1070
- }
1071
- },
1072
- "indexes": {
1073
- "projects_slug_key": {
1074
- "name": "projects_slug_key",
1075
- "columns": [
1076
- "slug"
1077
- ],
1078
- "isUnique": true
1079
- }
1080
- },
1081
- "foreignKeys": {},
1082
- "compositePrimaryKeys": {},
1083
- "uniqueConstraints": {},
1084
- "checkConstraints": {
1085
- "projects_slug_check": {
1086
- "name": "projects_slug_check",
1087
- "value": "length(\"projects\".\"slug\") BETWEEN 1 AND 63 AND \"projects\".\"slug\" GLOB '[a-z0-9]*' AND \"projects\".\"slug\" NOT GLOB '*[^a-z0-9-]*'"
1088
- }
1089
- }
1090
- },
1091
- "secret_versions": {
1092
- "name": "secret_versions",
1093
- "columns": {
1094
- "id": {
1095
- "name": "id",
1096
- "type": "text",
1097
- "primaryKey": true,
1098
- "notNull": true,
1099
- "autoincrement": false
1100
- },
1101
- "secret_id": {
1102
- "name": "secret_id",
1103
- "type": "text",
1104
- "primaryKey": false,
1105
- "notNull": true,
1106
- "autoincrement": false
1107
- },
1108
- "version": {
1109
- "name": "version",
1110
- "type": "integer",
1111
- "primaryKey": false,
1112
- "notNull": true,
1113
- "autoincrement": false
1114
- },
1115
- "envelope_version": {
1116
- "name": "envelope_version",
1117
- "type": "integer",
1118
- "primaryKey": false,
1119
- "notNull": true,
1120
- "autoincrement": false
1121
- },
1122
- "ciphertext": {
1123
- "name": "ciphertext",
1124
- "type": "blob",
1125
- "primaryKey": false,
1126
- "notNull": true,
1127
- "autoincrement": false
1128
- },
1129
- "iv": {
1130
- "name": "iv",
1131
- "type": "blob",
1132
- "primaryKey": false,
1133
- "notNull": true,
1134
- "autoincrement": false
1135
- },
1136
- "auth_tag": {
1137
- "name": "auth_tag",
1138
- "type": "blob",
1139
- "primaryKey": false,
1140
- "notNull": true,
1141
- "autoincrement": false
1142
- },
1143
- "wrapped_dek": {
1144
- "name": "wrapped_dek",
1145
- "type": "blob",
1146
- "primaryKey": false,
1147
- "notNull": true,
1148
- "autoincrement": false
1149
- },
1150
- "kek_provider": {
1151
- "name": "kek_provider",
1152
- "type": "text",
1153
- "primaryKey": false,
1154
- "notNull": true,
1155
- "autoincrement": false
1156
- },
1157
- "kek_id": {
1158
- "name": "kek_id",
1159
- "type": "text",
1160
- "primaryKey": false,
1161
- "notNull": true,
1162
- "autoincrement": false
1163
- },
1164
- "kek_version": {
1165
- "name": "kek_version",
1166
- "type": "text",
1167
- "primaryKey": false,
1168
- "notNull": true,
1169
- "autoincrement": false
1170
- },
1171
- "created_at": {
1172
- "name": "created_at",
1173
- "type": "integer",
1174
- "primaryKey": false,
1175
- "notNull": true,
1176
- "autoincrement": false,
1177
- "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1178
- },
1179
- "created_by": {
1180
- "name": "created_by",
1181
- "type": "text",
1182
- "primaryKey": false,
1183
- "notNull": true,
1184
- "autoincrement": false
1185
- }
1186
- },
1187
- "indexes": {
1188
- "secret_versions_secret_idx": {
1189
- "name": "secret_versions_secret_idx",
1190
- "columns": [
1191
- "secret_id",
1192
- "version"
1193
- ],
1194
- "isUnique": false
1195
- },
1196
- "secret_versions_secret_id_version_key": {
1197
- "name": "secret_versions_secret_id_version_key",
1198
- "columns": [
1199
- "secret_id",
1200
- "version"
1201
- ],
1202
- "isUnique": true
1203
- }
1204
- },
1205
- "foreignKeys": {
1206
- "secret_versions_secret_id_fkey": {
1207
- "name": "secret_versions_secret_id_fkey",
1208
- "tableFrom": "secret_versions",
1209
- "tableTo": "secrets",
1210
- "columnsFrom": [
1211
- "secret_id"
1212
- ],
1213
- "columnsTo": [
1214
- "id"
1215
- ],
1216
- "onDelete": "restrict",
1217
- "onUpdate": "no action"
1218
- }
1219
- },
1220
- "compositePrimaryKeys": {},
1221
- "uniqueConstraints": {},
1222
- "checkConstraints": {
1223
- "secret_versions_version_check": {
1224
- "name": "secret_versions_version_check",
1225
- "value": "\"secret_versions\".\"version\" > 0"
1226
- },
1227
- "secret_versions_iv_check": {
1228
- "name": "secret_versions_iv_check",
1229
- "value": "octet_length(\"secret_versions\".\"iv\") = 12"
1230
- },
1231
- "secret_versions_auth_tag_check": {
1232
- "name": "secret_versions_auth_tag_check",
1233
- "value": "octet_length(\"secret_versions\".\"auth_tag\") = 16"
1234
- }
1235
- }
1236
- },
1237
- "secrets": {
1238
- "name": "secrets",
1239
- "columns": {
1240
- "id": {
1241
- "name": "id",
1242
- "type": "text",
1243
- "primaryKey": true,
1244
- "notNull": true,
1245
- "autoincrement": false
1246
- },
1247
- "project_id": {
1248
- "name": "project_id",
1249
- "type": "text",
1250
- "primaryKey": false,
1251
- "notNull": true,
1252
- "autoincrement": false
1253
- },
1254
- "environment_id": {
1255
- "name": "environment_id",
1256
- "type": "text",
1257
- "primaryKey": false,
1258
- "notNull": true,
1259
- "autoincrement": false
1260
- },
1261
- "key": {
1262
- "name": "key",
1263
- "type": "text",
1264
- "primaryKey": false,
1265
- "notNull": true,
1266
- "autoincrement": false
1267
- },
1268
- "created_at": {
1269
- "name": "created_at",
1270
- "type": "integer",
1271
- "primaryKey": false,
1272
- "notNull": true,
1273
- "autoincrement": false,
1274
- "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1275
- },
1276
- "updated_at": {
1277
- "name": "updated_at",
1278
- "type": "integer",
1279
- "primaryKey": false,
1280
- "notNull": true,
1281
- "autoincrement": false,
1282
- "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1283
- },
1284
- "current_version_id": {
1285
- "name": "current_version_id",
1286
- "type": "text",
1287
- "primaryKey": false,
1288
- "notNull": false,
1289
- "autoincrement": false
1290
- },
1291
- "current_version": {
1292
- "name": "current_version",
1293
- "type": "integer",
1294
- "primaryKey": false,
1295
- "notNull": true,
1296
- "autoincrement": false,
1297
- "default": 0
1298
- },
1299
- "archived_at": {
1300
- "name": "archived_at",
1301
- "type": "integer",
1302
- "primaryKey": false,
1303
- "notNull": false,
1304
- "autoincrement": false
1305
- }
1306
- },
1307
- "indexes": {
1308
- "secrets_lookup_idx": {
1309
- "name": "secrets_lookup_idx",
1310
- "columns": [
1311
- "project_id",
1312
- "environment_id",
1313
- "key"
1314
- ],
1315
- "isUnique": false
1316
- },
1317
- "secrets_project_id_environment_id_key_key": {
1318
- "name": "secrets_project_id_environment_id_key_key",
1319
- "columns": [
1320
- "project_id",
1321
- "environment_id",
1322
- "key"
1323
- ],
1324
- "isUnique": true
1325
- }
1326
- },
1327
- "foreignKeys": {
1328
- "secrets_current_version_id_secret_versions_id_fk": {
1329
- "name": "secrets_current_version_id_secret_versions_id_fk",
1330
- "tableFrom": "secrets",
1331
- "tableTo": "secret_versions",
1332
- "columnsFrom": [
1333
- "current_version_id"
1334
- ],
1335
- "columnsTo": [
1336
- "id"
1337
- ],
1338
- "onDelete": "no action",
1339
- "onUpdate": "no action"
1340
- },
1341
- "secrets_project_id_fkey": {
1342
- "name": "secrets_project_id_fkey",
1343
- "tableFrom": "secrets",
1344
- "tableTo": "projects",
1345
- "columnsFrom": [
1346
- "project_id"
1347
- ],
1348
- "columnsTo": [
1349
- "id"
1350
- ],
1351
- "onDelete": "restrict",
1352
- "onUpdate": "no action"
1353
- },
1354
- "secrets_environment_id_fkey": {
1355
- "name": "secrets_environment_id_fkey",
1356
- "tableFrom": "secrets",
1357
- "tableTo": "environments",
1358
- "columnsFrom": [
1359
- "environment_id"
1360
- ],
1361
- "columnsTo": [
1362
- "id"
1363
- ],
1364
- "onDelete": "restrict",
1365
- "onUpdate": "no action"
1366
- },
1367
- "secrets_environment_in_project": {
1368
- "name": "secrets_environment_in_project",
1369
- "tableFrom": "secrets",
1370
- "tableTo": "environments",
1371
- "columnsFrom": [
1372
- "environment_id",
1373
- "project_id"
1374
- ],
1375
- "columnsTo": [
1376
- "id",
1377
- "project_id"
1378
- ],
1379
- "onDelete": "no action",
1380
- "onUpdate": "no action"
1381
- }
1382
- },
1383
- "compositePrimaryKeys": {},
1384
- "uniqueConstraints": {},
1385
- "checkConstraints": {
1386
- "secrets_key_check": {
1387
- "name": "secrets_key_check",
1388
- "value": "length(\"secrets\".\"key\") BETWEEN 1 AND 128 AND \"secrets\".\"key\" GLOB '[A-Za-z_]*' AND \"secrets\".\"key\" NOT GLOB '*[^A-Za-z0-9_]*'"
1389
- }
1390
- }
1391
- },
1392
- "service_bindings": {
1393
- "name": "service_bindings",
1394
- "columns": {
1395
- "id": {
1396
- "name": "id",
1397
- "type": "text",
1398
- "primaryKey": true,
1399
- "notNull": true,
1400
- "autoincrement": false
1401
- },
1402
- "auth_mac": {
1403
- "name": "auth_mac",
1404
- "type": "blob",
1405
- "primaryKey": false,
1406
- "notNull": true,
1407
- "autoincrement": false
1408
- },
1409
- "principal": {
1410
- "name": "principal",
1411
- "type": "text",
1412
- "primaryKey": false,
1413
- "notNull": true,
1414
- "autoincrement": false
1415
- },
1416
- "generation": {
1417
- "name": "generation",
1418
- "type": "integer",
1419
- "primaryKey": false,
1420
- "notNull": true,
1421
- "autoincrement": false
1422
- },
1423
- "profile": {
1424
- "name": "profile",
1425
- "type": "text",
1426
- "primaryKey": false,
1427
- "notNull": true,
1428
- "autoincrement": false
1429
- },
1430
- "issuer": {
1431
- "name": "issuer",
1432
- "type": "text",
1433
- "primaryKey": false,
1434
- "notNull": true,
1435
- "autoincrement": false
1436
- },
1437
- "jwks_uri": {
1438
- "name": "jwks_uri",
1439
- "type": "text",
1440
- "primaryKey": false,
1441
- "notNull": true,
1442
- "autoincrement": false
1443
- },
1444
- "claims": {
1445
- "name": "claims",
1446
- "type": "text",
1447
- "primaryKey": false,
1448
- "notNull": true,
1449
- "autoincrement": false
1450
- },
1451
- "label": {
1452
- "name": "label",
1453
- "type": "text",
1454
- "primaryKey": false,
1455
- "notNull": false,
1456
- "autoincrement": false
1457
- },
1458
- "created_at": {
1459
- "name": "created_at",
1460
- "type": "integer",
1461
- "primaryKey": false,
1462
- "notNull": true,
1463
- "autoincrement": false,
1464
- "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1465
- },
1466
- "created_by": {
1467
- "name": "created_by",
1468
- "type": "text",
1469
- "primaryKey": false,
1470
- "notNull": true,
1471
- "autoincrement": false
1472
- },
1473
- "last_used_at": {
1474
- "name": "last_used_at",
1475
- "type": "integer",
1476
- "primaryKey": false,
1477
- "notNull": false,
1478
- "autoincrement": false
1479
- },
1480
- "revoked_at": {
1481
- "name": "revoked_at",
1482
- "type": "integer",
1483
- "primaryKey": false,
1484
- "notNull": false,
1485
- "autoincrement": false
1486
- },
1487
- "revoked_by": {
1488
- "name": "revoked_by",
1489
- "type": "text",
1490
- "primaryKey": false,
1491
- "notNull": false,
1492
- "autoincrement": false
1493
- }
1494
- },
1495
- "indexes": {
1496
- "service_bindings_principal_idx": {
1497
- "name": "service_bindings_principal_idx",
1498
- "columns": [
1499
- "principal",
1500
- "issuer"
1501
- ],
1502
- "isUnique": false
1503
- },
1504
- "service_bindings_live_idx": {
1505
- "name": "service_bindings_live_idx",
1506
- "columns": [
1507
- "principal",
1508
- "issuer",
1509
- "generation",
1510
- "created_at",
1511
- "id"
1512
- ],
1513
- "isUnique": false,
1514
- "where": "\"service_bindings\".\"revoked_at\" IS NULL"
1515
- }
1516
- },
1517
- "foreignKeys": {
1518
- "service_bindings_principal_fkey": {
1519
- "name": "service_bindings_principal_fkey",
1520
- "tableFrom": "service_bindings",
1521
- "tableTo": "vault_members",
1522
- "columnsFrom": [
1523
- "principal"
1524
- ],
1525
- "columnsTo": [
1526
- "principal"
1527
- ],
1528
- "onDelete": "restrict",
1529
- "onUpdate": "no action"
1530
- }
1531
- },
1532
- "compositePrimaryKeys": {},
1533
- "uniqueConstraints": {},
1534
- "checkConstraints": {
1535
- "service_bindings_principal_check": {
1536
- "name": "service_bindings_principal_check",
1537
- "value": "\"service_bindings\".\"principal\" LIKE 'token:%'"
1538
- },
1539
- "service_bindings_auth_mac_check": {
1540
- "name": "service_bindings_auth_mac_check",
1541
- "value": "octet_length(\"service_bindings\".\"auth_mac\") = 32"
1542
- },
1543
- "service_bindings_claims_check": {
1544
- "name": "service_bindings_claims_check",
1545
- "value": "json_valid(\"service_bindings\".\"claims\")"
1546
- }
1547
- }
1548
- },
1549
- "vault_grants": {
1550
- "name": "vault_grants",
1551
- "columns": {
1552
- "principal": {
1553
- "name": "principal",
1554
- "type": "text",
1555
- "primaryKey": false,
1556
- "notNull": true,
1557
- "autoincrement": false
1558
- },
1559
- "project_id": {
1560
- "name": "project_id",
1561
- "type": "text",
1562
- "primaryKey": false,
1563
- "notNull": false,
1564
- "autoincrement": false
1565
- },
1566
- "environment_id": {
1567
- "name": "environment_id",
1568
- "type": "text",
1569
- "primaryKey": false,
1570
- "notNull": false,
1571
- "autoincrement": false
1572
- },
1573
- "role": {
1574
- "name": "role",
1575
- "type": "text",
1576
- "primaryKey": false,
1577
- "notNull": true,
1578
- "autoincrement": false
1579
- },
1580
- "expires_at": {
1581
- "name": "expires_at",
1582
- "type": "integer",
1583
- "primaryKey": false,
1584
- "notNull": false,
1585
- "autoincrement": false
1586
- },
1587
- "granted_at": {
1588
- "name": "granted_at",
1589
- "type": "integer",
1590
- "primaryKey": false,
1591
- "notNull": true,
1592
- "autoincrement": false
1593
- },
1594
- "granted_by": {
1595
- "name": "granted_by",
1596
- "type": "text",
1597
- "primaryKey": false,
1598
- "notNull": true,
1599
- "autoincrement": false
1600
- }
1601
- },
1602
- "indexes": {
1603
- "vault_grants_on_project": {
1604
- "name": "vault_grants_on_project",
1605
- "columns": [
1606
- "principal",
1607
- "project_id"
1608
- ],
1609
- "isUnique": true
1610
- },
1611
- "vault_grants_on_environment": {
1612
- "name": "vault_grants_on_environment",
1613
- "columns": [
1614
- "principal",
1615
- "environment_id"
1616
- ],
1617
- "isUnique": true
1618
- }
1619
- },
1620
- "foreignKeys": {
1621
- "vault_grants_principal_fkey": {
1622
- "name": "vault_grants_principal_fkey",
1623
- "tableFrom": "vault_grants",
1624
- "tableTo": "vault_members",
1625
- "columnsFrom": [
1626
- "principal"
1627
- ],
1628
- "columnsTo": [
1629
- "principal"
1630
- ],
1631
- "onDelete": "restrict",
1632
- "onUpdate": "no action"
1633
- },
1634
- "vault_grants_project_id_fkey": {
1635
- "name": "vault_grants_project_id_fkey",
1636
- "tableFrom": "vault_grants",
1637
- "tableTo": "projects",
1638
- "columnsFrom": [
1639
- "project_id"
1640
- ],
1641
- "columnsTo": [
1642
- "id"
1643
- ],
1644
- "onDelete": "restrict",
1645
- "onUpdate": "no action"
1646
- },
1647
- "vault_grants_environment_id_fkey": {
1648
- "name": "vault_grants_environment_id_fkey",
1649
- "tableFrom": "vault_grants",
1650
- "tableTo": "environments",
1651
- "columnsFrom": [
1652
- "environment_id"
1653
- ],
1654
- "columnsTo": [
1655
- "id"
1656
- ],
1657
- "onDelete": "restrict",
1658
- "onUpdate": "no action"
1659
- }
1660
- },
1661
- "compositePrimaryKeys": {},
1662
- "uniqueConstraints": {},
1663
- "checkConstraints": {
1664
- "vault_grants_one_place": {
1665
- "name": "vault_grants_one_place",
1666
- "value": "(\"vault_grants\".\"project_id\" IS NULL) <> (\"vault_grants\".\"environment_id\" IS NULL)"
1667
- },
1668
- "vault_grants_role_check": {
1669
- "name": "vault_grants_role_check",
1670
- "value": "\"vault_grants\".\"role\" IN ('viewer', 'developer', 'maintainer', 'access-manager', 'auditor', 'owner')"
1671
- },
1672
- "vault_grants_environment_role_check": {
1673
- "name": "vault_grants_environment_role_check",
1674
- "value": "\"vault_grants\".\"environment_id\" IS NULL OR \"vault_grants\".\"role\" IN ('viewer', 'developer', 'auditor')"
1675
- }
1676
- }
1677
- },
1678
- "vault_members": {
1679
- "name": "vault_members",
1680
- "columns": {
1681
- "principal": {
1682
- "name": "principal",
1683
- "type": "text",
1684
- "primaryKey": true,
1685
- "notNull": true,
1686
- "autoincrement": false
1687
- },
1688
- "status": {
1689
- "name": "status",
1690
- "type": "text",
1691
- "primaryKey": false,
1692
- "notNull": true,
1693
- "autoincrement": false
1694
- },
1695
- "owner": {
1696
- "name": "owner",
1697
- "type": "integer",
1698
- "primaryKey": false,
1699
- "notNull": true,
1700
- "autoincrement": false,
1701
- "default": false
1702
- },
1703
- "generation": {
1704
- "name": "generation",
1705
- "type": "integer",
1706
- "primaryKey": false,
1707
- "notNull": true,
1708
- "autoincrement": false,
1709
- "default": 0
1710
- },
1711
- "created_at": {
1712
- "name": "created_at",
1713
- "type": "integer",
1714
- "primaryKey": false,
1715
- "notNull": true,
1716
- "autoincrement": false
1717
- },
1718
- "created_by": {
1719
- "name": "created_by",
1720
- "type": "text",
1721
- "primaryKey": false,
1722
- "notNull": true,
1723
- "autoincrement": false
1724
- },
1725
- "status_changed_at": {
1726
- "name": "status_changed_at",
1727
- "type": "integer",
1728
- "primaryKey": false,
1729
- "notNull": true,
1730
- "autoincrement": false
1731
- },
1732
- "status_changed_by": {
1733
- "name": "status_changed_by",
1734
- "type": "text",
1735
- "primaryKey": false,
1736
- "notNull": true,
1737
- "autoincrement": false
1738
- },
1739
- "access_seq": {
1740
- "name": "access_seq",
1741
- "type": "integer",
1742
- "primaryKey": false,
1743
- "notNull": true,
1744
- "autoincrement": false
1745
- },
1746
- "mac": {
1747
- "name": "mac",
1748
- "type": "blob",
1749
- "primaryKey": false,
1750
- "notNull": true,
1751
- "autoincrement": false
1752
- }
1753
- },
1754
- "indexes": {},
1755
- "foreignKeys": {},
1756
- "compositePrimaryKeys": {},
1757
- "uniqueConstraints": {},
1758
- "checkConstraints": {
1759
- "vault_members_mac_check": {
1760
- "name": "vault_members_mac_check",
1761
- "value": "octet_length(\"vault_members\".\"mac\") = 32"
1762
- },
1763
- "vault_members_principal_check": {
1764
- "name": "vault_members_principal_check",
1765
- "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"
1766
- },
1767
- "vault_members_user_lowercase": {
1768
- "name": "vault_members_user_lowercase",
1769
- "value": "\"vault_members\".\"principal\" NOT LIKE 'user:%' OR \"vault_members\".\"principal\" = lower(\"vault_members\".\"principal\")"
1770
- },
1771
- "vault_members_status_check": {
1772
- "name": "vault_members_status_check",
1773
- "value": "\"vault_members\".\"status\" IN ('active', 'removed')"
1774
- },
1775
- "vault_members_owner_check": {
1776
- "name": "vault_members_owner_check",
1777
- "value": "NOT \"vault_members\".\"owner\" OR (\"vault_members\".\"status\" = 'active' AND \"vault_members\".\"principal\" LIKE 'user:%')"
1778
- },
1779
- "vault_members_generation_check": {
1780
- "name": "vault_members_generation_check",
1781
- "value": "\"vault_members\".\"generation\" >= 0"
1782
- }
1783
- }
1784
- }
1785
- },
1786
- "views": {},
1787
- "enums": {},
1788
- "_meta": {
1789
- "schemas": {},
1790
- "tables": {},
1791
- "columns": {}
1792
- },
1793
- "internal": {
1794
- "indexes": {
1795
- "audit_log_unbind_idx": {
1796
- "columns": {
1797
- "json_extract(\"metadata\", '$.bindingId')": {
1798
- "isExpression": true
1799
- }
1800
- }
1801
- },
1802
- "audit_log_exchange_idx": {
1803
- "columns": {
1804
- "json_extract(\"metadata\", '$.credentialId')": {
1805
- "isExpression": true
1806
- }
1807
- }
1808
- }
1809
- }
1810
- }
1811
- }