@coffre/db 0.1.15 → 0.1.16

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