From 737ccfe11c43b1ca837e10a5160e6c9651ff8cd1 Mon Sep 17 00:00:00 2001 From: Namekuji Date: Sat, 27 May 2023 03:35:09 -0400 Subject: [PATCH] remove mock database --- packages/backend/native-utils/crates/database/Cargo.toml | 6 ------ packages/backend/native-utils/crates/database/src/lib.rs | 8 -------- packages/backend/native-utils/crates/model/Cargo.toml | 3 --- 3 files changed, 17 deletions(-) diff --git a/packages/backend/native-utils/crates/database/Cargo.toml b/packages/backend/native-utils/crates/database/Cargo.toml index 4ff4da2b7b..440a76cf58 100644 --- a/packages/backend/native-utils/crates/database/Cargo.toml +++ b/packages/backend/native-utils/crates/database/Cargo.toml @@ -5,14 +5,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[features] -mock = ["sea-orm/mock"] - [dependencies] once_cell = "1.17.1" sea-orm = { version = "0.11.3", features = ["sqlx-postgres", "runtime-tokio-rustls"] } thiserror = "1.0.40" tokio = { version = "1.28.1", features = ["macros"] } - -[dev-dependencies] -sea-orm = { version = "0.11.3", features = ["sqlx-sqlite"] } diff --git a/packages/backend/native-utils/crates/database/src/lib.rs b/packages/backend/native-utils/crates/database/src/lib.rs index 756be123e0..d0e7b25770 100644 --- a/packages/backend/native-utils/crates/database/src/lib.rs +++ b/packages/backend/native-utils/crates/database/src/lib.rs @@ -6,11 +6,6 @@ use crate::error::Error; static DB_CONN: once_cell::sync::OnceCell = once_cell::sync::OnceCell::new(); -#[cfg(feature = "mock")] -static DB_MOCK: once_cell::sync::Lazy = once_cell::sync::Lazy::new(|| { - sea_orm::MockDatabase::new(sea_orm::DatabaseBackend::Postgres).into_connection() -}); - pub async fn init_database(connection_uri: impl Into) -> Result<(), Error> { let conn = Database::connect(connection_uri.into()).await?; DB_CONN.get_or_init(move || conn); @@ -18,9 +13,6 @@ pub async fn init_database(connection_uri: impl Into) -> Result<(), Erro } pub fn get_database() -> Result<&'static DatabaseConnection, Error> { - #[cfg(feature = "mock")] - return Ok(&DB_MOCK); - #[cfg(not(feature = "mock"))] DB_CONN.get().ok_or(Error::Uninitialized) } diff --git a/packages/backend/native-utils/crates/model/Cargo.toml b/packages/backend/native-utils/crates/model/Cargo.toml index 63f53c6306..87f712aa7e 100644 --- a/packages/backend/native-utils/crates/model/Cargo.toml +++ b/packages/backend/native-utils/crates/model/Cargo.toml @@ -20,6 +20,3 @@ thiserror = "1.0.40" tokio = { version = "1.28.1", features = ["sync"] } util = { path = "../util" } utoipa = "3.3.0" - -[dev-dependencies] -database = { path = "../database", features = ["mock"] }