mirror of
https://git.alemi.dev/guestbook.rs.git
synced 2024-12-19 02:54:52 +01:00
fix: only do checks for included drivers
This commit is contained in:
parent
6daf50a81e
commit
632a4a179c
1 changed files with 6 additions and 0 deletions
|
@ -54,9 +54,15 @@ impl StorageProvider {
|
||||||
let db = sqlx::AnyPool::connect(dest).await?;
|
let db = sqlx::AnyPool::connect(dest).await?;
|
||||||
|
|
||||||
match db.acquire().await?.backend_name() {
|
match db.acquire().await?.backend_name() {
|
||||||
|
#[cfg(feature = "postgres")]
|
||||||
sqlx::Postgres::NAME => { sqlx::query(POSTGRES_SCHEMA).execute(&db).await?; },
|
sqlx::Postgres::NAME => { sqlx::query(POSTGRES_SCHEMA).execute(&db).await?; },
|
||||||
|
|
||||||
|
#[cfg(feature = "sqlite")]
|
||||||
sqlx::Sqlite::NAME => { sqlx::query(SQLITE_SCHEMA).execute(&db).await?; },
|
sqlx::Sqlite::NAME => { sqlx::query(SQLITE_SCHEMA).execute(&db).await?; },
|
||||||
|
|
||||||
|
#[cfg(feature = "mysql")]
|
||||||
sqlx::MySql::NAME => { sqlx::query(SQLITE_SCHEMA).execute(&db).await?; }, // TODO will this work?
|
sqlx::MySql::NAME => { sqlx::query(SQLITE_SCHEMA).execute(&db).await?; }, // TODO will this work?
|
||||||
|
|
||||||
_ => tracing::warn!("could not ensure schema: unsupported database type"),
|
_ => tracing::warn!("could not ensure schema: unsupported database type"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue