Skip to content
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

Fix sqlx-cli create, drop, migrate #2367

Merged
merged 3 commits into from
Feb 22, 2023

Conversation

cycraig
Copy link
Contributor

@cycraig cycraig commented Feb 22, 2023

Description

Fix the db create, db drop, and migrate run commands for sqlx-cli. Edit: this is for the latest changes on main for 0.7.

Fixes the following errors running those commands:

thread 'main' panicked at 'No drivers installed. Please see the documentation in sqlx::any for details.', sqlx-core/src/any/driver.rs:143:33

and

error: while executing migrations: error with configuration: SQLite driver does not support migrations or migrate feature was not enabled

Changes

  • Uncomment default and database features for sqlx-cli.
  • Install database drivers in sqlx-cli.
  • Implement AnyConnectionBackend::as_migrate for databases.

How to test or review this PR

  • Checkout this branch and install sqlx-cli.
cargo install -f --path ./sqlx-cli
  • Use the SQLite example.
cd examples/sqlite/todos
export DATABASE_URL="sqlite:${PWD}/todos.db"
  • Create the DB and run migrations, they should succeed with no errors.
sqlx db create
sqlx migrate run
  • Don't forget to reinstall the released sqlx-cli 0.6 version locally.
cargo install -f sqlx-cli

@cycraig cycraig changed the title Fix sqlx cli migrate Fix sqlx-cli create, drop, migrate Feb 22, 2023
@abonander
Copy link
Collaborator

Oh, this must mean we don't have any functionality tests for sqlx-cli, should probably fix that at some point.

@abonander abonander merged commit 9677430 into launchbadge:main Feb 22, 2023
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.

2 participants