* feat: create `sqlx.toml` format
* feat: add support for ignored_chars config to sqlx_core::migrate
* chore: test ignored_chars with `U+FEFF` (ZWNBSP/BOM)
https://en.wikipedia.org/wiki/Byte_order_mark
* refactor: make `Config` always compiled
simplifies usage while still making parsing optional for less generated code
* refactor: add origin information to `Column`
* feat(macros): implement `type_override` and `column_override` from `sqlx.toml`
* refactor(sqlx.toml): make all keys kebab-case, create `macros.preferred-crates`
* feat: make macros aware of `macros.preferred-crates`
* feat: make `sqlx-cli` aware of `database-url-var`
* feat: teach macros about `migrate.table-name`, `migrations-dir`
* feat: teach macros about `migrate.ignored-chars`
* chore: delete unused source file `sqlx-cli/src/migration.rs`
* feat: teach `sqlx-cli` about `migrate.defaults`
* feat: teach `sqlx-cli` about `migrate.migrations-dir`
* feat: teach `sqlx-cli` about `migrate.table-name`
* feat: introduce `migrate.create-schemas`
* WIP feat: create multi-tenant database example
* fix(postgres): don't fetch `ColumnOrigin` for transparently-prepared statements
* feat: progress on axum-multi-tenant example
* feat(config): better errors for mislabeled fields
* WIP feat: filling out axum-multi-tenant example
* feat: multi-tenant example
No longer Axum-based because filling out the request routes would have distracted from the purpose of the example.
* chore(ci): test multi-tenant example
* fixup after merge
* fix(ci): enable `sqlx-toml` in CLI build for examples
* fix: CI, README for `multi-tenant`
* fix: clippy warnings
* fix: multi-tenant README
* fix: sequential versioning inference for migrations
* fix: migration versioning with explicit overrides
* fix: only warn on ambiguous crates if the invocation relies on it
* fix: remove unused imports
* fix: doctest
* fix: `sqlx mig add` behavior and tests
* fix: restore original type-checking order
* fix: deprecation warning in `tests/postgres/macros.rs`
* feat: create postgres/multi-database example
* fix: examples/postgres/multi-database
* fix: cargo fmt
* chore: add tests for config `migrate.defaults`
* fix: sqlx-cli/tests/add.rs
* feat(cli): add `--config` override to all relevant commands
* chore: run `sqlx mig add` test with `RUST_BACKTRACE=1`
* fix: properly canonicalize config path for `sqlx mig add` test
* fix: get `sqlx mig add` test passing
* fix(cli): test `migrate.ignored-chars`, fix bugs
* feat: create `macros.preferred-crates` example
* fix(examples): use workspace `sqlx`
* fix: examples
* fix(sqlite): unexpected feature flags in `type_checking.rs`
* fix: run `cargo fmt`
* fix: more example fixes
* fix(ci): preferred-crates setup
* fix(examples): enable default-features for workspace `sqlx`
* fix(examples): issues in `preferred-crates`
* chore: adjust error message for missing param type in `query!()`
* doc: mention new `sqlx.toml` configuration
* chore: add `CHANGELOG` entry
Normally I generate these when cutting the release, but I wanted to take time to editorialize this one.
* doc: fix new example titles
* refactor: make `sqlx-toml` feature non-default, improve errors
* refactor: eliminate panics in `Config` read path
* chore: remove unused `axum` dependency from new examples
* fix(config): restore fallback to default config for macros
* chore(config): remove use of `once_cell` (to match `main`)
* Add a "sqlite-unbundled" feature that dynamically links to system libsqlite3.so library
* update README abouot the newly-added `sqlite-unbundled` feature
* Update README.md to make it clear with bulleted list
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
* more cfg feature updates
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
* update documentation in sqlx-sqlx/src/lib.rs too
and also mention possible build time increasement.
* cargo fmt
* Add "sqlite-unbundled" feature to sqlx-cli
* Add sqlite-unbundled to gituhb actions tests
* cfg(feature = "sqlite") => cfg(any(feature = "sqlite", feature = "sqlite-unbundled"))
* fix
* CI: make sqlite-unbundled tests workaround required-features
by duplicating the relevant test section
* use an internal "_sqlite" feature to do the conditional compilation
---------
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
Problem: PgHasArrayType was checking the application's postgres feature
Solution: only check the library's postgres feature
Co-authored-by: Daniel Tashjian <daniel@ecomedes.com>
Given a generic type like `A<B>` before `sqlx` would produce
`A<B>::from_row(row)` which is invalid syntax.
Now it produces `<A<B> as ::sqlx::FromRow<'a, R>>`.
This also fixes a bug for non-generic types where an inherent method
might have been called instead of the `::sqlx::FromRow::from_row` method
because UFCS wasn't used.
* 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
When the `#[sqlx::test]` macro is imported using `#[macro_use]` such as
in the following example:
```rust
extern crate sqlx;
mod tests {
#[test]
fn something() {}
}
```
then the `#[test]` generated by the macro will refer to itself instead
of the standard Rust `#[test]` macro. This will cause `rustc` to
recursively expand it and produce the following error message:
```
thread 'rustc' has overflowed its stack
fatal runtime error: stack overflow
```
Instead, we can just refer to the standard macro by using its fully
qualified path.
This PR:
* Swaps `#[test]` usages in `#[sqlx::test]` for their hygenic path to
prevent recursive expansion alongside `#[macro_use]`
Closes#2017.
* 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
* refactor: Reuse a cached connection instead of always recreating for `sqlx-macros`
* fix: Fix type inference issue when no database features used
* refactor: Switch cached db conn to an `AnyConnection`
* fix: Fix invalid variant name only exposed with features
* fix: Tweak connection options for SQLite with `sqlx-macros`
* fix: Remove read only option for SQLite connection
* fix: Fix feature flags regarding usage of `sqlx_core::any`
* postgres: use Oid type instead of u32
* Make serde happy
* Expose the inner u32
* docs
* Try to fix tests
* Fix unit tests
* Fix order
* Not sure what happened here
* 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