On `PoolOptions::connect()`, we open at least `min_connections`
connections, or 1 if unset. Therefore, the expression needs to be
`max()`. (`min(1, x)` would mean we always open only a single
connection).
With MariaDB 10.3 EOL it seems prudent to include
the latest 10.11 LTS release in the CI tests.
To catch #1664 sort of issues prior to release, add
a container image test for mariadb that contains the
finished pre-release code changes (and container changes)
to ensure that compatibilty is maintianed. When
server code hits the branch associated with this tag
it is considered finished by its server developers and
has passes CI so no regressions are expected, but
it wouldn't hurt to have CI in other systems testing
it too.
Since MySQL has fixed the regression that caused #1664
this puts it back to their 8.0 release tag.
Append the :z tag to the docker compose volume mounts
so on selinux systems enough permissions occur for the
volume to be able to read the volume contents.
* fix(postgres): sqlx prepare fails if shared_preload_libraries=pg_stat_statements
closes#2622
refs:
* https://serde.rs/enum-representations.html#untagged
* https://serde.rs/field-attrs.html#skip
* https://www.postgresql.org/docs/current/pgstatstatements.html
* https://www.postgresql.org/docs/current/runtime-config-statistics.html#GUC-COMPUTE-QUERY-ID
* fix(postgres): regression of #1449
```
error: error occurred while decoding column 0: data did not match any variant of untagged enum Explain at line 3 column 1
Error: --> tests/postgres/macros.rs:103:15
|
103 | let row = sqlx::query!(r#"CALL forty_two(null)"#)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)
error: could not compile `sqlx` (test "postgres-macros") due to previous error
```
* refactor(postgres): don't define unused fields in QueryPlan
* refactor(postgres): simplify query plan handling, add unit test
* chore: document why we load `pg_stat_statements` in tests
---------
Co-authored-by: mrl5 <31549762+mrl5@users.noreply.github.com>
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
* Implement Clone for PoolOptions manually (#2548)
Trying to derive `Clone` automatically for `PoolOptions` results
in errors when `clone` is actually called. This is because the
derive incorrectly determines that `Clone` is _not_ derivable
due to the lack of `Clone` implementation on the `DB: Database`
type parameter, even though no value of that type is actually
stored in a to-be-cloned position (in fact, it's only used for
the `Connection` associated type on the type parameter's
`Database` trait impl).
Manually implementing `Clone` side-steps this issue and insures
the type is always actually cloneable.
For reference: https://github.com/launchbadge/sqlx/issues/2548
* Ran 'cargo fmt'
* Simplified Arc cloning
The documentation for `PgAdvisoryLockGuard` lists a set of types
that should be able to be passed to it, but when actually trying
to do so, compilation would fail due to missing `AsMut` trait
implementations for those types. This commit adds the missing
`AsMut` impls so that `Transaction` and `PgConnection` can be used
as type parameters to `PgAdvisoryLockGuard`, as expected.
For reference: https://github.com/launchbadge/sqlx/issues/2520
* sqlx-macros-core: Add handling of the 'DATE' pseudo-type in in the sqlite library.
Presently this only functions for the `time` feature, because I don't use the `chrono` feature.
* Update sqlite.rs
Add chrono date support.
* Update sqlite.rs
rustfmt
* Update sqlite.rs
Switch order of time::OffsetDateTime and time::PrimitiveDateTime.
* Exposing the Oid of PostgreSQL types
* Do not panic if OID is not set
* Update sqlx-postgres/src/type_info.rs
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
* cargo fmt
---------
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>