Skip to content

Conversation

felixwatts
Copy link

@felixwatts felixwatts commented Jun 23, 2025

Currently Sqlite doesn't work:

let pool = sqlx::sqlite::SqlitePool::connect(SQLITE_DB_URL).await?;

let mut app = tide::with_state(state);

app.with(SQLxMiddleware::<Sqlite>::from(db)); // Fails because SqliteConnection isn't Send

However, by updating the SQLx package dependency from 0.5.4 to 0.8.6, the code above compiles and works.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @felixwatts, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily focuses on enabling full Sqlite support within the project by performing a significant upgrade of the sqlx database driver dependency. This change addresses a fundamental compatibility issue that previously prevented Sqlite from functioning correctly, making the project more versatile in its database connectivity options.

Highlights

  • Dependency Upgrade: Upgraded the sqlx crate dependency from version 0.5 to 0.8.6. This critical update enables proper Sqlite support by resolving issues where SqliteConnections were not Send, which was preventing Sqlite from being used with the tide-sqlx middleware.
  • Example Code Fix: Updated an example snippet within src/lib.rs to align with a breaking change in the sqlx API. Specifically, the log_statements method on PgConnectOptions now returns Self for chaining, requiring the assignment let mut connect_opts = connect_opts.log_statements(...) to ensure the example remains compilable and correct with the new sqlx version.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the sqlx dependency to a newer version to enable SQLite support. This is a good goal, but the version bump is a major one and introduces breaking changes that are not fully addressed.

I've left a critical comment on Cargo.toml regarding a breaking API change in sqlx that will prevent this library from compiling. I've also left a medium severity suggestion in a doc-test to improve code style.

Please address the breaking change to ensure the library remains buildable after this update.

[dependencies]
async-std = "1"
sqlx = "0.5"
sqlx = "0.8.6"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Updating sqlx from 0.5 to 0.8.6 is a major version bump. This likely introduces significant breaking changes to the sqlx API that are not fully addressed in this pull request, potentially leading to build failures or runtime issues. Please ensure all necessary code adaptations for the new sqlx version are included.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code builds and the tests pass.

src/lib.rs Outdated
Comment on lines 48 to 49
//! let mut connect_opts = PgConnectOptions::new();
//! connect_opts.log_statements(LevelFilter::Debug);
//! let mut connect_opts = connect_opts.log_statements(LevelFilter::Debug);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While this change is correct for the new sqlx API, it can be made more idiomatic and concise by chaining the builder methods. This also allows removing the mut keyword, as connect_opts is moved into .connect_with() on line 53 and doesn't need to be mutable.

Suggested change
//! let mut connect_opts = PgConnectOptions::new();
//! connect_opts.log_statements(LevelFilter::Debug);
//! let mut connect_opts = connect_opts.log_statements(LevelFilter::Debug);
//! let connect_opts = PgConnectOptions::new()
//! .log_statements(LevelFilter::Debug);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant