v0.5.3-pre.003

This commit is contained in:
2026-08-12 11:00:59 +02:00
parent 8448ad1079
commit 400ced4832
313 changed files with 7773 additions and 2623 deletions

View File

@@ -1,5 +1,5 @@
// file: ks-store/src/postgres/query/health_queries.rs
// version: 3
// version: 4
//! PostgreSQL health and diagnostic SQL queries.
@@ -42,36 +42,3 @@ pub(crate) async fn load_server_version(
))),
};
}
pub(crate) async fn load_migration_table_name(
pool: &sqlx::PgPool,
) -> ks_core::Result<std::option::Option<std::string::String>> {
let query_result =
sqlx::query_scalar::<sqlx::Postgres, std::option::Option<std::string::String>>(
"SELECT to_regclass('_sqlx_migrations')::text",
)
.fetch_one(pool)
.await;
return match query_result {
std::result::Result::Ok(table_name) => std::result::Result::Ok(table_name),
std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db(format!(
"postgres migration table query failed: {error}"
))),
};
}
pub(crate) async fn load_latest_migration_version(
pool: &sqlx::PgPool,
) -> ks_core::Result<std::option::Option<std::string::String>> {
let query_result = sqlx::query_scalar::<sqlx::Postgres, std::option::Option<std::string::String>>(
"SELECT version::text FROM _sqlx_migrations WHERE success = true ORDER BY version DESC LIMIT 1",
)
.fetch_optional(pool)
.await;
return match query_result {
std::result::Result::Ok(version) => std::result::Result::Ok(version.flatten()),
std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db(format!(
"postgres latest migration query failed: {error}"
))),
};
}