Skip to main content

upgrade_data_lake_schema_v5

Function upgrade_data_lake_schema_v5 

Source
pub async fn upgrade_data_lake_schema_v5(
    tr: &mut Transaction<'_, Postgres>,
) -> Result<(), Error>
Expand description

Upgrades the data lake schema to version 5. Adds ingestion_api_keys and analytics_api_keys, the DB-backed API key store: a key_id UUID primary key (a non-secret handle for DELETE/GET, distinct from the key_hash lookup value), a SHA-256 key_hash with a unique index for O(1) validation lookups, and a created_at/created_by/last_used_at/ revoked_at/revoked_by audit trail. The two tables are identical in shape but deliberately separate (never a shared scopes column) so an ingestion (write) key can never double as an analytics (read) credential.