mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-03 01:40:21 +08:00
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:
@@ -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;
|
||||
|
||||
1756
crates/aether-data/src/repository/provider_catalog/mysql.rs
Normal file
1756
crates/aether-data/src/repository/provider_catalog/mysql.rs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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",)
|
||||
1875
crates/aether-data/src/repository/provider_catalog/sqlite.rs
Normal file
1875
crates/aether-data/src/repository/provider_catalog/sqlite.rs
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user