@coffre/db 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,1781 +0,0 @@
1
- {
2
- "version": "6",
3
- "dialect": "sqlite",
4
- "id": "cb1471ad-69ff-4ca5-bd54-361c9b9f0168",
5
- "prevId": "e312ab5e-5dc8-4863-ab2f-a8ebd0b4e5ca",
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_token_hash_key": {
549
- "name": "credentials_token_hash_key",
550
- "columns": [
551
- "token_hash"
552
- ],
553
- "isUnique": true
554
- }
555
- },
556
- "foreignKeys": {
557
- "credentials_principal_fkey": {
558
- "name": "credentials_principal_fkey",
559
- "tableFrom": "credentials",
560
- "tableTo": "vault_members",
561
- "columnsFrom": [
562
- "principal"
563
- ],
564
- "columnsTo": [
565
- "principal"
566
- ],
567
- "onDelete": "restrict",
568
- "onUpdate": "no action"
569
- },
570
- "credentials_identity_id_fkey": {
571
- "name": "credentials_identity_id_fkey",
572
- "tableFrom": "credentials",
573
- "tableTo": "identities",
574
- "columnsFrom": [
575
- "identity_id",
576
- "principal",
577
- "generation"
578
- ],
579
- "columnsTo": [
580
- "id",
581
- "principal",
582
- "generation"
583
- ],
584
- "onDelete": "restrict",
585
- "onUpdate": "no action"
586
- }
587
- },
588
- "compositePrimaryKeys": {},
589
- "uniqueConstraints": {},
590
- "checkConstraints": {
591
- "credentials_kind_check": {
592
- "name": "credentials_kind_check",
593
- "value": "\"credentials\".\"kind\" IN ('browser', 'cli', 'service')"
594
- },
595
- "credentials_principal_check": {
596
- "name": "credentials_principal_check",
597
- "value": "\"credentials\".\"principal\" LIKE 'user:%' OR \"credentials\".\"principal\" LIKE 'token:%'"
598
- },
599
- "credentials_kind_matches_principal": {
600
- "name": "credentials_kind_matches_principal",
601
- "value": "(\"credentials\".\"kind\" = 'service') = (\"credentials\".\"principal\" LIKE 'token:%')"
602
- },
603
- "credentials_token_hash_check": {
604
- "name": "credentials_token_hash_check",
605
- "value": "octet_length(\"credentials\".\"token_hash\") = 32"
606
- },
607
- "credentials_auth_mac_check": {
608
- "name": "credentials_auth_mac_check",
609
- "value": "octet_length(\"credentials\".\"auth_mac\") = 32"
610
- }
611
- }
612
- },
613
- "device_authorizations": {
614
- "name": "device_authorizations",
615
- "columns": {
616
- "id": {
617
- "name": "id",
618
- "type": "text",
619
- "primaryKey": true,
620
- "notNull": true,
621
- "autoincrement": false
622
- },
623
- "device_code_hash": {
624
- "name": "device_code_hash",
625
- "type": "blob",
626
- "primaryKey": false,
627
- "notNull": true,
628
- "autoincrement": false
629
- },
630
- "auth_mac": {
631
- "name": "auth_mac",
632
- "type": "blob",
633
- "primaryKey": false,
634
- "notNull": true,
635
- "autoincrement": false
636
- },
637
- "user_code": {
638
- "name": "user_code",
639
- "type": "text",
640
- "primaryKey": false,
641
- "notNull": true,
642
- "autoincrement": false
643
- },
644
- "client_label": {
645
- "name": "client_label",
646
- "type": "text",
647
- "primaryKey": false,
648
- "notNull": false,
649
- "autoincrement": false
650
- },
651
- "client_ip": {
652
- "name": "client_ip",
653
- "type": "text",
654
- "primaryKey": false,
655
- "notNull": false,
656
- "autoincrement": false
657
- },
658
- "created_at": {
659
- "name": "created_at",
660
- "type": "integer",
661
- "primaryKey": false,
662
- "notNull": true,
663
- "autoincrement": false,
664
- "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
665
- },
666
- "expires_at": {
667
- "name": "expires_at",
668
- "type": "integer",
669
- "primaryKey": false,
670
- "notNull": true,
671
- "autoincrement": false
672
- },
673
- "decided_at": {
674
- "name": "decided_at",
675
- "type": "integer",
676
- "primaryKey": false,
677
- "notNull": false,
678
- "autoincrement": false
679
- },
680
- "decision": {
681
- "name": "decision",
682
- "type": "text",
683
- "primaryKey": false,
684
- "notNull": false,
685
- "autoincrement": false
686
- },
687
- "generation": {
688
- "name": "generation",
689
- "type": "integer",
690
- "primaryKey": false,
691
- "notNull": true,
692
- "autoincrement": false,
693
- "default": 0
694
- },
695
- "principal": {
696
- "name": "principal",
697
- "type": "text",
698
- "primaryKey": false,
699
- "notNull": false,
700
- "autoincrement": false
701
- },
702
- "consumed_at": {
703
- "name": "consumed_at",
704
- "type": "integer",
705
- "primaryKey": false,
706
- "notNull": false,
707
- "autoincrement": false
708
- }
709
- },
710
- "indexes": {
711
- "device_authorizations_device_code_hash_key": {
712
- "name": "device_authorizations_device_code_hash_key",
713
- "columns": [
714
- "device_code_hash"
715
- ],
716
- "isUnique": true
717
- },
718
- "device_authorizations_user_code_key": {
719
- "name": "device_authorizations_user_code_key",
720
- "columns": [
721
- "user_code"
722
- ],
723
- "isUnique": true
724
- }
725
- },
726
- "foreignKeys": {
727
- "device_authorizations_principal_fkey": {
728
- "name": "device_authorizations_principal_fkey",
729
- "tableFrom": "device_authorizations",
730
- "tableTo": "vault_members",
731
- "columnsFrom": [
732
- "principal"
733
- ],
734
- "columnsTo": [
735
- "principal"
736
- ],
737
- "onDelete": "restrict",
738
- "onUpdate": "no action"
739
- }
740
- },
741
- "compositePrimaryKeys": {},
742
- "uniqueConstraints": {},
743
- "checkConstraints": {
744
- "device_authorizations_auth_mac_check": {
745
- "name": "device_authorizations_auth_mac_check",
746
- "value": "octet_length(\"device_authorizations\".\"auth_mac\") = 32"
747
- },
748
- "device_authorizations_decision_check": {
749
- "name": "device_authorizations_decision_check",
750
- "value": "\"device_authorizations\".\"decision\" IS NULL OR \"device_authorizations\".\"decision\" IN ('approved', 'denied')"
751
- },
752
- "device_authorizations_approval_names_principal": {
753
- "name": "device_authorizations_approval_names_principal",
754
- "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 ))"
755
- }
756
- }
757
- },
758
- "environments": {
759
- "name": "environments",
760
- "columns": {
761
- "id": {
762
- "name": "id",
763
- "type": "text",
764
- "primaryKey": true,
765
- "notNull": true,
766
- "autoincrement": false
767
- },
768
- "project_id": {
769
- "name": "project_id",
770
- "type": "text",
771
- "primaryKey": false,
772
- "notNull": true,
773
- "autoincrement": false
774
- },
775
- "slug": {
776
- "name": "slug",
777
- "type": "text",
778
- "primaryKey": false,
779
- "notNull": true,
780
- "autoincrement": false
781
- },
782
- "name": {
783
- "name": "name",
784
- "type": "text",
785
- "primaryKey": false,
786
- "notNull": true,
787
- "autoincrement": false
788
- },
789
- "created_at": {
790
- "name": "created_at",
791
- "type": "integer",
792
- "primaryKey": false,
793
- "notNull": true,
794
- "autoincrement": false,
795
- "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
796
- },
797
- "archived_at": {
798
- "name": "archived_at",
799
- "type": "integer",
800
- "primaryKey": false,
801
- "notNull": false,
802
- "autoincrement": false
803
- }
804
- },
805
- "indexes": {
806
- "environments_project_id_slug_key": {
807
- "name": "environments_project_id_slug_key",
808
- "columns": [
809
- "project_id",
810
- "slug"
811
- ],
812
- "isUnique": true
813
- },
814
- "environments_project_scoped": {
815
- "name": "environments_project_scoped",
816
- "columns": [
817
- "id",
818
- "project_id"
819
- ],
820
- "isUnique": true
821
- }
822
- },
823
- "foreignKeys": {
824
- "environments_project_id_fkey": {
825
- "name": "environments_project_id_fkey",
826
- "tableFrom": "environments",
827
- "tableTo": "projects",
828
- "columnsFrom": [
829
- "project_id"
830
- ],
831
- "columnsTo": [
832
- "id"
833
- ],
834
- "onDelete": "restrict",
835
- "onUpdate": "no action"
836
- }
837
- },
838
- "compositePrimaryKeys": {},
839
- "uniqueConstraints": {},
840
- "checkConstraints": {
841
- "environments_slug_check": {
842
- "name": "environments_slug_check",
843
- "value": "length(\"environments\".\"slug\") BETWEEN 1 AND 63 AND \"environments\".\"slug\" GLOB '[a-z0-9]*' AND \"environments\".\"slug\" NOT GLOB '*[^a-z0-9-]*'"
844
- }
845
- }
846
- },
847
- "identities": {
848
- "name": "identities",
849
- "columns": {
850
- "id": {
851
- "name": "id",
852
- "type": "text",
853
- "primaryKey": true,
854
- "notNull": true,
855
- "autoincrement": false
856
- },
857
- "provider": {
858
- "name": "provider",
859
- "type": "text",
860
- "primaryKey": false,
861
- "notNull": true,
862
- "autoincrement": false
863
- },
864
- "auth_mac": {
865
- "name": "auth_mac",
866
- "type": "blob",
867
- "primaryKey": false,
868
- "notNull": true,
869
- "autoincrement": false
870
- },
871
- "subject": {
872
- "name": "subject",
873
- "type": "text",
874
- "primaryKey": false,
875
- "notNull": true,
876
- "autoincrement": false
877
- },
878
- "issuer_hash": {
879
- "name": "issuer_hash",
880
- "type": "text",
881
- "primaryKey": false,
882
- "notNull": true,
883
- "autoincrement": false
884
- },
885
- "generation": {
886
- "name": "generation",
887
- "type": "integer",
888
- "primaryKey": false,
889
- "notNull": true,
890
- "autoincrement": false
891
- },
892
- "principal": {
893
- "name": "principal",
894
- "type": "text",
895
- "primaryKey": false,
896
- "notNull": true,
897
- "autoincrement": false
898
- },
899
- "email": {
900
- "name": "email",
901
- "type": "text",
902
- "primaryKey": false,
903
- "notNull": false,
904
- "autoincrement": false
905
- },
906
- "created_at": {
907
- "name": "created_at",
908
- "type": "integer",
909
- "primaryKey": false,
910
- "notNull": true,
911
- "autoincrement": false,
912
- "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
913
- },
914
- "created_by": {
915
- "name": "created_by",
916
- "type": "text",
917
- "primaryKey": false,
918
- "notNull": true,
919
- "autoincrement": false
920
- },
921
- "last_sign_in_at": {
922
- "name": "last_sign_in_at",
923
- "type": "integer",
924
- "primaryKey": false,
925
- "notNull": false,
926
- "autoincrement": false
927
- },
928
- "revoked_at": {
929
- "name": "revoked_at",
930
- "type": "integer",
931
- "primaryKey": false,
932
- "notNull": false,
933
- "autoincrement": false
934
- },
935
- "revoked_by": {
936
- "name": "revoked_by",
937
- "type": "text",
938
- "primaryKey": false,
939
- "notNull": false,
940
- "autoincrement": false
941
- },
942
- "active_subject": {
943
- "name": "active_subject",
944
- "type": "text",
945
- "primaryKey": false,
946
- "notNull": false,
947
- "autoincrement": false,
948
- "generated": {
949
- "as": "(CASE WHEN revoked_at IS NULL THEN subject END)",
950
- "type": "stored"
951
- }
952
- }
953
- },
954
- "indexes": {
955
- "identities_active_subject": {
956
- "name": "identities_active_subject",
957
- "columns": [
958
- "provider",
959
- "issuer_hash",
960
- "active_subject"
961
- ],
962
- "isUnique": true
963
- },
964
- "identities_principal_idx": {
965
- "name": "identities_principal_idx",
966
- "columns": [
967
- "principal",
968
- "generation"
969
- ],
970
- "isUnique": false
971
- },
972
- "identities_member_generation_key": {
973
- "name": "identities_member_generation_key",
974
- "columns": [
975
- "id",
976
- "principal",
977
- "generation"
978
- ],
979
- "isUnique": true
980
- }
981
- },
982
- "foreignKeys": {
983
- "identities_principal_fkey": {
984
- "name": "identities_principal_fkey",
985
- "tableFrom": "identities",
986
- "tableTo": "vault_members",
987
- "columnsFrom": [
988
- "principal"
989
- ],
990
- "columnsTo": [
991
- "principal"
992
- ],
993
- "onDelete": "restrict",
994
- "onUpdate": "no action"
995
- }
996
- },
997
- "compositePrimaryKeys": {},
998
- "uniqueConstraints": {},
999
- "checkConstraints": {
1000
- "identities_principal_check": {
1001
- "name": "identities_principal_check",
1002
- "value": "\"identities\".\"principal\" LIKE 'user:%'"
1003
- },
1004
- "identities_provider_check": {
1005
- "name": "identities_provider_check",
1006
- "value": "length(\"identities\".\"provider\") BETWEEN 1 AND 32 AND \"identities\".\"provider\" GLOB '[a-z0-9]*' AND \"identities\".\"provider\" NOT GLOB '*[^a-z0-9-]*'"
1007
- },
1008
- "identities_auth_mac_check": {
1009
- "name": "identities_auth_mac_check",
1010
- "value": "octet_length(\"identities\".\"auth_mac\") = 32"
1011
- }
1012
- }
1013
- },
1014
- "projects": {
1015
- "name": "projects",
1016
- "columns": {
1017
- "id": {
1018
- "name": "id",
1019
- "type": "text",
1020
- "primaryKey": true,
1021
- "notNull": true,
1022
- "autoincrement": false
1023
- },
1024
- "slug": {
1025
- "name": "slug",
1026
- "type": "text",
1027
- "primaryKey": false,
1028
- "notNull": true,
1029
- "autoincrement": false
1030
- },
1031
- "name": {
1032
- "name": "name",
1033
- "type": "text",
1034
- "primaryKey": false,
1035
- "notNull": true,
1036
- "autoincrement": false
1037
- },
1038
- "created_at": {
1039
- "name": "created_at",
1040
- "type": "integer",
1041
- "primaryKey": false,
1042
- "notNull": true,
1043
- "autoincrement": false,
1044
- "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1045
- },
1046
- "archived_at": {
1047
- "name": "archived_at",
1048
- "type": "integer",
1049
- "primaryKey": false,
1050
- "notNull": false,
1051
- "autoincrement": false
1052
- }
1053
- },
1054
- "indexes": {
1055
- "projects_slug_key": {
1056
- "name": "projects_slug_key",
1057
- "columns": [
1058
- "slug"
1059
- ],
1060
- "isUnique": true
1061
- }
1062
- },
1063
- "foreignKeys": {},
1064
- "compositePrimaryKeys": {},
1065
- "uniqueConstraints": {},
1066
- "checkConstraints": {
1067
- "projects_slug_check": {
1068
- "name": "projects_slug_check",
1069
- "value": "length(\"projects\".\"slug\") BETWEEN 1 AND 63 AND \"projects\".\"slug\" GLOB '[a-z0-9]*' AND \"projects\".\"slug\" NOT GLOB '*[^a-z0-9-]*'"
1070
- }
1071
- }
1072
- },
1073
- "secret_versions": {
1074
- "name": "secret_versions",
1075
- "columns": {
1076
- "id": {
1077
- "name": "id",
1078
- "type": "text",
1079
- "primaryKey": true,
1080
- "notNull": true,
1081
- "autoincrement": false
1082
- },
1083
- "secret_id": {
1084
- "name": "secret_id",
1085
- "type": "text",
1086
- "primaryKey": false,
1087
- "notNull": true,
1088
- "autoincrement": false
1089
- },
1090
- "version": {
1091
- "name": "version",
1092
- "type": "integer",
1093
- "primaryKey": false,
1094
- "notNull": true,
1095
- "autoincrement": false
1096
- },
1097
- "envelope_version": {
1098
- "name": "envelope_version",
1099
- "type": "integer",
1100
- "primaryKey": false,
1101
- "notNull": true,
1102
- "autoincrement": false
1103
- },
1104
- "ciphertext": {
1105
- "name": "ciphertext",
1106
- "type": "blob",
1107
- "primaryKey": false,
1108
- "notNull": true,
1109
- "autoincrement": false
1110
- },
1111
- "iv": {
1112
- "name": "iv",
1113
- "type": "blob",
1114
- "primaryKey": false,
1115
- "notNull": true,
1116
- "autoincrement": false
1117
- },
1118
- "auth_tag": {
1119
- "name": "auth_tag",
1120
- "type": "blob",
1121
- "primaryKey": false,
1122
- "notNull": true,
1123
- "autoincrement": false
1124
- },
1125
- "wrapped_dek": {
1126
- "name": "wrapped_dek",
1127
- "type": "blob",
1128
- "primaryKey": false,
1129
- "notNull": true,
1130
- "autoincrement": false
1131
- },
1132
- "kek_provider": {
1133
- "name": "kek_provider",
1134
- "type": "text",
1135
- "primaryKey": false,
1136
- "notNull": true,
1137
- "autoincrement": false
1138
- },
1139
- "kek_id": {
1140
- "name": "kek_id",
1141
- "type": "text",
1142
- "primaryKey": false,
1143
- "notNull": true,
1144
- "autoincrement": false
1145
- },
1146
- "kek_version": {
1147
- "name": "kek_version",
1148
- "type": "text",
1149
- "primaryKey": false,
1150
- "notNull": true,
1151
- "autoincrement": false
1152
- },
1153
- "created_at": {
1154
- "name": "created_at",
1155
- "type": "integer",
1156
- "primaryKey": false,
1157
- "notNull": true,
1158
- "autoincrement": false,
1159
- "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1160
- },
1161
- "created_by": {
1162
- "name": "created_by",
1163
- "type": "text",
1164
- "primaryKey": false,
1165
- "notNull": true,
1166
- "autoincrement": false
1167
- }
1168
- },
1169
- "indexes": {
1170
- "secret_versions_secret_idx": {
1171
- "name": "secret_versions_secret_idx",
1172
- "columns": [
1173
- "secret_id",
1174
- "version"
1175
- ],
1176
- "isUnique": false
1177
- },
1178
- "secret_versions_secret_id_version_key": {
1179
- "name": "secret_versions_secret_id_version_key",
1180
- "columns": [
1181
- "secret_id",
1182
- "version"
1183
- ],
1184
- "isUnique": true
1185
- }
1186
- },
1187
- "foreignKeys": {
1188
- "secret_versions_secret_id_fkey": {
1189
- "name": "secret_versions_secret_id_fkey",
1190
- "tableFrom": "secret_versions",
1191
- "tableTo": "secrets",
1192
- "columnsFrom": [
1193
- "secret_id"
1194
- ],
1195
- "columnsTo": [
1196
- "id"
1197
- ],
1198
- "onDelete": "restrict",
1199
- "onUpdate": "no action"
1200
- }
1201
- },
1202
- "compositePrimaryKeys": {},
1203
- "uniqueConstraints": {},
1204
- "checkConstraints": {
1205
- "secret_versions_version_check": {
1206
- "name": "secret_versions_version_check",
1207
- "value": "\"secret_versions\".\"version\" > 0"
1208
- },
1209
- "secret_versions_iv_check": {
1210
- "name": "secret_versions_iv_check",
1211
- "value": "octet_length(\"secret_versions\".\"iv\") = 12"
1212
- },
1213
- "secret_versions_auth_tag_check": {
1214
- "name": "secret_versions_auth_tag_check",
1215
- "value": "octet_length(\"secret_versions\".\"auth_tag\") = 16"
1216
- }
1217
- }
1218
- },
1219
- "secrets": {
1220
- "name": "secrets",
1221
- "columns": {
1222
- "id": {
1223
- "name": "id",
1224
- "type": "text",
1225
- "primaryKey": true,
1226
- "notNull": true,
1227
- "autoincrement": false
1228
- },
1229
- "project_id": {
1230
- "name": "project_id",
1231
- "type": "text",
1232
- "primaryKey": false,
1233
- "notNull": true,
1234
- "autoincrement": false
1235
- },
1236
- "environment_id": {
1237
- "name": "environment_id",
1238
- "type": "text",
1239
- "primaryKey": false,
1240
- "notNull": true,
1241
- "autoincrement": false
1242
- },
1243
- "key": {
1244
- "name": "key",
1245
- "type": "text",
1246
- "primaryKey": false,
1247
- "notNull": true,
1248
- "autoincrement": false
1249
- },
1250
- "created_at": {
1251
- "name": "created_at",
1252
- "type": "integer",
1253
- "primaryKey": false,
1254
- "notNull": true,
1255
- "autoincrement": false,
1256
- "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1257
- },
1258
- "updated_at": {
1259
- "name": "updated_at",
1260
- "type": "integer",
1261
- "primaryKey": false,
1262
- "notNull": true,
1263
- "autoincrement": false,
1264
- "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1265
- },
1266
- "current_version_id": {
1267
- "name": "current_version_id",
1268
- "type": "text",
1269
- "primaryKey": false,
1270
- "notNull": false,
1271
- "autoincrement": false
1272
- },
1273
- "current_version": {
1274
- "name": "current_version",
1275
- "type": "integer",
1276
- "primaryKey": false,
1277
- "notNull": true,
1278
- "autoincrement": false,
1279
- "default": 0
1280
- },
1281
- "archived_at": {
1282
- "name": "archived_at",
1283
- "type": "integer",
1284
- "primaryKey": false,
1285
- "notNull": false,
1286
- "autoincrement": false
1287
- }
1288
- },
1289
- "indexes": {
1290
- "secrets_lookup_idx": {
1291
- "name": "secrets_lookup_idx",
1292
- "columns": [
1293
- "project_id",
1294
- "environment_id",
1295
- "key"
1296
- ],
1297
- "isUnique": false
1298
- },
1299
- "secrets_project_id_environment_id_key_key": {
1300
- "name": "secrets_project_id_environment_id_key_key",
1301
- "columns": [
1302
- "project_id",
1303
- "environment_id",
1304
- "key"
1305
- ],
1306
- "isUnique": true
1307
- }
1308
- },
1309
- "foreignKeys": {
1310
- "secrets_current_version_id_secret_versions_id_fk": {
1311
- "name": "secrets_current_version_id_secret_versions_id_fk",
1312
- "tableFrom": "secrets",
1313
- "tableTo": "secret_versions",
1314
- "columnsFrom": [
1315
- "current_version_id"
1316
- ],
1317
- "columnsTo": [
1318
- "id"
1319
- ],
1320
- "onDelete": "no action",
1321
- "onUpdate": "no action"
1322
- },
1323
- "secrets_project_id_fkey": {
1324
- "name": "secrets_project_id_fkey",
1325
- "tableFrom": "secrets",
1326
- "tableTo": "projects",
1327
- "columnsFrom": [
1328
- "project_id"
1329
- ],
1330
- "columnsTo": [
1331
- "id"
1332
- ],
1333
- "onDelete": "restrict",
1334
- "onUpdate": "no action"
1335
- },
1336
- "secrets_environment_id_fkey": {
1337
- "name": "secrets_environment_id_fkey",
1338
- "tableFrom": "secrets",
1339
- "tableTo": "environments",
1340
- "columnsFrom": [
1341
- "environment_id"
1342
- ],
1343
- "columnsTo": [
1344
- "id"
1345
- ],
1346
- "onDelete": "restrict",
1347
- "onUpdate": "no action"
1348
- },
1349
- "secrets_environment_in_project": {
1350
- "name": "secrets_environment_in_project",
1351
- "tableFrom": "secrets",
1352
- "tableTo": "environments",
1353
- "columnsFrom": [
1354
- "environment_id",
1355
- "project_id"
1356
- ],
1357
- "columnsTo": [
1358
- "id",
1359
- "project_id"
1360
- ],
1361
- "onDelete": "no action",
1362
- "onUpdate": "no action"
1363
- }
1364
- },
1365
- "compositePrimaryKeys": {},
1366
- "uniqueConstraints": {},
1367
- "checkConstraints": {
1368
- "secrets_key_check": {
1369
- "name": "secrets_key_check",
1370
- "value": "length(\"secrets\".\"key\") BETWEEN 1 AND 128 AND \"secrets\".\"key\" GLOB '[A-Za-z_]*' AND \"secrets\".\"key\" NOT GLOB '*[^A-Za-z0-9_]*'"
1371
- }
1372
- }
1373
- },
1374
- "service_bindings": {
1375
- "name": "service_bindings",
1376
- "columns": {
1377
- "id": {
1378
- "name": "id",
1379
- "type": "text",
1380
- "primaryKey": true,
1381
- "notNull": true,
1382
- "autoincrement": false
1383
- },
1384
- "auth_mac": {
1385
- "name": "auth_mac",
1386
- "type": "blob",
1387
- "primaryKey": false,
1388
- "notNull": true,
1389
- "autoincrement": false
1390
- },
1391
- "principal": {
1392
- "name": "principal",
1393
- "type": "text",
1394
- "primaryKey": false,
1395
- "notNull": true,
1396
- "autoincrement": false
1397
- },
1398
- "generation": {
1399
- "name": "generation",
1400
- "type": "integer",
1401
- "primaryKey": false,
1402
- "notNull": true,
1403
- "autoincrement": false
1404
- },
1405
- "profile": {
1406
- "name": "profile",
1407
- "type": "text",
1408
- "primaryKey": false,
1409
- "notNull": true,
1410
- "autoincrement": false
1411
- },
1412
- "issuer": {
1413
- "name": "issuer",
1414
- "type": "text",
1415
- "primaryKey": false,
1416
- "notNull": true,
1417
- "autoincrement": false
1418
- },
1419
- "jwks_uri": {
1420
- "name": "jwks_uri",
1421
- "type": "text",
1422
- "primaryKey": false,
1423
- "notNull": true,
1424
- "autoincrement": false
1425
- },
1426
- "claims": {
1427
- "name": "claims",
1428
- "type": "text",
1429
- "primaryKey": false,
1430
- "notNull": true,
1431
- "autoincrement": false
1432
- },
1433
- "label": {
1434
- "name": "label",
1435
- "type": "text",
1436
- "primaryKey": false,
1437
- "notNull": false,
1438
- "autoincrement": false
1439
- },
1440
- "created_at": {
1441
- "name": "created_at",
1442
- "type": "integer",
1443
- "primaryKey": false,
1444
- "notNull": true,
1445
- "autoincrement": false,
1446
- "default": "(CAST(unixepoch('subsec') * 1000 AS INTEGER))"
1447
- },
1448
- "created_by": {
1449
- "name": "created_by",
1450
- "type": "text",
1451
- "primaryKey": false,
1452
- "notNull": true,
1453
- "autoincrement": false
1454
- },
1455
- "last_used_at": {
1456
- "name": "last_used_at",
1457
- "type": "integer",
1458
- "primaryKey": false,
1459
- "notNull": false,
1460
- "autoincrement": false
1461
- },
1462
- "revoked_at": {
1463
- "name": "revoked_at",
1464
- "type": "integer",
1465
- "primaryKey": false,
1466
- "notNull": false,
1467
- "autoincrement": false
1468
- },
1469
- "revoked_by": {
1470
- "name": "revoked_by",
1471
- "type": "text",
1472
- "primaryKey": false,
1473
- "notNull": false,
1474
- "autoincrement": false
1475
- }
1476
- },
1477
- "indexes": {
1478
- "service_bindings_principal_idx": {
1479
- "name": "service_bindings_principal_idx",
1480
- "columns": [
1481
- "principal",
1482
- "issuer"
1483
- ],
1484
- "isUnique": false
1485
- }
1486
- },
1487
- "foreignKeys": {
1488
- "service_bindings_principal_fkey": {
1489
- "name": "service_bindings_principal_fkey",
1490
- "tableFrom": "service_bindings",
1491
- "tableTo": "vault_members",
1492
- "columnsFrom": [
1493
- "principal"
1494
- ],
1495
- "columnsTo": [
1496
- "principal"
1497
- ],
1498
- "onDelete": "restrict",
1499
- "onUpdate": "no action"
1500
- }
1501
- },
1502
- "compositePrimaryKeys": {},
1503
- "uniqueConstraints": {},
1504
- "checkConstraints": {
1505
- "service_bindings_principal_check": {
1506
- "name": "service_bindings_principal_check",
1507
- "value": "\"service_bindings\".\"principal\" LIKE 'token:%'"
1508
- },
1509
- "service_bindings_auth_mac_check": {
1510
- "name": "service_bindings_auth_mac_check",
1511
- "value": "octet_length(\"service_bindings\".\"auth_mac\") = 32"
1512
- },
1513
- "service_bindings_claims_check": {
1514
- "name": "service_bindings_claims_check",
1515
- "value": "json_valid(\"service_bindings\".\"claims\")"
1516
- }
1517
- }
1518
- },
1519
- "vault_grants": {
1520
- "name": "vault_grants",
1521
- "columns": {
1522
- "principal": {
1523
- "name": "principal",
1524
- "type": "text",
1525
- "primaryKey": false,
1526
- "notNull": true,
1527
- "autoincrement": false
1528
- },
1529
- "project_id": {
1530
- "name": "project_id",
1531
- "type": "text",
1532
- "primaryKey": false,
1533
- "notNull": false,
1534
- "autoincrement": false
1535
- },
1536
- "environment_id": {
1537
- "name": "environment_id",
1538
- "type": "text",
1539
- "primaryKey": false,
1540
- "notNull": false,
1541
- "autoincrement": false
1542
- },
1543
- "role": {
1544
- "name": "role",
1545
- "type": "text",
1546
- "primaryKey": false,
1547
- "notNull": true,
1548
- "autoincrement": false
1549
- },
1550
- "expires_at": {
1551
- "name": "expires_at",
1552
- "type": "integer",
1553
- "primaryKey": false,
1554
- "notNull": false,
1555
- "autoincrement": false
1556
- },
1557
- "granted_at": {
1558
- "name": "granted_at",
1559
- "type": "integer",
1560
- "primaryKey": false,
1561
- "notNull": true,
1562
- "autoincrement": false
1563
- },
1564
- "granted_by": {
1565
- "name": "granted_by",
1566
- "type": "text",
1567
- "primaryKey": false,
1568
- "notNull": true,
1569
- "autoincrement": false
1570
- }
1571
- },
1572
- "indexes": {
1573
- "vault_grants_on_project": {
1574
- "name": "vault_grants_on_project",
1575
- "columns": [
1576
- "principal",
1577
- "project_id"
1578
- ],
1579
- "isUnique": true
1580
- },
1581
- "vault_grants_on_environment": {
1582
- "name": "vault_grants_on_environment",
1583
- "columns": [
1584
- "principal",
1585
- "environment_id"
1586
- ],
1587
- "isUnique": true
1588
- }
1589
- },
1590
- "foreignKeys": {
1591
- "vault_grants_principal_fkey": {
1592
- "name": "vault_grants_principal_fkey",
1593
- "tableFrom": "vault_grants",
1594
- "tableTo": "vault_members",
1595
- "columnsFrom": [
1596
- "principal"
1597
- ],
1598
- "columnsTo": [
1599
- "principal"
1600
- ],
1601
- "onDelete": "restrict",
1602
- "onUpdate": "no action"
1603
- },
1604
- "vault_grants_project_id_fkey": {
1605
- "name": "vault_grants_project_id_fkey",
1606
- "tableFrom": "vault_grants",
1607
- "tableTo": "projects",
1608
- "columnsFrom": [
1609
- "project_id"
1610
- ],
1611
- "columnsTo": [
1612
- "id"
1613
- ],
1614
- "onDelete": "restrict",
1615
- "onUpdate": "no action"
1616
- },
1617
- "vault_grants_environment_id_fkey": {
1618
- "name": "vault_grants_environment_id_fkey",
1619
- "tableFrom": "vault_grants",
1620
- "tableTo": "environments",
1621
- "columnsFrom": [
1622
- "environment_id"
1623
- ],
1624
- "columnsTo": [
1625
- "id"
1626
- ],
1627
- "onDelete": "restrict",
1628
- "onUpdate": "no action"
1629
- }
1630
- },
1631
- "compositePrimaryKeys": {},
1632
- "uniqueConstraints": {},
1633
- "checkConstraints": {
1634
- "vault_grants_one_place": {
1635
- "name": "vault_grants_one_place",
1636
- "value": "(\"vault_grants\".\"project_id\" IS NULL) <> (\"vault_grants\".\"environment_id\" IS NULL)"
1637
- },
1638
- "vault_grants_role_check": {
1639
- "name": "vault_grants_role_check",
1640
- "value": "\"vault_grants\".\"role\" IN ('viewer', 'developer', 'maintainer', 'access-manager', 'auditor', 'owner')"
1641
- },
1642
- "vault_grants_environment_role_check": {
1643
- "name": "vault_grants_environment_role_check",
1644
- "value": "\"vault_grants\".\"environment_id\" IS NULL OR \"vault_grants\".\"role\" IN ('viewer', 'developer', 'auditor')"
1645
- }
1646
- }
1647
- },
1648
- "vault_members": {
1649
- "name": "vault_members",
1650
- "columns": {
1651
- "principal": {
1652
- "name": "principal",
1653
- "type": "text",
1654
- "primaryKey": true,
1655
- "notNull": true,
1656
- "autoincrement": false
1657
- },
1658
- "status": {
1659
- "name": "status",
1660
- "type": "text",
1661
- "primaryKey": false,
1662
- "notNull": true,
1663
- "autoincrement": false
1664
- },
1665
- "owner": {
1666
- "name": "owner",
1667
- "type": "integer",
1668
- "primaryKey": false,
1669
- "notNull": true,
1670
- "autoincrement": false,
1671
- "default": false
1672
- },
1673
- "generation": {
1674
- "name": "generation",
1675
- "type": "integer",
1676
- "primaryKey": false,
1677
- "notNull": true,
1678
- "autoincrement": false,
1679
- "default": 0
1680
- },
1681
- "created_at": {
1682
- "name": "created_at",
1683
- "type": "integer",
1684
- "primaryKey": false,
1685
- "notNull": true,
1686
- "autoincrement": false
1687
- },
1688
- "created_by": {
1689
- "name": "created_by",
1690
- "type": "text",
1691
- "primaryKey": false,
1692
- "notNull": true,
1693
- "autoincrement": false
1694
- },
1695
- "status_changed_at": {
1696
- "name": "status_changed_at",
1697
- "type": "integer",
1698
- "primaryKey": false,
1699
- "notNull": true,
1700
- "autoincrement": false
1701
- },
1702
- "status_changed_by": {
1703
- "name": "status_changed_by",
1704
- "type": "text",
1705
- "primaryKey": false,
1706
- "notNull": true,
1707
- "autoincrement": false
1708
- },
1709
- "access_seq": {
1710
- "name": "access_seq",
1711
- "type": "integer",
1712
- "primaryKey": false,
1713
- "notNull": true,
1714
- "autoincrement": false
1715
- },
1716
- "mac": {
1717
- "name": "mac",
1718
- "type": "blob",
1719
- "primaryKey": false,
1720
- "notNull": true,
1721
- "autoincrement": false
1722
- }
1723
- },
1724
- "indexes": {},
1725
- "foreignKeys": {},
1726
- "compositePrimaryKeys": {},
1727
- "uniqueConstraints": {},
1728
- "checkConstraints": {
1729
- "vault_members_mac_check": {
1730
- "name": "vault_members_mac_check",
1731
- "value": "octet_length(\"vault_members\".\"mac\") = 32"
1732
- },
1733
- "vault_members_principal_check": {
1734
- "name": "vault_members_principal_check",
1735
- "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"
1736
- },
1737
- "vault_members_user_lowercase": {
1738
- "name": "vault_members_user_lowercase",
1739
- "value": "\"vault_members\".\"principal\" NOT LIKE 'user:%' OR \"vault_members\".\"principal\" = lower(\"vault_members\".\"principal\")"
1740
- },
1741
- "vault_members_status_check": {
1742
- "name": "vault_members_status_check",
1743
- "value": "\"vault_members\".\"status\" IN ('active', 'removed')"
1744
- },
1745
- "vault_members_owner_check": {
1746
- "name": "vault_members_owner_check",
1747
- "value": "NOT \"vault_members\".\"owner\" OR (\"vault_members\".\"status\" = 'active' AND \"vault_members\".\"principal\" LIKE 'user:%')"
1748
- },
1749
- "vault_members_generation_check": {
1750
- "name": "vault_members_generation_check",
1751
- "value": "\"vault_members\".\"generation\" >= 0"
1752
- }
1753
- }
1754
- }
1755
- },
1756
- "views": {},
1757
- "enums": {},
1758
- "_meta": {
1759
- "schemas": {},
1760
- "tables": {},
1761
- "columns": {}
1762
- },
1763
- "internal": {
1764
- "indexes": {
1765
- "audit_log_unbind_idx": {
1766
- "columns": {
1767
- "json_extract(\"metadata\", '$.bindingId')": {
1768
- "isExpression": true
1769
- }
1770
- }
1771
- },
1772
- "audit_log_exchange_idx": {
1773
- "columns": {
1774
- "json_extract(\"metadata\", '$.credentialId')": {
1775
- "isExpression": true
1776
- }
1777
- }
1778
- }
1779
- }
1780
- }
1781
- }