Skip to content

Compile-time support for external drivers #3889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sqlx-cli/src/bin/cargo-sqlx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ enum Cli {
async fn main() {
sqlx_cli::maybe_apply_dotenv();

sqlx::any::install_default_drivers();

let Cli::Sqlx(opt) = Cli::parse();

if let Err(error) = sqlx_cli::run(opt).await {
Expand Down
2 changes: 2 additions & 0 deletions sqlx-cli/src/bin/sqlx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ async fn main() {
// Checks for `--no-dotenv` before parsing.
sqlx_cli::maybe_apply_dotenv();

sqlx::any::install_default_drivers();

let opt = Opt::parse();

// no special handling here
Expand Down
2 changes: 0 additions & 2 deletions sqlx-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ where
F: FnMut(&'a str) -> Fut,
Fut: Future<Output = sqlx::Result<T>> + 'a,
{
sqlx::any::install_default_drivers();

let db_url = opts.required_db_url()?;

backoff::future::retry(
Expand Down
1 change: 1 addition & 0 deletions sqlx-macros-core/src/database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub struct CachingDescribeBlocking<DB: DatabaseExt> {

#[allow(dead_code)]
impl<DB: DatabaseExt> CachingDescribeBlocking<DB> {
#[allow(clippy::new_without_default, reason = "internal API")]
pub const fn new() -> Self {
CachingDescribeBlocking {
connections: Lazy::new(|| Mutex::new(HashMap::new())),
Expand Down
2 changes: 1 addition & 1 deletion sqlx-macros-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub type Error = Box<dyn std::error::Error>;
pub type Result<T> = std::result::Result<T, Error>;

mod common;
mod database;
pub mod database;

#[cfg(feature = "derive")]
pub mod derives;
Expand Down
Loading