athena_rs 3.26.2

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::schema_backend::require_schema_backend;

/// 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 backend = match require_schema_backend(&req, app_state.get_ref()).await {
        Ok(backend) => backend,
        Err(resp) => return resp,
    };

    schema_migrations_response(&backend, app_state.get_ref()).await
}