athena_rs 3.18.0

Hyper performant polyglot Database driver
Documentation
//! `/schema/migrations` catalog HTTP handler.
//!
//! This module owns pool resolution and response orchestration for the schema
//! migrations endpoint.

use actix_web::{HttpRequest, Responder, get, web::Data};

use crate::AppState;

use super::super::catalog_migration_response::schema_migrations_response;
use super::super::catalog_route_context::require_schema_pool;

/// Lists migrations from `supabase_migrations.schema_migrations` when available.
#[get("/schema/migrations")]
pub(in super::super) async fn schema_migrations(
    req: HttpRequest,
    app_state: Data<AppState>,
) -> impl Responder {
    let pool = match require_schema_pool(&req, app_state.get_ref()).await {
        Ok(pool) => pool,
        Err(resp) => return resp,
    };

    schema_migrations_response(&pool).await
}