Add multi-database data layer

Introduce aether-data-schema and driver-specific schema generation for Postgres, MySQL, and SQLite.

Split data backends, lifecycle, repositories, and gateway runtime integration across database drivers.

Verified with cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, and cargo test --workspace.
This commit is contained in:
fawney19
2026-05-05 18:27:36 +08:00
parent 099653f732
commit fce7e959e5
372 changed files with 86217 additions and 21160 deletions

View File

@@ -1,5 +1,7 @@
mod memory;
mod sql;
mod mysql;
mod postgres;
mod sqlite;
#[allow(unused_imports)]
pub(crate) use aether_data_contracts::repository::provider_catalog::{
@@ -8,4 +10,6 @@ pub(crate) use aether_data_contracts::repository::provider_catalog::{
StoredProviderCatalogKeyPage, StoredProviderCatalogKeyStats, StoredProviderCatalogProvider,
};
pub use memory::InMemoryProviderCatalogReadRepository;
pub use sql::SqlxProviderCatalogReadRepository;
pub use mysql::MysqlProviderCatalogReadRepository;
pub use postgres::SqlxProviderCatalogReadRepository;
pub use sqlite::SqliteProviderCatalogReadRepository;

File diff suppressed because it is too large Load Diff

View File

@@ -2525,7 +2525,7 @@ fn map_key_row(row: &PgRow) -> Result<StoredProviderCatalogKey, DataLayerError>
#[cfg(test)]
mod tests {
use super::SqlxProviderCatalogReadRepository;
use crate::postgres::{PostgresPoolConfig, PostgresPoolFactory};
use crate::driver::postgres::{PostgresPoolConfig, PostgresPoolFactory};
#[tokio::test]
async fn repository_constructs_from_lazy_pool() {
@@ -2567,7 +2567,7 @@ mod tests {
assert!(sql.contains("concurrent_limit"));
}
let source = include_str!("sql.rs");
let source = include_str!("postgres.rs");
assert!(source.contains("concurrent_limit,"));
assert!(source.contains("concurrent_limit = $13"));
assert!(source.contains(".bind(key.concurrent_limit)"));
@@ -2577,7 +2577,7 @@ mod tests {
#[test]
fn provider_api_keys_concurrent_limit_schema_is_nullable_without_default() {
let migration = include_str!(
"../../../migrations/20260502000000_add_provider_key_auth_channel_mismatch_formats.sql"
"../../../migrations/postgres/20260502000000_add_provider_key_auth_channel_mismatch_formats.sql"
);
let concurrent_limit_line = migration
.lines()
@@ -2589,7 +2589,7 @@ mod tests {
"add column if not exists concurrent_limit integer;"
);
let baseline = include_str!("../../../bootstrap/20260413020000_baseline_v2.sql");
let baseline = crate::lifecycle::bootstrap::postgres::EMPTY_DATABASE_SNAPSHOT_SQL;
assert!(baseline.contains("CREATE TABLE IF NOT EXISTS public.provider_api_keys"));
assert!(baseline.contains("concurrent_limit integer,"));
}
@@ -2603,7 +2603,7 @@ mod tests {
assert!(sql.contains("allow_auth_channel_mismatch_formats"));
}
let source = include_str!("sql.rs");
let source = include_str!("postgres.rs");
assert!(
source
.matches("auth_type_by_format,\n allow_auth_channel_mismatch_formats,\n api_key",)

File diff suppressed because it is too large Load Diff