* Updated ahash so it can compile on mac
* Updated MigrateDatabase Trait + related functions
* Postgres force drop database flag impl
* Update migrate.rs
* Reverted MigrateDatabase Trait
* Update migrate.rs
* Update migrate.rs
* Added force drop database fn impl
* Add Migrate Error
* Fixed changed function name
* feat(cli): do not require db url
* chore: remove unused import
* fix(cli): do not always pass DATABASE_URL
* fix(cli): check db when DATABASE_URL is provided
Inlined format args make code more readable, and code more compact.
I ran this clippy command to fix most cases, and then cleaned up a few trailing commas and uncaught edge cases.
```
cargo clippy --bins --examples --benches --tests --lib --workspace --fix -- -A clippy::all -W clippy::uninlined_format_args
```
* cli: add --target-version CLI flags for migrate run/revert
* cli: fix broken test
* cli: test harness for `sqlx migrate` along with --target-version tests
* cli: Fail if version supplied to run/revert is too old/new
After some discussion with my coworkers, we thought about the behavior a bit more:
The behavior is now that for a run, if the provided version is too old, the CLI
will return with failure rather than being a no-op. This gives feedback to the
operator instead of being quiet.
It is still valid to up/downgrade to the latest version, this will still be a no-op
to allow for idempotency.
* Support naming migrations sequentially and inferring naming scheme
* Document new options and how naming is inferred
* Only account for up migrations when inferring ordering
* Separate offline query metadata per crate
* Update sqlx-cli prepare to use separate query metadata per crate
* Add resolve.root to metadata test fixture
* Simplify root package resolution
* Fix prepare --merged
This fixes:
```
error[E0616]: field `target_directory` of struct `metadata::Metadata` is private
--> sqlx-cli/src/prepare.rs:175:47
|
175 | .env("CARGO_TARGET_DIR", metadata.target_directory.clone())
| ^^^^^^^^^^^^^^^^ private field
|
help: a method `target_directory` also exists, call it with parentheses
|
175 | .env("CARGO_TARGET_DIR", metadata.target_directory().clone())
| ++
```
* Move compiled query data
I did try to set rustc's --out-dir but encountered a strange error
stating that it can not be set more than once (even though I am unable
to deduce what else is setting it).
This enabled me to set a custom CARGO_TARGET_DIR and still be able to
prepare queries.
* Set CARGO_TARGET_DIR in the rustc invocation
* refactor(sqlx-cli): Try avoiding a full clean with `--merged`
* docs(sqlx-cli): Sprinkle some comments on the metadata changes
* refactor(sqlx-cli): Make the new recompiltion setup unit-testable
* fix(sqlx-cli): Only pass in `$RUSTFLAGS` when set when using `--merged`
* refactor(sqlx-cli): `cargo clean -p` works by name so rip out pkgid code
* chore(sqlx-cli): Remove unused imports
* use direct blocking calls for SQLite in `sqlx_macros`
* this also ensures the database is closed properly, cleaning up tempfiles
* don't send `PRAGMA journal_mode` unless set
* this previously defaulted to WAL mode which is a permanent setting
on databases which doesn't necessarily apply to all use-cases
* changing into or out of WAL mode acquires an exclusive lock on the database
that can't be waited on by `sqlite3_busy_timeout()`
* for consistency, `sqlx-cli` commands that create databases will still
create SQLite databases in WAL mode; added a flag to disable this.
* in general, don't send `PRAGMA`s unless different than default
* we were sending a bunch of `PRAGMA`s with their default values just to enforce
an execution order on them, but we can also do this by inserting empty slots
for their keys into the `IndexMap`
* add error code to `SqliteError` printout
* document why `u64` is not supported
When running `sqlx migrate info`, the applied migrations checksums are
compared against the checksums of the local migration files. While the
checksums of applied migrations are stored correctly in the database as
sha384sum values, the `migrate info` command was incorrectly comparing
these against the checksums of down-migrations in cases where reversible
migrations are being used (e.g. when migrations end in `.up.sql` and
`.down.sql`).
This fixes the issue by skipping over any migrations with the
`MigrationType::ReversibleDown` type, using the same idiom as is used
when running migrations (with `migrate run`).
Issue introduced in #1680
Partially resolves#1158
From a formatting perspective, `Usage` is currently nested under `Install`. I think these would appropriately be siblings. This has the side benefit of making the headings under `Usage` more visually distinct from the rest of the content which I think makes it easier to read.
Sometimes people do a bad job of reading comprehension (see #1813). This rewords a little to be even more prescriptive about how to build in offline mode.
* fix(cli): change new `rustls` and `native-tls` features to use correct runtime feature
* chore: upgrade SQLx crates to 0.5.10, upgrade all dependencies to latest versions
chore(cli): upgraded `clap` to `3.0.0-rc.9`
* fix(tests/sqlite): ignore `issue_1467()` as spuriously failing
I'm well aware of the principle that a spuriously failing test is a failing test, but even though I have it outputting the seed used with a reproducible PRNG, I can't reproduce the failures locally, so 🤷.
* chore: add CHANGELOG entry for 0.5.10