tba-storage-core 0.4.0.dev2__py3-none-any.whl
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.
- tba_storage_core/__init__.py +25 -0
- tba_storage_core/components.py +35 -0
- tba_storage_core/framework.py +3 -0
- tba_storage_core/migrations/__init__.py +15 -0
- tba_storage_core/migrations/contract.py +74 -0
- tba_storage_core/migrations/env.py +7 -0
- tba_storage_core/migrations/helpers.py +219 -0
- tba_storage_core/migrations/versions/0001_initial_identity_tables.py +17 -0
- tba_storage_core/migrations/versions/0002_client_and_service_tables.py +23 -0
- tba_storage_core/migrations/versions/0003_authorization_runtime_tables.py +17 -0
- tba_storage_core/migrations/versions/0004_device_par_revocation_tables.py +17 -0
- tba_storage_core/migrations/versions/0005_session_logout_tables.py +17 -0
- tba_storage_core/migrations/versions/0006_key_rotation_and_audit_tables.py +17 -0
- tba_storage_core/migrations/versions/0007_browser_session_cookie_and_auth_code_linkage.py +50 -0
- tba_storage_core/migrations/versions/0008_refresh_token_family_state.py +44 -0
- tba_storage_core/migrations/versions/0009_admin_identity_bootstrap_and_password_recovery.py +48 -0
- tba_storage_core/migrations/versions/0010_realm_namespace_tables.py +33 -0
- tba_storage_core/migrations/versions/0011_delegation_grant_lifecycle_tables.py +39 -0
- tba_storage_core/migrations/versions/0012_key_version_and_token_provenance_tables.py +36 -0
- tba_storage_core/migrations/versions/0013_contract_durable_state_tables.py +59 -0
- tba_storage_core/migrations/versions/0014_optional_contract_state_tables.py +57 -0
- tba_storage_core/migrations/versions/0015_principal_identity_credential_tables.py +85 -0
- tba_storage_core/migrations/versions/0016_crypto_key_storage_tables.py +84 -0
- tba_storage_core/migrations/versions/0017_authorization_server_table.py +21 -0
- tba_storage_core/migrations/versions/0018_policy_tables.py +27 -0
- tba_storage_core/migrations/versions/0019_federation_and_invariant_tables.py +35 -0
- tba_storage_core/migrations/versions/0020_backchannel_logout_replay_table.py +21 -0
- tba_storage_core/migrations/versions/0021_authentication_challenge_table.py +21 -0
- tba_storage_core/migrations/versions/0022_authority_and_trust_graph_tables.py +35 -0
- tba_storage_core/migrations/versions/0023_artifact_and_token_profile_discriminators.py +65 -0
- tba_storage_core/migrations/versions/0024_credential_issuer_wallet_and_configuration.py +32 -0
- tba_storage_core/migrations/versions/0025_credential_issuance_and_status.py +34 -0
- tba_storage_core/migrations/versions/0026_presentation_transaction_and_replay.py +28 -0
- tba_storage_core/migrations/versions/0027_attestation_and_reference_material.py +32 -0
- tba_storage_core/migrations/versions/0028_spiffe_svid_and_trust_bundles.py +22 -0
- tba_storage_core/migrations/versions/0029_security_event_delivery.py +28 -0
- tba_storage_core/migrations/versions/0030_optional_did_and_gnap_state.py +37 -0
- tba_storage_core/migrations/versions/0031_certificate_trust_and_status.py +22 -0
- tba_storage_core/migrations/versions/0032_claim_definition_and_provenance.py +30 -0
- tba_storage_core/migrations/versions/0033_replay_reservations.py +18 -0
- tba_storage_core/migrations/versions/0034_dpop_replay_nonce_tables.py +21 -0
- tba_storage_core/migrations/versions/0035_webauthn_rp_ceremony_and_credentials.py +76 -0
- tba_storage_core/migrations/versions/0036_workload_credentials_artifacts_and_proof_replay.py +27 -0
- tba_storage_core/migrations/versions/0037_operator_tables.py +30 -0
- tba_storage_core/migrations/versions/0038_adopt_component_ownership.py +66 -0
- tba_storage_core/migrations/versions/0039_normalized_platform_iam.py +17 -0
- tba_storage_core/py.typed +0 -0
- tba_storage_core/storage.lock.toml +211 -0
- tba_storage_core/storage.toml +34 -0
- tba_storage_core/tables/__init__.py +179 -0
- tba_storage_core/tables/_graph_base.py +53 -0
- tba_storage_core/tables/_registry.py +200 -0
- tba_storage_core/tables/access_review_campaign/__init__.py +9 -0
- tba_storage_core/tables/access_review_campaign/_table.py +25 -0
- tba_storage_core/tables/access_review_decision/__init__.py +9 -0
- tba_storage_core/tables/access_review_decision/_table.py +27 -0
- tba_storage_core/tables/access_review_item/__init__.py +9 -0
- tba_storage_core/tables/access_review_item/_table.py +26 -0
- tba_storage_core/tables/attestation_appraisal_policy/__init__.py +3 -0
- tba_storage_core/tables/attestation_endorsement/__init__.py +3 -0
- tba_storage_core/tables/attestation_evidence/__init__.py +3 -0
- tba_storage_core/tables/attestation_reference_manifest/__init__.py +3 -0
- tba_storage_core/tables/attestation_reference_value/__init__.py +3 -0
- tba_storage_core/tables/attestation_result/__init__.py +3 -0
- tba_storage_core/tables/attestation_state.py +124 -0
- tba_storage_core/tables/attribute_policy/__init__.py +9 -0
- tba_storage_core/tables/attribute_policy/_table.py +40 -0
- tba_storage_core/tables/audit_event/__init__.py +10 -0
- tba_storage_core/tables/audit_event/_table.py +47 -0
- tba_storage_core/tables/auth_code/__init__.py +13 -0
- tba_storage_core/tables/auth_code/_table.py +41 -0
- tba_storage_core/tables/auth_session/__init__.py +13 -0
- tba_storage_core/tables/auth_session/_table.py +45 -0
- tba_storage_core/tables/authentication_challenge/__init__.py +7 -0
- tba_storage_core/tables/authentication_challenge/_table.py +38 -0
- tba_storage_core/tables/authority_derivation_graph/__init__.py +15 -0
- tba_storage_core/tables/authority_derivation_graph/_table.py +94 -0
- tba_storage_core/tables/authorization_invariant/__init__.py +5 -0
- tba_storage_core/tables/authorization_invariant/_table.py +34 -0
- tba_storage_core/tables/authorization_server/__init__.py +6 -0
- tba_storage_core/tables/authorization_server/_table.py +61 -0
- tba_storage_core/tables/authz_verification_report/__init__.py +9 -0
- tba_storage_core/tables/authz_verification_report/_table.py +29 -0
- tba_storage_core/tables/backchannel_logout_replay/__init__.py +5 -0
- tba_storage_core/tables/backchannel_logout_replay/_table.py +37 -0
- tba_storage_core/tables/certificate_record/__init__.py +3 -0
- tba_storage_core/tables/certificate_state.py +82 -0
- tba_storage_core/tables/certificate_status_snapshot/__init__.py +3 -0
- tba_storage_core/tables/claim_state.py +98 -0
- tba_storage_core/tables/client/__init__.py +9 -0
- tba_storage_core/tables/client/_table.py +41 -0
- tba_storage_core/tables/client_registration/__init__.py +10 -0
- tba_storage_core/tables/client_registration/_table.py +47 -0
- tba_storage_core/tables/consent/__init__.py +13 -0
- tba_storage_core/tables/consent/_table.py +57 -0
- tba_storage_core/tables/control_correctness_report/__init__.py +9 -0
- tba_storage_core/tables/control_correctness_report/_table.py +20 -0
- tba_storage_core/tables/credential/__init__.py +9 -0
- tba_storage_core/tables/credential/_table.py +74 -0
- tba_storage_core/tables/credential_api_key/__init__.py +9 -0
- tba_storage_core/tables/credential_api_key/_table.py +50 -0
- tba_storage_core/tables/credential_audit_event/__init__.py +9 -0
- tba_storage_core/tables/credential_audit_event/_table.py +25 -0
- tba_storage_core/tables/credential_client_secret/__init__.py +9 -0
- tba_storage_core/tables/credential_client_secret/_table.py +24 -0
- tba_storage_core/tables/credential_configuration/__init__.py +3 -0
- tba_storage_core/tables/credential_deferred_transaction/__init__.py +3 -0
- tba_storage_core/tables/credential_dpop_key/__init__.py +9 -0
- tba_storage_core/tables/credential_dpop_key/_table.py +22 -0
- tba_storage_core/tables/credential_ecosystem_registry.py +119 -0
- tba_storage_core/tables/credential_issuance_state.py +154 -0
- tba_storage_core/tables/credential_issuance_transaction/__init__.py +3 -0
- tba_storage_core/tables/credential_issuer/__init__.py +3 -0
- tba_storage_core/tables/credential_mfa_factor/__init__.py +9 -0
- tba_storage_core/tables/credential_mfa_factor/_table.py +24 -0
- tba_storage_core/tables/credential_mtls_certificate/__init__.py +9 -0
- tba_storage_core/tables/credential_mtls_certificate/_table.py +26 -0
- tba_storage_core/tables/credential_notification/__init__.py +3 -0
- tba_storage_core/tables/credential_offer/__init__.py +3 -0
- tba_storage_core/tables/credential_password/__init__.py +9 -0
- tba_storage_core/tables/credential_password/_table.py +24 -0
- tba_storage_core/tables/credential_recovery_code/__init__.py +9 -0
- tba_storage_core/tables/credential_recovery_code/_table.py +23 -0
- tba_storage_core/tables/credential_service_key/__init__.py +9 -0
- tba_storage_core/tables/credential_service_key/_table.py +49 -0
- tba_storage_core/tables/credential_status_entry/__init__.py +3 -0
- tba_storage_core/tables/credential_status_list/__init__.py +3 -0
- tba_storage_core/tables/credential_status_publication/__init__.py +3 -0
- tba_storage_core/tables/credential_webauthn_passkey/__init__.py +9 -0
- tba_storage_core/tables/credential_webauthn_passkey/_table.py +42 -0
- tba_storage_core/tables/crypto_key/__init__.py +13 -0
- tba_storage_core/tables/crypto_key/_table.py +52 -0
- tba_storage_core/tables/crypto_key_version/__init__.py +13 -0
- tba_storage_core/tables/crypto_key_version/_table.py +53 -0
- tba_storage_core/tables/delegated_admin_scope/__init__.py +9 -0
- tba_storage_core/tables/delegated_admin_scope/_table.py +34 -0
- tba_storage_core/tables/delegation_grant/__init__.py +13 -0
- tba_storage_core/tables/delegation_grant/_table.py +134 -0
- tba_storage_core/tables/device_code/__init__.py +13 -0
- tba_storage_core/tables/device_code/_table.py +54 -0
- tba_storage_core/tables/did_document/__init__.py +3 -0
- tba_storage_core/tables/did_document_version/__init__.py +3 -0
- tba_storage_core/tables/did_gnap_state.py +169 -0
- tba_storage_core/tables/did_resolution_cache/__init__.py +3 -0
- tba_storage_core/tables/did_service/__init__.py +3 -0
- tba_storage_core/tables/did_verification_method/__init__.py +3 -0
- tba_storage_core/tables/dpop_nonce/__init__.py +5 -0
- tba_storage_core/tables/dpop_nonce/_table.py +77 -0
- tba_storage_core/tables/dpop_replay/__init__.py +5 -0
- tba_storage_core/tables/dpop_replay/_table.py +97 -0
- tba_storage_core/tables/entitlement/__init__.py +9 -0
- tba_storage_core/tables/entitlement/_table.py +22 -0
- tba_storage_core/tables/entitlement_assignment/__init__.py +9 -0
- tba_storage_core/tables/entitlement_assignment/_table.py +26 -0
- tba_storage_core/tables/federated_session/__init__.py +5 -0
- tba_storage_core/tables/federated_session/_table.py +32 -0
- tba_storage_core/tables/federation/__init__.py +5 -0
- tba_storage_core/tables/federation/_table.py +37 -0
- tba_storage_core/tables/gnap_client_instance/__init__.py +3 -0
- tba_storage_core/tables/gnap_continuation/__init__.py +3 -0
- tba_storage_core/tables/gnap_grant/__init__.py +3 -0
- tba_storage_core/tables/gnap_interaction/__init__.py +3 -0
- tba_storage_core/tables/identity_provider/__init__.py +5 -0
- tba_storage_core/tables/identity_provider/_table.py +37 -0
- tba_storage_core/tables/invariant_evaluation/__init__.py +5 -0
- tba_storage_core/tables/invariant_evaluation/_table.py +29 -0
- tba_storage_core/tables/invariant_violation/__init__.py +5 -0
- tba_storage_core/tables/invariant_violation/_table.py +27 -0
- tba_storage_core/tables/key_attestation_evidence/__init__.py +13 -0
- tba_storage_core/tables/key_attestation_evidence/_table.py +99 -0
- tba_storage_core/tables/key_envelope/__init__.py +13 -0
- tba_storage_core/tables/key_envelope/_table.py +54 -0
- tba_storage_core/tables/key_rotation_event/__init__.py +9 -0
- tba_storage_core/tables/key_rotation_event/_table.py +44 -0
- tba_storage_core/tables/key_rotation_policy/__init__.py +9 -0
- tba_storage_core/tables/key_rotation_policy/_table.py +38 -0
- tba_storage_core/tables/logout_state/__init__.py +10 -0
- tba_storage_core/tables/logout_state/_table.py +67 -0
- tba_storage_core/tables/machine_identity/__init__.py +9 -0
- tba_storage_core/tables/machine_identity/_table.py +49 -0
- tba_storage_core/tables/operator_activity/__init__.py +9 -0
- tba_storage_core/tables/operator_activity/_table.py +29 -0
- tba_storage_core/tables/operator_audit_event/__init__.py +9 -0
- tba_storage_core/tables/operator_audit_event/_table.py +29 -0
- tba_storage_core/tables/operator_metadata/__init__.py +9 -0
- tba_storage_core/tables/operator_metadata/_table.py +19 -0
- tba_storage_core/tables/operator_record/__init__.py +9 -0
- tba_storage_core/tables/operator_record/_table.py +44 -0
- tba_storage_core/tables/operator_transaction/__init__.py +9 -0
- tba_storage_core/tables/operator_transaction/_table.py +33 -0
- tba_storage_core/tables/plugin_descriptor/__init__.py +9 -0
- tba_storage_core/tables/plugin_descriptor/_table.py +23 -0
- tba_storage_core/tables/plugin_lifecycle_event/__init__.py +9 -0
- tba_storage_core/tables/plugin_lifecycle_event/_table.py +22 -0
- tba_storage_core/tables/policy/__init__.py +5 -0
- tba_storage_core/tables/policy/_table.py +30 -0
- tba_storage_core/tables/policy_condition/__init__.py +9 -0
- tba_storage_core/tables/policy_condition/_table.py +21 -0
- tba_storage_core/tables/policy_set/__init__.py +5 -0
- tba_storage_core/tables/policy_set/_table.py +33 -0
- tba_storage_core/tables/policy_set_member/__init__.py +5 -0
- tba_storage_core/tables/policy_set_member/_table.py +32 -0
- tba_storage_core/tables/policy_target/__init__.py +5 -0
- tba_storage_core/tables/policy_target/_table.py +36 -0
- tba_storage_core/tables/policy_version/__init__.py +5 -0
- tba_storage_core/tables/policy_version/_table.py +35 -0
- tba_storage_core/tables/presentation_consent/__init__.py +3 -0
- tba_storage_core/tables/presentation_replay/__init__.py +3 -0
- tba_storage_core/tables/presentation_state.py +98 -0
- tba_storage_core/tables/presentation_transaction/__init__.py +3 -0
- tba_storage_core/tables/principal/__init__.py +9 -0
- tba_storage_core/tables/principal/_table.py +49 -0
- tba_storage_core/tables/principal_key_binding/__init__.py +13 -0
- tba_storage_core/tables/principal_key_binding/_table.py +48 -0
- tba_storage_core/tables/provider_artifact/__init__.py +9 -0
- tba_storage_core/tables/provider_artifact/_table.py +22 -0
- tba_storage_core/tables/pushed_authorization_request/__init__.py +13 -0
- tba_storage_core/tables/pushed_authorization_request/_table.py +59 -0
- tba_storage_core/tables/realm/__init__.py +13 -0
- tba_storage_core/tables/realm/_table.py +87 -0
- tba_storage_core/tables/release_attestation_event/__init__.py +9 -0
- tba_storage_core/tables/release_attestation_event/_table.py +21 -0
- tba_storage_core/tables/release_authorization_state/__init__.py +9 -0
- tba_storage_core/tables/release_authorization_state/_table.py +21 -0
- tba_storage_core/tables/release_capability_record/__init__.py +9 -0
- tba_storage_core/tables/release_capability_record/_table.py +21 -0
- tba_storage_core/tables/release_posture/__init__.py +9 -0
- tba_storage_core/tables/release_posture/_table.py +21 -0
- tba_storage_core/tables/release_security_posture/__init__.py +9 -0
- tba_storage_core/tables/release_security_posture/_table.py +22 -0
- tba_storage_core/tables/replay_reservation.py +34 -0
- tba_storage_core/tables/residency_zone/__init__.py +9 -0
- tba_storage_core/tables/residency_zone/_table.py +20 -0
- tba_storage_core/tables/resource_server_contract/__init__.py +9 -0
- tba_storage_core/tables/resource_server_contract/_table.py +21 -0
- tba_storage_core/tables/revoked_token/__init__.py +13 -0
- tba_storage_core/tables/revoked_token/_table.py +39 -0
- tba_storage_core/tables/role/__init__.py +9 -0
- tba_storage_core/tables/role/_table.py +22 -0
- tba_storage_core/tables/runtime_qualification/__init__.py +9 -0
- tba_storage_core/tables/runtime_qualification/_table.py +21 -0
- tba_storage_core/tables/scim_group/__init__.py +9 -0
- tba_storage_core/tables/scim_group/_table.py +21 -0
- tba_storage_core/tables/scim_patch_event/__init__.py +9 -0
- tba_storage_core/tables/scim_patch_event/_table.py +22 -0
- tba_storage_core/tables/scim_schema/__init__.py +9 -0
- tba_storage_core/tables/scim_schema/_table.py +21 -0
- tba_storage_core/tables/scim_user/__init__.py +9 -0
- tba_storage_core/tables/scim_user/_table.py +21 -0
- tba_storage_core/tables/sdk_package/__init__.py +9 -0
- tba_storage_core/tables/sdk_package/_table.py +23 -0
- tba_storage_core/tables/security_event/__init__.py +3 -0
- tba_storage_core/tables/security_event_delivery/__init__.py +3 -0
- tba_storage_core/tables/security_event_replay/__init__.py +3 -0
- tba_storage_core/tables/security_event_state.py +100 -0
- tba_storage_core/tables/security_event_subscription/__init__.py +3 -0
- tba_storage_core/tables/service_identity/__init__.py +9 -0
- tba_storage_core/tables/service_identity/_table.py +47 -0
- tba_storage_core/tables/spiffe_state.py +83 -0
- tba_storage_core/tables/spiffe_trust_bundle/__init__.py +3 -0
- tba_storage_core/tables/subject_alias/__init__.py +9 -0
- tba_storage_core/tables/subject_alias/_table.py +21 -0
- tba_storage_core/tables/svid_record/__init__.py +3 -0
- tba_storage_core/tables/tenant/__init__.py +13 -0
- tba_storage_core/tables/tenant/_table.py +83 -0
- tba_storage_core/tables/tenant_membership/__init__.py +9 -0
- tba_storage_core/tables/tenant_membership/_table.py +28 -0
- tba_storage_core/tables/tenant_residency/__init__.py +9 -0
- tba_storage_core/tables/tenant_residency/_table.py +23 -0
- tba_storage_core/tables/token_record/__init__.py +10 -0
- tba_storage_core/tables/token_record/_table.py +123 -0
- tba_storage_core/tables/trust_anchor/__init__.py +3 -0
- tba_storage_core/tables/trust_domain_federation/__init__.py +3 -0
- tba_storage_core/tables/trust_federation_graph/__init__.py +15 -0
- tba_storage_core/tables/trust_federation_graph/_table.py +94 -0
- tba_storage_core/tables/user/__init__.py +13 -0
- tba_storage_core/tables/user/_table.py +127 -0
- tba_storage_core/tables/verifier_registration/__init__.py +3 -0
- tba_storage_core/tables/wallet_attestation/__init__.py +3 -0
- tba_storage_core/tables/wallet_instance/__init__.py +3 -0
- tba_storage_core/tables/wallet_key_binding/__init__.py +3 -0
- tba_storage_core/tables/wallet_registration/__init__.py +3 -0
- tba_storage_core/tables/webauthn_attestation_record/__init__.py +3 -0
- tba_storage_core/tables/webauthn_attestation_record/_table.py +28 -0
- tba_storage_core/tables/webauthn_ceremony/__init__.py +3 -0
- tba_storage_core/tables/webauthn_ceremony/_table.py +43 -0
- tba_storage_core/tables/webauthn_relying_party/__init__.py +3 -0
- tba_storage_core/tables/webauthn_relying_party/_table.py +24 -0
- tba_storage_core/tables/workload_credential_state.py +57 -0
- tba_storage_core/tables/workload_identity/__init__.py +9 -0
- tba_storage_core/tables/workload_identity/_table.py +89 -0
- tba_storage_core-0.4.0.dev2.dist-info/METADATA +126 -0
- tba_storage_core-0.4.0.dev2.dist-info/RECORD +294 -0
- tba_storage_core-0.4.0.dev2.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""Executable DDL migration for DelegationGrant lifecycle tables."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_storage_core.migrations.helpers import create_tables, drop_tables
|
|
6
|
+
from tba_storage_core.tables import (
|
|
7
|
+
DelegationGrant,
|
|
8
|
+
DelegationGrantEdge,
|
|
9
|
+
DelegationGrantProof,
|
|
10
|
+
DelegationGrantScope,
|
|
11
|
+
DelegationGrantTokenLink,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
revision = "0011_delegation_grant_lifecycle_tables"
|
|
15
|
+
down_revision = "0010_realm_namespace_tables"
|
|
16
|
+
branch_labels = None
|
|
17
|
+
depends_on = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def upgrade(conn) -> None:
|
|
21
|
+
create_tables(
|
|
22
|
+
conn,
|
|
23
|
+
DelegationGrant,
|
|
24
|
+
DelegationGrantScope,
|
|
25
|
+
DelegationGrantProof,
|
|
26
|
+
DelegationGrantEdge,
|
|
27
|
+
DelegationGrantTokenLink,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def downgrade(conn) -> None:
|
|
32
|
+
drop_tables(
|
|
33
|
+
conn,
|
|
34
|
+
DelegationGrant,
|
|
35
|
+
DelegationGrantScope,
|
|
36
|
+
DelegationGrantProof,
|
|
37
|
+
DelegationGrantEdge,
|
|
38
|
+
DelegationGrantTokenLink,
|
|
39
|
+
)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Executable DDL migration for key versions and token provenance."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_storage_core.migrations.helpers import AUTHN_SCHEMA, column_names, create_tables, drop_columns, drop_tables
|
|
6
|
+
from tba_storage_core.tables import CryptoKey, CryptoKeyVersion
|
|
7
|
+
|
|
8
|
+
revision = "0012_key_version_and_token_provenance_tables"
|
|
9
|
+
down_revision = "0011_delegation_grant_lifecycle_tables"
|
|
10
|
+
branch_labels = None
|
|
11
|
+
depends_on = None
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _table_name(conn, table: str) -> str:
|
|
15
|
+
return f'"{AUTHN_SCHEMA}"."{table}"'
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _add_column_if_missing(conn, table: str, name: str, ddl: str) -> None:
|
|
19
|
+
if name in column_names(conn, table):
|
|
20
|
+
return
|
|
21
|
+
conn.exec_driver_sql(f"ALTER TABLE {_table_name(conn, table)} ADD COLUMN {ddl}")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def upgrade(conn) -> None:
|
|
25
|
+
create_tables(conn, CryptoKey, CryptoKeyVersion)
|
|
26
|
+
_add_column_if_missing(conn, "token_records", "jti", '"jti" VARCHAR(128)')
|
|
27
|
+
_add_column_if_missing(conn, "token_records", "token_status", '"token_status" VARCHAR(32) NOT NULL DEFAULT \'active\'')
|
|
28
|
+
_add_column_if_missing(conn, "token_records", "kid", '"kid" VARCHAR(255)')
|
|
29
|
+
_add_column_if_missing(conn, "token_records", "key_version", '"key_version" INTEGER')
|
|
30
|
+
_add_column_if_missing(conn, "revoked_tokens", "refresh_family_id", '"refresh_family_id" VARCHAR(64)')
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def downgrade(conn) -> None:
|
|
34
|
+
drop_columns(conn, "revoked_tokens", ("refresh_family_id",))
|
|
35
|
+
drop_columns(conn, "token_records", ("jti", "token_status", "kid", "key_version"))
|
|
36
|
+
drop_tables(conn, CryptoKey, CryptoKeyVersion)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""Executable DDL migration for contract-backed durable state tables."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_storage_core.migrations.helpers import create_tables, drop_tables
|
|
6
|
+
from tba_storage_core.tables import (
|
|
7
|
+
AccessReviewCampaign,
|
|
8
|
+
AccessReviewDecision,
|
|
9
|
+
AccessReviewItem,
|
|
10
|
+
AttributePolicy,
|
|
11
|
+
Credential,
|
|
12
|
+
CredentialAuditEvent,
|
|
13
|
+
CredentialDpopKey,
|
|
14
|
+
CredentialMtlsCertificate,
|
|
15
|
+
DelegatedAdminScope,
|
|
16
|
+
Entitlement,
|
|
17
|
+
EntitlementAssignment,
|
|
18
|
+
KeyRotationPolicy,
|
|
19
|
+
PolicyCondition,
|
|
20
|
+
ResidencyZone,
|
|
21
|
+
Role,
|
|
22
|
+
SubjectAlias,
|
|
23
|
+
TenantMembership,
|
|
24
|
+
TenantResidency,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
revision = "0013_contract_durable_state_tables"
|
|
28
|
+
down_revision = "0012_key_version_and_token_provenance_tables"
|
|
29
|
+
branch_labels = None
|
|
30
|
+
depends_on = None
|
|
31
|
+
|
|
32
|
+
TABLES = (
|
|
33
|
+
Credential,
|
|
34
|
+
CredentialAuditEvent,
|
|
35
|
+
CredentialDpopKey,
|
|
36
|
+
CredentialMtlsCertificate,
|
|
37
|
+
TenantMembership,
|
|
38
|
+
SubjectAlias,
|
|
39
|
+
Role,
|
|
40
|
+
AttributePolicy,
|
|
41
|
+
PolicyCondition,
|
|
42
|
+
DelegatedAdminScope,
|
|
43
|
+
KeyRotationPolicy,
|
|
44
|
+
Entitlement,
|
|
45
|
+
EntitlementAssignment,
|
|
46
|
+
AccessReviewCampaign,
|
|
47
|
+
AccessReviewItem,
|
|
48
|
+
AccessReviewDecision,
|
|
49
|
+
ResidencyZone,
|
|
50
|
+
TenantResidency,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def upgrade(conn) -> None:
|
|
55
|
+
create_tables(conn, *TABLES)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def downgrade(conn) -> None:
|
|
59
|
+
drop_tables(conn, *TABLES)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""Executable DDL migration for optional contract state tables."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_storage_core.migrations.helpers import create_tables, drop_tables
|
|
6
|
+
from tba_storage_core.tables import (
|
|
7
|
+
AuthzVerificationReport,
|
|
8
|
+
ControlCorrectnessReport,
|
|
9
|
+
PluginDescriptorRecord,
|
|
10
|
+
PluginLifecycleEventRecord,
|
|
11
|
+
ProviderArtifact,
|
|
12
|
+
ReleaseAttestationEvent,
|
|
13
|
+
ReleaseAuthorizationState,
|
|
14
|
+
ReleaseCapabilityRecord,
|
|
15
|
+
ReleasePosture,
|
|
16
|
+
ReleaseSecurityPosture,
|
|
17
|
+
ResourceServerContract,
|
|
18
|
+
RuntimeQualificationRecord,
|
|
19
|
+
SDKPackageRecord,
|
|
20
|
+
ScimGroupRecord,
|
|
21
|
+
ScimPatchEvent,
|
|
22
|
+
ScimSchemaRecord,
|
|
23
|
+
ScimUserRecord,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
revision = "0014_optional_contract_state_tables"
|
|
27
|
+
down_revision = "0013_contract_durable_state_tables"
|
|
28
|
+
branch_labels = None
|
|
29
|
+
depends_on = None
|
|
30
|
+
|
|
31
|
+
TABLES = (
|
|
32
|
+
SDKPackageRecord,
|
|
33
|
+
PluginDescriptorRecord,
|
|
34
|
+
PluginLifecycleEventRecord,
|
|
35
|
+
ScimSchemaRecord,
|
|
36
|
+
ScimUserRecord,
|
|
37
|
+
ScimGroupRecord,
|
|
38
|
+
ScimPatchEvent,
|
|
39
|
+
ReleaseCapabilityRecord,
|
|
40
|
+
ReleaseAuthorizationState,
|
|
41
|
+
RuntimeQualificationRecord,
|
|
42
|
+
ReleaseSecurityPosture,
|
|
43
|
+
ReleasePosture,
|
|
44
|
+
ReleaseAttestationEvent,
|
|
45
|
+
ControlCorrectnessReport,
|
|
46
|
+
AuthzVerificationReport,
|
|
47
|
+
ResourceServerContract,
|
|
48
|
+
ProviderArtifact,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def upgrade(conn) -> None:
|
|
53
|
+
create_tables(conn, *TABLES)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def downgrade(conn) -> None:
|
|
57
|
+
drop_tables(conn, *reversed(TABLES))
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"""Executable DDL migration for principal, identity, and credential subtype tables."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_storage_core.migrations.helpers import column_names, create_tables, drop_tables, ensure_schema, table_names
|
|
6
|
+
from tba_storage_core.tables import (
|
|
7
|
+
CredentialApiKey,
|
|
8
|
+
CredentialClientSecret,
|
|
9
|
+
CredentialMfaFactor,
|
|
10
|
+
CredentialPassword,
|
|
11
|
+
CredentialRecoveryCode,
|
|
12
|
+
CredentialServiceKey,
|
|
13
|
+
CredentialWebAuthnPasskey,
|
|
14
|
+
MachineIdentity,
|
|
15
|
+
Principal,
|
|
16
|
+
ServiceIdentity,
|
|
17
|
+
WorkloadIdentity,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
revision = "0015_principal_identity_credential_tables"
|
|
21
|
+
down_revision = "0014_optional_contract_state_tables"
|
|
22
|
+
branch_labels = None
|
|
23
|
+
depends_on = None
|
|
24
|
+
|
|
25
|
+
TABLES = (
|
|
26
|
+
Principal,
|
|
27
|
+
ServiceIdentity,
|
|
28
|
+
MachineIdentity,
|
|
29
|
+
WorkloadIdentity,
|
|
30
|
+
CredentialApiKey,
|
|
31
|
+
CredentialServiceKey,
|
|
32
|
+
CredentialPassword,
|
|
33
|
+
CredentialClientSecret,
|
|
34
|
+
CredentialWebAuthnPasskey,
|
|
35
|
+
CredentialMfaFactor,
|
|
36
|
+
CredentialRecoveryCode,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _table_name(table: str) -> str:
|
|
41
|
+
return f'"authn"."{table}"'
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _rename_table_if_present(conn, old: str, new: str) -> None:
|
|
45
|
+
names = table_names(conn)
|
|
46
|
+
if old not in names or new in names:
|
|
47
|
+
return
|
|
48
|
+
conn.exec_driver_sql(f'ALTER TABLE {_table_name(old)} RENAME TO "{new}"')
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _rename_column_if_present(conn, table: str, old: str, new: str) -> None:
|
|
52
|
+
columns = column_names(conn, table)
|
|
53
|
+
if old not in columns or new in columns:
|
|
54
|
+
return
|
|
55
|
+
conn.exec_driver_sql(f'ALTER TABLE {_table_name(table)} RENAME COLUMN "{old}" TO "{new}"')
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _add_column_if_missing(conn, table: str, column_sql: str, column_name: str) -> None:
|
|
59
|
+
if table not in table_names(conn) or column_name in column_names(conn, table):
|
|
60
|
+
return
|
|
61
|
+
conn.exec_driver_sql(f"ALTER TABLE {_table_name(table)} ADD COLUMN {column_sql}")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _adopt_legacy_identity_credential_tables(conn) -> None:
|
|
65
|
+
ensure_schema(conn)
|
|
66
|
+
_rename_table_if_present(conn, "services", "service_identities")
|
|
67
|
+
_rename_table_if_present(conn, "service_keys", "credential_service_keys")
|
|
68
|
+
_rename_table_if_present(conn, "api_keys", "credential_api_keys")
|
|
69
|
+
_rename_column_if_present(conn, "credential_service_keys", "service_id", "service_identity_id")
|
|
70
|
+
_rename_column_if_present(conn, "credential_api_keys", "user_id", "principal_id")
|
|
71
|
+
_add_column_if_missing(
|
|
72
|
+
conn,
|
|
73
|
+
"credential_api_keys",
|
|
74
|
+
'"principal_kind" VARCHAR(64) NOT NULL DEFAULT \'user\'',
|
|
75
|
+
"principal_kind",
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def upgrade(conn) -> None:
|
|
80
|
+
_adopt_legacy_identity_credential_tables(conn)
|
|
81
|
+
create_tables(conn, *TABLES)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def downgrade(conn) -> None:
|
|
85
|
+
drop_tables(conn, *TABLES)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""Executable DDL migration for generic crypto key storage tables."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_storage_core.migrations.helpers import column_names, create_tables, drop_tables, ensure_schema, table_names
|
|
6
|
+
from tba_storage_core.tables import (
|
|
7
|
+
CryptoKey,
|
|
8
|
+
CryptoKeyVersion,
|
|
9
|
+
KeyAttestationEvidence,
|
|
10
|
+
KeyEnvelope,
|
|
11
|
+
PrincipalKeyBinding,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
revision = "0016_crypto_key_storage_tables"
|
|
15
|
+
down_revision = "0015_principal_identity_credential_tables"
|
|
16
|
+
branch_labels = None
|
|
17
|
+
depends_on = None
|
|
18
|
+
|
|
19
|
+
TABLES = (
|
|
20
|
+
CryptoKey,
|
|
21
|
+
CryptoKeyVersion,
|
|
22
|
+
PrincipalKeyBinding,
|
|
23
|
+
KeyEnvelope,
|
|
24
|
+
KeyAttestationEvidence,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _table_name(table: str) -> str:
|
|
29
|
+
return f'"authn"."{table}"'
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _rename_table_if_present(conn, old: str, new: str) -> None:
|
|
33
|
+
names = table_names(conn)
|
|
34
|
+
if old not in names or new in names:
|
|
35
|
+
return
|
|
36
|
+
conn.exec_driver_sql(f'ALTER TABLE {_table_name(old)} RENAME TO "{new}"')
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _rename_column_if_present(conn, table: str, old: str, new: str) -> None:
|
|
40
|
+
columns = column_names(conn, table)
|
|
41
|
+
if old not in columns or new in columns:
|
|
42
|
+
return
|
|
43
|
+
conn.exec_driver_sql(f'ALTER TABLE {_table_name(table)} RENAME COLUMN "{old}" TO "{new}"')
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _add_column_if_missing(conn, table: str, ddl: str, column_name: str) -> None:
|
|
47
|
+
if table not in table_names(conn) or column_name in column_names(conn, table):
|
|
48
|
+
return
|
|
49
|
+
conn.exec_driver_sql(f"ALTER TABLE {_table_name(table)} ADD COLUMN {ddl}")
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _adopt_legacy_key_tables(conn) -> None:
|
|
53
|
+
ensure_schema(conn)
|
|
54
|
+
_rename_table_if_present(conn, "identity_keys", "crypto_keys")
|
|
55
|
+
_rename_table_if_present(conn, "identity_key_versions", "crypto_key_versions")
|
|
56
|
+
_rename_column_if_present(conn, "crypto_keys", "public_jwk", "public_material")
|
|
57
|
+
_rename_column_if_present(conn, "crypto_key_versions", "public_jwk", "public_material")
|
|
58
|
+
_rename_column_if_present(conn, "crypto_keys", "key_profiles", "key_usages")
|
|
59
|
+
|
|
60
|
+
_add_column_if_missing(conn, "crypto_keys", '"key_kind" VARCHAR(64) NOT NULL DEFAULT \'asymmetric\'', "key_kind")
|
|
61
|
+
_add_column_if_missing(conn, "crypto_keys", '"key_usages" JSON', "key_usages")
|
|
62
|
+
_add_column_if_missing(conn, "crypto_keys", '"allowed_ops" JSON', "allowed_ops")
|
|
63
|
+
_add_column_if_missing(conn, "crypto_keys", '"export_policy" VARCHAR(64) NOT NULL DEFAULT \'public_only\'', "export_policy")
|
|
64
|
+
_add_column_if_missing(conn, "crypto_keys", '"origin" VARCHAR(64) NOT NULL DEFAULT \'generated\'', "origin")
|
|
65
|
+
_add_column_if_missing(conn, "crypto_keys", '"extractable" BOOLEAN NOT NULL DEFAULT FALSE', "extractable")
|
|
66
|
+
_add_column_if_missing(conn, "crypto_keys", '"public_material_format" VARCHAR(64)', "public_material_format")
|
|
67
|
+
_add_column_if_missing(conn, "crypto_keys", '"fingerprint" VARCHAR(255)', "fingerprint")
|
|
68
|
+
|
|
69
|
+
_add_column_if_missing(conn, "crypto_key_versions", '"allowed_ops" JSON', "allowed_ops")
|
|
70
|
+
_add_column_if_missing(conn, "crypto_key_versions", '"public_material_format" VARCHAR(64)', "public_material_format")
|
|
71
|
+
_add_column_if_missing(conn, "crypto_key_versions", '"fingerprint" VARCHAR(255)', "fingerprint")
|
|
72
|
+
_add_column_if_missing(conn, "crypto_key_versions", '"not_before" TIMESTAMP', "not_before")
|
|
73
|
+
_add_column_if_missing(conn, "crypto_key_versions", '"not_after" TIMESTAMP', "not_after")
|
|
74
|
+
_add_column_if_missing(conn, "crypto_key_versions", '"activated_at" TIMESTAMP', "activated_at")
|
|
75
|
+
_add_column_if_missing(conn, "crypto_key_versions", '"retired_at" TIMESTAMP', "retired_at")
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def upgrade(conn) -> None:
|
|
79
|
+
_adopt_legacy_key_tables(conn)
|
|
80
|
+
create_tables(conn, *TABLES)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def downgrade(conn) -> None:
|
|
84
|
+
drop_tables(conn, KeyAttestationEvidence, KeyEnvelope, PrincipalKeyBinding)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Executable DDL migration for durable authorization-server state."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_storage_core.migrations.helpers import create_tables, drop_tables
|
|
6
|
+
from tba_storage_core.tables import AuthorizationServer
|
|
7
|
+
|
|
8
|
+
revision = "0017_authorization_server_table"
|
|
9
|
+
down_revision = "0016_crypto_key_storage_tables"
|
|
10
|
+
branch_labels = None
|
|
11
|
+
depends_on = None
|
|
12
|
+
|
|
13
|
+
TABLES = (AuthorizationServer,)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def upgrade(conn) -> None:
|
|
17
|
+
create_tables(conn, *TABLES)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def downgrade(conn) -> None:
|
|
21
|
+
drop_tables(conn, *TABLES)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""Executable DDL migration for durable policy table state."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_storage_core.migrations.helpers import create_tables, drop_tables
|
|
6
|
+
from tba_storage_core.tables import (
|
|
7
|
+
Policy,
|
|
8
|
+
PolicySet,
|
|
9
|
+
PolicySetMember,
|
|
10
|
+
PolicyTarget,
|
|
11
|
+
PolicyVersion,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
revision = "0018_policy_tables"
|
|
15
|
+
down_revision = "0017_authorization_server_table"
|
|
16
|
+
branch_labels = None
|
|
17
|
+
depends_on = None
|
|
18
|
+
|
|
19
|
+
TABLES = (Policy, PolicyVersion, PolicySet, PolicySetMember, PolicyTarget)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def upgrade(conn) -> None:
|
|
23
|
+
create_tables(conn, *TABLES)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def downgrade(conn) -> None:
|
|
27
|
+
drop_tables(conn, *TABLES)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Executable DDL migration for federation and invariant table-owned state."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_storage_core.migrations.helpers import create_tables, drop_tables
|
|
6
|
+
from tba_storage_core.tables import (
|
|
7
|
+
AuthorizationInvariant,
|
|
8
|
+
Federation,
|
|
9
|
+
FederatedSession,
|
|
10
|
+
IdentityProvider,
|
|
11
|
+
InvariantEvaluation,
|
|
12
|
+
InvariantViolation,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
revision = "0019_federation_and_invariant_tables"
|
|
16
|
+
down_revision = "0018_policy_tables"
|
|
17
|
+
branch_labels = None
|
|
18
|
+
depends_on = None
|
|
19
|
+
|
|
20
|
+
TABLES = (
|
|
21
|
+
IdentityProvider,
|
|
22
|
+
Federation,
|
|
23
|
+
FederatedSession,
|
|
24
|
+
AuthorizationInvariant,
|
|
25
|
+
InvariantEvaluation,
|
|
26
|
+
InvariantViolation,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def upgrade(conn) -> None:
|
|
31
|
+
create_tables(conn, *TABLES)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def downgrade(conn) -> None:
|
|
35
|
+
drop_tables(conn, *TABLES)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Executable DDL migration for OIDC back-channel logout replay state."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_storage_core.migrations.helpers import create_tables, drop_tables
|
|
6
|
+
from tba_storage_core.tables import BackchannelLogoutReplay
|
|
7
|
+
|
|
8
|
+
revision = "0020_backchannel_logout_replay_table"
|
|
9
|
+
down_revision = "0019_federation_and_invariant_tables"
|
|
10
|
+
branch_labels = None
|
|
11
|
+
depends_on = None
|
|
12
|
+
|
|
13
|
+
TABLES = (BackchannelLogoutReplay,)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def upgrade(conn) -> None:
|
|
17
|
+
create_tables(conn, *TABLES)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def downgrade(conn) -> None:
|
|
21
|
+
drop_tables(conn, *TABLES)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Executable DDL migration for advanced-authentication challenge state."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_storage_core.migrations.helpers import create_tables, drop_tables
|
|
6
|
+
from tba_storage_core.tables import AuthenticationChallenge
|
|
7
|
+
|
|
8
|
+
revision = "0021_authentication_challenge_table"
|
|
9
|
+
down_revision = "0020_backchannel_logout_replay_table"
|
|
10
|
+
branch_labels = None
|
|
11
|
+
depends_on = None
|
|
12
|
+
|
|
13
|
+
TABLES = (AuthenticationChallenge,)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def upgrade(conn) -> None:
|
|
17
|
+
create_tables(conn, *TABLES)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def downgrade(conn) -> None:
|
|
21
|
+
drop_tables(conn, *TABLES)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Executable DDL migration for authority and trust graph tables."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from tba_storage_core.migrations.helpers import create_tables, drop_tables
|
|
6
|
+
from tba_storage_core.tables import (
|
|
7
|
+
AuthorityDerivationGraph,
|
|
8
|
+
AuthorityDerivationGraphEdge,
|
|
9
|
+
AuthorityDerivationGraphNode,
|
|
10
|
+
TrustFederationGraph,
|
|
11
|
+
TrustFederationGraphEdge,
|
|
12
|
+
TrustFederationGraphNode,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
revision = "0022_authority_and_trust_graph_tables"
|
|
16
|
+
down_revision = "0021_authentication_challenge_table"
|
|
17
|
+
branch_labels = None
|
|
18
|
+
depends_on = None
|
|
19
|
+
|
|
20
|
+
TABLES = (
|
|
21
|
+
AuthorityDerivationGraph,
|
|
22
|
+
AuthorityDerivationGraphNode,
|
|
23
|
+
AuthorityDerivationGraphEdge,
|
|
24
|
+
TrustFederationGraph,
|
|
25
|
+
TrustFederationGraphNode,
|
|
26
|
+
TrustFederationGraphEdge,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def upgrade(conn) -> None:
|
|
31
|
+
create_tables(conn, *TABLES)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def downgrade(conn) -> None:
|
|
35
|
+
drop_tables(conn, *TABLES)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"""Add digital-artifact and explicit token-profile discriminators."""
|
|
2
|
+
|
|
3
|
+
from tba_storage_core.migrations.helpers import (
|
|
4
|
+
AUTHN_SCHEMA,
|
|
5
|
+
column_names,
|
|
6
|
+
drop_columns,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
revision = "0023_artifact_and_token_profile_discriminators"
|
|
10
|
+
down_revision = "0022_authority_and_trust_graph_tables"
|
|
11
|
+
branch_labels = None
|
|
12
|
+
depends_on = None
|
|
13
|
+
|
|
14
|
+
GROUPS = {
|
|
15
|
+
"credentials": (
|
|
16
|
+
("format", "format VARCHAR(64)"),
|
|
17
|
+
("credential_type", "credential_type VARCHAR(255)"),
|
|
18
|
+
("issuer_id", "issuer_id VARCHAR(255)"),
|
|
19
|
+
("subject_id", "subject_id VARCHAR(255)"),
|
|
20
|
+
("holder_binding_kind", "holder_binding_kind VARCHAR(64)"),
|
|
21
|
+
("status_reference", "status_reference VARCHAR(1000)"),
|
|
22
|
+
("payload_digest", "payload_digest VARCHAR(128)"),
|
|
23
|
+
("issued_at", "issued_at TIMESTAMP"),
|
|
24
|
+
("valid_from", "valid_from TIMESTAMP"),
|
|
25
|
+
("valid_until", "valid_until TIMESTAMP"),
|
|
26
|
+
),
|
|
27
|
+
"token_records": (
|
|
28
|
+
("token_profile", "token_profile VARCHAR(128)"),
|
|
29
|
+
("audience_digest", "audience_digest VARCHAR(128)"),
|
|
30
|
+
("sender_constraint_kind", "sender_constraint_kind VARCHAR(64)"),
|
|
31
|
+
("credential_or_grant_reference", "credential_or_grant_reference VARCHAR(255)"),
|
|
32
|
+
),
|
|
33
|
+
"workload_identities": (
|
|
34
|
+
("spiffe_id", "spiffe_id VARCHAR(1000)"),
|
|
35
|
+
("selector_digest", "selector_digest VARCHAR(128)"),
|
|
36
|
+
("svid_type", "svid_type VARCHAR(32)"),
|
|
37
|
+
("bundle_version", "bundle_version VARCHAR(128)"),
|
|
38
|
+
),
|
|
39
|
+
"key_attestation_evidence": (
|
|
40
|
+
("profile", "profile VARCHAR(255)"),
|
|
41
|
+
("issuer", "issuer VARCHAR(1000)"),
|
|
42
|
+
("evidence_digest", "evidence_digest VARCHAR(128)"),
|
|
43
|
+
("verification_result", "verification_result VARCHAR(64)"),
|
|
44
|
+
("valid_until", "valid_until TIMESTAMP"),
|
|
45
|
+
),
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _table(conn, name: str) -> str:
|
|
50
|
+
return f'"{AUTHN_SCHEMA}"."{name}"'
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def upgrade(conn) -> None:
|
|
54
|
+
for table, columns in GROUPS.items():
|
|
55
|
+
existing = column_names(conn, table)
|
|
56
|
+
for name, ddl in columns:
|
|
57
|
+
if name not in existing:
|
|
58
|
+
conn.exec_driver_sql(
|
|
59
|
+
f"ALTER TABLE {_table(conn, table)} ADD COLUMN {ddl}"
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def downgrade(conn) -> None:
|
|
64
|
+
for table, columns in reversed(tuple(GROUPS.items())):
|
|
65
|
+
drop_columns(conn, table, tuple(name for name, _ in columns))
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""Create credential issuer, configuration, and wallet registry tables."""
|
|
2
|
+
|
|
3
|
+
from tba_storage_core.migrations.helpers import create_tables, drop_tables
|
|
4
|
+
from tba_storage_digital_credential.tables.credential_ecosystem_registry import (
|
|
5
|
+
CredentialConfiguration,
|
|
6
|
+
CredentialIssuer,
|
|
7
|
+
WalletAttestation,
|
|
8
|
+
WalletInstance,
|
|
9
|
+
WalletKeyBinding,
|
|
10
|
+
WalletRegistration,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
revision = "0024_credential_issuer_wallet_and_configuration"
|
|
14
|
+
down_revision = "0023_artifact_and_token_profile_discriminators"
|
|
15
|
+
branch_labels = None
|
|
16
|
+
depends_on = None
|
|
17
|
+
TABLES = (
|
|
18
|
+
CredentialIssuer,
|
|
19
|
+
CredentialConfiguration,
|
|
20
|
+
WalletRegistration,
|
|
21
|
+
WalletInstance,
|
|
22
|
+
WalletAttestation,
|
|
23
|
+
WalletKeyBinding,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def upgrade(conn):
|
|
28
|
+
create_tables(conn, *TABLES)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def downgrade(conn):
|
|
32
|
+
drop_tables(conn, *TABLES)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Create credential issuance and status lifecycle tables."""
|
|
2
|
+
|
|
3
|
+
from tba_storage_core.migrations.helpers import create_tables, drop_tables
|
|
4
|
+
from tba_storage_digital_credential.tables.credential_issuance_state import (
|
|
5
|
+
CredentialDeferredTransaction,
|
|
6
|
+
CredentialIssuanceTransaction,
|
|
7
|
+
CredentialNotification,
|
|
8
|
+
CredentialOffer,
|
|
9
|
+
CredentialStatusEntry,
|
|
10
|
+
CredentialStatusList,
|
|
11
|
+
CredentialStatusPublication,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
revision = "0025_credential_issuance_and_status"
|
|
15
|
+
down_revision = "0024_credential_issuer_wallet_and_configuration"
|
|
16
|
+
branch_labels = None
|
|
17
|
+
depends_on = None
|
|
18
|
+
TABLES = (
|
|
19
|
+
CredentialOffer,
|
|
20
|
+
CredentialIssuanceTransaction,
|
|
21
|
+
CredentialDeferredTransaction,
|
|
22
|
+
CredentialNotification,
|
|
23
|
+
CredentialStatusList,
|
|
24
|
+
CredentialStatusEntry,
|
|
25
|
+
CredentialStatusPublication,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def upgrade(conn):
|
|
30
|
+
create_tables(conn, *TABLES)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def downgrade(conn):
|
|
34
|
+
drop_tables(conn, *TABLES)
|