mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 06:24:16 +00:00
0.7.0 release (#2575)
* WIP preparing 0.7.0 release * fix: re-enable examples * fix doctests in `sqlx-core` * cherry-pick CHANGELOG entry for 0.6.3 * add actions workflow for examples * fix(cli): close connection after running migrations * fix examples * fix(sqlite): fix parsing of URLs via `Any` * fix(example): don't let Postgres `listen` example run forever * fix Postgres `transaction` example
This commit is contained in:
parent
1bdbedabdc
commit
dcb58b0e2c
26 changed files with 1392 additions and 107 deletions
282
.github/workflows/examples.yml
vendored
Normal file
282
.github/workflows/examples.yml
vendored
Normal file
|
@ -0,0 +1,282 @@
|
|||
name: Examples
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- '*-dev'
|
||||
|
||||
jobs:
|
||||
sqlx-cli:
|
||||
name: Build SQLx CLI
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
with:
|
||||
key: sqlx-cli
|
||||
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: build
|
||||
args: >
|
||||
-p sqlx-cli
|
||||
--bin sqlx
|
||||
--release
|
||||
--no-default-features
|
||||
--features mysql,postgres,sqlite
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: sqlx-cli
|
||||
path: target/release/sqlx
|
||||
|
||||
mysql:
|
||||
name: MySQL Examples
|
||||
runs-on: ubuntu-latest
|
||||
needs: sqlx-cli
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:latest
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
ports:
|
||||
- 3306:3306
|
||||
|
||||
steps:
|
||||
- name: Get SQLx-CLI
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: sqlx-cli
|
||||
# $HOME is interpreted differently by the shell
|
||||
path: /home/runner/.local/bin
|
||||
|
||||
- run: |
|
||||
ls -R /home/runner/.local/bin
|
||||
chmod +x /home/runner/.local/bin/sqlx
|
||||
echo /home/runner/.local/bin >> $GITHUB_PATH
|
||||
sleep 10
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
with:
|
||||
key: mysql-examples
|
||||
|
||||
- name: Todos (Setup)
|
||||
working-directory: examples/mysql/todos
|
||||
env:
|
||||
DATABASE_URL: mysql://root:password@localhost:3306/todos?ssl-mode=disabled
|
||||
run: sqlx db setup
|
||||
|
||||
- name: Todos (Run)
|
||||
uses: actions-rs/cargo@v1
|
||||
env:
|
||||
DATABASE_URL: mysql://root:password@localhost:3306/todos?ssl-mode=disabled
|
||||
with:
|
||||
# TODO: test full CLI
|
||||
command: run
|
||||
args: -p sqlx-example-mysql-todos
|
||||
|
||||
postgres:
|
||||
name: PostgreSQL Examples
|
||||
runs-on: ubuntu-latest
|
||||
needs: sqlx-cli
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:latest
|
||||
env:
|
||||
POSTGRES_PASSWORD: password
|
||||
ports:
|
||||
- 5432:5432
|
||||
|
||||
steps:
|
||||
- name: Get SQLx-CLI
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: sqlx-cli
|
||||
path: /home/runner/.local/bin
|
||||
|
||||
- run: |
|
||||
ls -R /home/runner/.local/bin
|
||||
chmod +x $HOME/.local/bin/sqlx
|
||||
echo $HOME/.local/bin >> $GITHUB_PATH
|
||||
sleep 10
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
with:
|
||||
key: pg-examples
|
||||
|
||||
- name: Axum Social with Tests (Setup)
|
||||
working-directory: examples/postgres/axum-social-with-tests
|
||||
env:
|
||||
DATABASE_URL: postgres://postgres:password@localhost:5432/axum-social
|
||||
run: sqlx db setup
|
||||
|
||||
- name: Axum Social with Tests (Check)
|
||||
uses: actions-rs/cargo@v1
|
||||
env:
|
||||
DATABASE_URL: postgres://postgres:password@localhost:5432/axum-social
|
||||
with:
|
||||
command: check
|
||||
args: -p sqlx-example-postgres-axum-social
|
||||
|
||||
- name: Axum Social with Tests (Test)
|
||||
uses: actions-rs/cargo@v1
|
||||
env:
|
||||
DATABASE_URL: postgres://postgres:password@localhost:5432/axum-social
|
||||
with:
|
||||
command: test
|
||||
args: -p sqlx-example-postgres-axum-social
|
||||
|
||||
- name: Files (Setup)
|
||||
working-directory: examples/postgres/files
|
||||
env:
|
||||
DATABASE_URL: postgres://postgres:password@localhost:5432/files
|
||||
run: sqlx db setup
|
||||
|
||||
- name: Files (Run)
|
||||
uses: actions-rs/cargo@v1
|
||||
env:
|
||||
DATABASE_URL: postgres://postgres:password@localhost:5432/files
|
||||
with:
|
||||
command: run
|
||||
args: -p sqlx-example-postgres-files
|
||||
|
||||
- name: JSON (Setup)
|
||||
working-directory: examples/postgres/json
|
||||
env:
|
||||
DATABASE_URL: postgres://postgres:password@localhost:5432/json
|
||||
run: sqlx db setup
|
||||
|
||||
- name: JSON (Run)
|
||||
uses: actions-rs/cargo@v1
|
||||
env:
|
||||
DATABASE_URL: postgres://postgres:password@localhost:5432/json
|
||||
with:
|
||||
command: run
|
||||
args: -p sqlx-example-postgres-json
|
||||
|
||||
- name: Listen (Setup)
|
||||
working-directory: examples/postgres/listen
|
||||
env:
|
||||
DATABASE_URL: postgres://postgres:password@localhost:5432/listen
|
||||
run: sqlx db create
|
||||
|
||||
- name: Listen (Run)
|
||||
uses: actions-rs/cargo@v1
|
||||
env:
|
||||
DATABASE_URL: postgres://postgres:password@localhost:5432/listen
|
||||
with:
|
||||
command: run
|
||||
args: -p sqlx-example-postgres-listen
|
||||
|
||||
- name: Mockable TODOs (Setup)
|
||||
working-directory: examples/postgres/mockable-todos
|
||||
env:
|
||||
DATABASE_URL: postgres://postgres:password@localhost:5432/mockable-todos
|
||||
run: sqlx db setup
|
||||
|
||||
- name: Mockable TODOs (Run)
|
||||
uses: actions-rs/cargo@v1
|
||||
env:
|
||||
DATABASE_URL: postgres://postgres:password@localhost:5432/mockable-todos
|
||||
with:
|
||||
# TODO: test full CLI
|
||||
command: run
|
||||
args: -p sqlx-example-postgres-mockable-todos
|
||||
|
||||
- name: TODOs (Setup)
|
||||
working-directory: examples/postgres/todos
|
||||
env:
|
||||
DATABASE_URL: postgres://postgres:password@localhost:5432/todos
|
||||
run: sqlx db setup
|
||||
|
||||
- name: TODOs (Run)
|
||||
uses: actions-rs/cargo@v1
|
||||
env:
|
||||
DATABASE_URL: postgres://postgres:password@localhost:5432/todos
|
||||
with:
|
||||
# TODO: test full CLI
|
||||
command: run
|
||||
args: -p sqlx-example-postgres-todos
|
||||
|
||||
- name: Transaction (Setup)
|
||||
working-directory: examples/postgres/transaction
|
||||
env:
|
||||
DATABASE_URL: postgres://postgres:password@localhost:5432/txn
|
||||
run: sqlx db setup
|
||||
|
||||
- name: Transaction (Run)
|
||||
uses: actions-rs/cargo@v1
|
||||
env:
|
||||
DATABASE_URL: postgres://postgres:password@localhost:5432/txn
|
||||
with:
|
||||
command: run
|
||||
args: -p sqlx-example-postgres-transaction
|
||||
|
||||
sqlite:
|
||||
name: SQLite Examples
|
||||
runs-on: ubuntu-latest
|
||||
needs: sqlx-cli
|
||||
|
||||
steps:
|
||||
- name: Get SQLx-CLI
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: sqlx-cli
|
||||
path: /home/runner/.local/bin
|
||||
|
||||
- run: |
|
||||
ls -R /home/runner/.local/bin
|
||||
chmod +x /home/runner/.local/bin/sqlx
|
||||
echo /home/runner/.local/bin >> $GITHUB_PATH
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
with:
|
||||
key: sqlite-examples
|
||||
|
||||
- name: TODOs (Setup)
|
||||
env:
|
||||
DATABASE_URL: sqlite://todos.sqlite
|
||||
run: sqlx db setup --source=examples/sqlite/todos/migrations
|
||||
|
||||
- name: TODOs (Run)
|
||||
uses: actions-rs/cargo@v1
|
||||
env:
|
||||
DATABASE_URL: sqlite://todos.sqlite
|
||||
with:
|
||||
command: run
|
||||
args: -p sqlx-example-sqlite-todos
|
267
CHANGELOG.md
267
CHANGELOG.md
|
@ -5,6 +5,229 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## 0.7.0 - 2023-06-30
|
||||
|
||||
At least **70 pull requests** were merged this release cycle! (The exact count is muddied with pull requests for alpha
|
||||
releases and such.) And we gained 43 new contributors! Thank you to everyone who helped make this release a reality.
|
||||
|
||||
### Breaking
|
||||
Many revisions were made to query analysis in the SQLite driver; these are all potentially breaking changes
|
||||
as they can change the output of `sqlx::query!()` _et al_. We'd like to thank [[@tyrelr]] for their numerous PRs to
|
||||
this area.
|
||||
|
||||
The MSSQL driver has been removed as it was not nearly at the same maturity level as the other drivers.
|
||||
[As previously announced][sqlx-pro], we have plans to introduce a fully featured replacement as a premium offering,
|
||||
alongside drivers for other proprietary databases, with the goal to support full-time development on SQLx.
|
||||
|
||||
If interested, please email your inquiry to sqlx@launchbadge.com.
|
||||
|
||||
The offline mode for the queries has been changed to use a separate file per `query!()` invocation,
|
||||
which is intended to reduce the number of conflicts when merging branches in a project that both modified queries.
|
||||
See [[#2363]] for details.
|
||||
|
||||
The type ascription override syntax for the query macros has been deprecated,
|
||||
as parse support for it has been removed in `syn 2.0`, which we'll be upgrading to in the next breaking release.
|
||||
This can be replaced with type overrides using casting syntax (`as`).
|
||||
See [[#2483]] for details.
|
||||
|
||||
* [[#1946]]: Fix compile time verification performance regression for sqlite [[@liningpan]]
|
||||
* [[#1960]]: Fix sqlite update return and order by type inference [[@tyrelr]]
|
||||
* [[#1984]]: Sqlite EXPLAIN type inference improvements [[@rongcuid]]
|
||||
* [[#2039]]: Break drivers out into separate crates, clean up some technical debt [[@abonander]]
|
||||
* [[#2109]]: feat: better database errors [[@saiintbrisson]]
|
||||
* [[#2094]]: Update libsqlite3-sys to 0.25.1 [[@penberg]]
|
||||
* Alongside this upgrade, we are now considering the linkage to `libsqlite3-sys` to be **semver-exempt**,
|
||||
and we reserve the right to upgrade it as necessary. If you are using `libsqlite3-sys` directly or a crate that
|
||||
links it such as `rusqlite`, you should pin the versions of both crates to avoid breakages from `cargo update`:
|
||||
```toml
|
||||
[dependencies]
|
||||
sqlx = { version = "=0.7.0", features = ["sqlite"] }
|
||||
rusqlite = "=0.29.0"
|
||||
```
|
||||
* [[#2132]]: fix: use owned Builder pattern for ConnectOptions [[@ar3s3ru]]
|
||||
* [[#2253]]: Sqlite describe fixes [[@tyrelr]]
|
||||
* [[#2285]]: `time`: Assume UTC when decoding a DATETIME column in sqlite [[@nstinus]]
|
||||
* [[#2363]]: [offline] Change prepare to one-file-per-query [[@cycraig]]
|
||||
* [[#2387]]: PATCH: bump libsqlite3-sys to patched version [[@grantkee]]
|
||||
* [[#2409]]: fix(#2407): respect the HaltIfNull opcode when determining nullability [[@arlyon]]
|
||||
* [[#2459]]: limit the number of instructions that can be evaluated [[@tyrelr]]
|
||||
* [[#2467]]: Add and improve sqlite describe performance benchmarks [[@tyrelr]]
|
||||
* [[#2491]]: sqlite date macro support [[@Arcayr]]
|
||||
* Changes `OffsetDateTime` to be the first type used when deserializing a `timestamp` type.
|
||||
* [[#2496]]: Bump to libsqlite3-sys 0.26 [[@mdecimus]]
|
||||
* [[#2508]]: Sqlite analytical [[@tyrelr]]
|
||||
|
||||
|
||||
### Added
|
||||
* [[#1850]]: Add client SSL authentication using key-file for Postgres, MySQL and MariaDB [[@ThibsG]]
|
||||
* [[#2088]]: feat: Add set_connect_options method to Pool [[@moatra]]
|
||||
* [[#2113]]: Expose PoolOptions for reading [[@FSMaxB]]
|
||||
* [[#2115]]: Allow using complex types in `try_from` when deriving `FromRow` [[@95ulisse]]
|
||||
* [[#2116]]: [SQLite] Add option to execute `PRAGMA optimize;` on close of a connection [[@miles170]]
|
||||
* [[#2189]]: Added regexp support in sqlite [[@VictorKoenders]]
|
||||
* [[#2224]]: Add From impls for Json [[@dbeckwith]]
|
||||
* [[#2256]]: add progress handler support to sqlite [[@nbaztec]]
|
||||
* [[#2366]]: Allow ignoring attributes for deriving FromRow [[@grgi]]
|
||||
* [[#2369]]: new type support in query_as [[@0xdeafbeef]]
|
||||
* [[#2379]]: feat: add `Connection::shrink_buffers`, `PoolConnection::close` [[@abonander]]
|
||||
* [[#2400]]: fix(docs): example of `sqlx_macros_unstable` in config.toml [[@df51d]]
|
||||
* [[#2469]]: Add Simple format for Uuid for MySQL & SQLite. [[@MidasLamb]]
|
||||
* [[#2483]]: chore: add deprecation notice for type ascription use [[@saiintbrisson]]
|
||||
* [[#2506]]: add args to query builder (#2494) [[@cemoktra]]
|
||||
* [[#2554]]: Impl `AsMut` for advisory lock types (#2520) [[@alilleybrinker]]
|
||||
* [[#2559]]: Add CLI autocompletion using clap_complete [[@titaniumtraveler]]
|
||||
|
||||
|
||||
### Changed
|
||||
* [[#2185]]: Initial work to switch to `tracing` [[@CosmicHorrorDev]]
|
||||
* [[#2193]]: Start testing on Postgres 15 and drop Postgres 10 [[@paolobarbolini]]
|
||||
* We reserve the right to drop support for end-of-lifed database versions [as discussed in our FAQ][faq-db-version].
|
||||
* [[#2213]]: Use `let else` statements in favor of macro [[@OverHash]]
|
||||
* [[#2365]]: Update dependencies [[@paolobarbolini]]
|
||||
* [[#2371]]: Disable rustls crate logging feature by default up to date [[@sergeiivankov]]
|
||||
* [[#2373]]: chore: Use tracing's fields to get structured logs [[@jaysonsantos]]
|
||||
* [[#2393]]: Lower default logging level for statements to Debug [[@bnoctis]]
|
||||
* [[#2445]]: Traverse symlinks when resolving migrations [[@tgeoghegan]]
|
||||
* [[#2485]]: chore(sqlx-postgres): replace `dirs` with `home` & `etcetera` [[@utkarshgupta137]]
|
||||
* [[#2515]]: Bump mac_address to 1.1.5 [[@repnop]]
|
||||
* [[#2440]]: Update rustls to 0.21, webpki-roots to 0.23 [[@SergioBenitez]]
|
||||
* [[#2563]]: Update rsa to 0.9 [[@paolobarbolini]]
|
||||
* [[#2564]]: Update bitflags to v2 [[@paolobarbolini]]
|
||||
* [[#2565]]: Bump indexmap and ahash [[@paolobarbolini]]
|
||||
* [[#2574]]: doc: make it clear that `ConnectOptions` types impl `FromStr` [[@abonander]]
|
||||
|
||||
### Fixed
|
||||
* [[#2098]]: Fix sqlite compilation [[@cycraig]]
|
||||
* [[#2120]]: fix logical merge conflict [[@tyrelr]]
|
||||
* [[#2133]]: Postgres OID resolution query does not take into account current `search_path` [[@95ulisse]]
|
||||
* [[#2156]]: Fixed typo. [[@cdbfoster]]
|
||||
* [[#2179]]: fix: ensures recover from fail with PgCopyIn [[@andyquinterom]]
|
||||
* [[#2200]]: Run CI on *-dev branch [[@joehillen]]
|
||||
* [[#2222]]: Add context to confusing sqlx prepare parse error [[@laundmo]]
|
||||
* [[#2271]]: feat: support calling Postgres procedures with the macros [[@bgeron]]
|
||||
* [[#2282]]: Don't run EXPLAIN nullability analysis on Materialize [[@benesch]]
|
||||
* [[#2319]]: Set whoami default-features to false [[@thedodd]]
|
||||
* [[#2352]]: Preparing 0.7.0-alpha.1 release [[@abonander]]
|
||||
* [[#2355]]: Fixed the example code for `sqlx::test` [[@kenkoooo]]
|
||||
* [[#2367]]: Fix sqlx-cli create, drop, migrate [[@cycraig]]
|
||||
* [[#2376]]: fix(pool): close when last handle is dropped, extra check in `try_acquire` [[@abonander]]
|
||||
* [[#2378]]: Fix README build badge [[@dbrgn]]
|
||||
* [[#2398]]: fix(prepare): store temporary query files inside the workspace [[@aschey]]
|
||||
* [[#2402]]: fix: drop old time 0.1.44 dep [[@codahale]]
|
||||
* [[#2413]]: fix(macros-core): use of undeclared `tracked_path` [[@df51d]]
|
||||
* [[#2420]]: Enable runtime-tokio feature of sqlx when building sqlx-cli [[@paolobarbolini]]
|
||||
* [[#2453]]: in README.md, correct spelling and grammar [[@vizvasrj]]
|
||||
* [[#2454]]: fix: ensure fresh test db's aren't accidentally deleted by do_cleanup [[@phlip9]]
|
||||
* [[#2507]]: Exposing the Oid of PostgreSQL types [[@Razican]]
|
||||
* [[#2519]]: Use ::std::result::Result::Ok in output.rs [[@southball]]
|
||||
* [[#2569]]: Fix broken links to mysql error documentation [[@titaniumtraveler]]
|
||||
* [[#2570]]: Add a newline to the generated JSON files [[@nyurik]]
|
||||
* [[#2572]]: Do not panic when `PrepareOk` fails to decode [[@stepantubanov]]
|
||||
* [[#2573]]: fix(sqlite) Do not drop notify mutex guard until after condvar is triggered [[@andrewwhitehead]]
|
||||
|
||||
[sqlx-pro]: https://github.com/launchbadge/sqlx/discussions/1616
|
||||
|
||||
[faq-db-version]: https://github.com/launchbadge/sqlx/blob/main/FAQ.md#what-database-versions-does-sqlx-support
|
||||
|
||||
[#1850]: https://github.com/launchbadge/sqlx/pull/1850
|
||||
[#1946]: https://github.com/launchbadge/sqlx/pull/1946
|
||||
[#1960]: https://github.com/launchbadge/sqlx/pull/1960
|
||||
[#1984]: https://github.com/launchbadge/sqlx/pull/1984
|
||||
[#2039]: https://github.com/launchbadge/sqlx/pull/2039
|
||||
[#2088]: https://github.com/launchbadge/sqlx/pull/2088
|
||||
[#2092]: https://github.com/launchbadge/sqlx/pull/2092
|
||||
[#2094]: https://github.com/launchbadge/sqlx/pull/2094
|
||||
[#2098]: https://github.com/launchbadge/sqlx/pull/2098
|
||||
[#2109]: https://github.com/launchbadge/sqlx/pull/2109
|
||||
[#2113]: https://github.com/launchbadge/sqlx/pull/2113
|
||||
[#2115]: https://github.com/launchbadge/sqlx/pull/2115
|
||||
[#2116]: https://github.com/launchbadge/sqlx/pull/2116
|
||||
[#2120]: https://github.com/launchbadge/sqlx/pull/2120
|
||||
[#2132]: https://github.com/launchbadge/sqlx/pull/2132
|
||||
[#2133]: https://github.com/launchbadge/sqlx/pull/2133
|
||||
[#2156]: https://github.com/launchbadge/sqlx/pull/2156
|
||||
[#2179]: https://github.com/launchbadge/sqlx/pull/2179
|
||||
[#2185]: https://github.com/launchbadge/sqlx/pull/2185
|
||||
[#2189]: https://github.com/launchbadge/sqlx/pull/2189
|
||||
[#2193]: https://github.com/launchbadge/sqlx/pull/2193
|
||||
[#2200]: https://github.com/launchbadge/sqlx/pull/2200
|
||||
[#2213]: https://github.com/launchbadge/sqlx/pull/2213
|
||||
[#2222]: https://github.com/launchbadge/sqlx/pull/2222
|
||||
[#2224]: https://github.com/launchbadge/sqlx/pull/2224
|
||||
[#2253]: https://github.com/launchbadge/sqlx/pull/2253
|
||||
[#2256]: https://github.com/launchbadge/sqlx/pull/2256
|
||||
[#2271]: https://github.com/launchbadge/sqlx/pull/2271
|
||||
[#2282]: https://github.com/launchbadge/sqlx/pull/2282
|
||||
[#2285]: https://github.com/launchbadge/sqlx/pull/2285
|
||||
[#2319]: https://github.com/launchbadge/sqlx/pull/2319
|
||||
[#2352]: https://github.com/launchbadge/sqlx/pull/2352
|
||||
[#2355]: https://github.com/launchbadge/sqlx/pull/2355
|
||||
[#2363]: https://github.com/launchbadge/sqlx/pull/2363
|
||||
[#2365]: https://github.com/launchbadge/sqlx/pull/2365
|
||||
[#2366]: https://github.com/launchbadge/sqlx/pull/2366
|
||||
[#2367]: https://github.com/launchbadge/sqlx/pull/2367
|
||||
[#2369]: https://github.com/launchbadge/sqlx/pull/2369
|
||||
[#2371]: https://github.com/launchbadge/sqlx/pull/2371
|
||||
[#2373]: https://github.com/launchbadge/sqlx/pull/2373
|
||||
[#2376]: https://github.com/launchbadge/sqlx/pull/2376
|
||||
[#2378]: https://github.com/launchbadge/sqlx/pull/2378
|
||||
[#2379]: https://github.com/launchbadge/sqlx/pull/2379
|
||||
[#2387]: https://github.com/launchbadge/sqlx/pull/2387
|
||||
[#2393]: https://github.com/launchbadge/sqlx/pull/2393
|
||||
[#2398]: https://github.com/launchbadge/sqlx/pull/2398
|
||||
[#2400]: https://github.com/launchbadge/sqlx/pull/2400
|
||||
[#2402]: https://github.com/launchbadge/sqlx/pull/2402
|
||||
[#2408]: https://github.com/launchbadge/sqlx/pull/2408
|
||||
[#2409]: https://github.com/launchbadge/sqlx/pull/2409
|
||||
[#2413]: https://github.com/launchbadge/sqlx/pull/2413
|
||||
[#2420]: https://github.com/launchbadge/sqlx/pull/2420
|
||||
[#2440]: https://github.com/launchbadge/sqlx/pull/2440
|
||||
[#2445]: https://github.com/launchbadge/sqlx/pull/2445
|
||||
[#2453]: https://github.com/launchbadge/sqlx/pull/2453
|
||||
[#2454]: https://github.com/launchbadge/sqlx/pull/2454
|
||||
[#2459]: https://github.com/launchbadge/sqlx/pull/2459
|
||||
[#2467]: https://github.com/launchbadge/sqlx/pull/2467
|
||||
[#2469]: https://github.com/launchbadge/sqlx/pull/2469
|
||||
[#2483]: https://github.com/launchbadge/sqlx/pull/2483
|
||||
[#2485]: https://github.com/launchbadge/sqlx/pull/2485
|
||||
[#2491]: https://github.com/launchbadge/sqlx/pull/2491
|
||||
[#2496]: https://github.com/launchbadge/sqlx/pull/2496
|
||||
[#2506]: https://github.com/launchbadge/sqlx/pull/2506
|
||||
[#2507]: https://github.com/launchbadge/sqlx/pull/2507
|
||||
[#2508]: https://github.com/launchbadge/sqlx/pull/2508
|
||||
[#2515]: https://github.com/launchbadge/sqlx/pull/2515
|
||||
[#2519]: https://github.com/launchbadge/sqlx/pull/2519
|
||||
[#2554]: https://github.com/launchbadge/sqlx/pull/2554
|
||||
[#2559]: https://github.com/launchbadge/sqlx/pull/2559
|
||||
[#2563]: https://github.com/launchbadge/sqlx/pull/2563
|
||||
[#2564]: https://github.com/launchbadge/sqlx/pull/2564
|
||||
[#2565]: https://github.com/launchbadge/sqlx/pull/2565
|
||||
[#2569]: https://github.com/launchbadge/sqlx/pull/2569
|
||||
[#2570]: https://github.com/launchbadge/sqlx/pull/2570
|
||||
[#2572]: https://github.com/launchbadge/sqlx/pull/2572
|
||||
[#2573]: https://github.com/launchbadge/sqlx/pull/2573
|
||||
[#2574]: https://github.com/launchbadge/sqlx/pull/2574
|
||||
|
||||
### 0.6.3 - 2023-03-21
|
||||
|
||||
This is a hotfix to address the breakage caused by transitive dependencies upgrading to `syn = "2"`.
|
||||
|
||||
We set `default-features = false` for our dependency on `syn = "1"` to be good crates.io citizens,
|
||||
but failed to enable the features we actually used, which went undetected because we transitively depended on
|
||||
`syn` with the default features enabled through other crates,
|
||||
and so they were also on for us because features are additive.
|
||||
|
||||
When those other dependencies upgraded to `syn = "2"` it was no longer enabling those features for us,
|
||||
and so compilation broke for projects that don't also depend on `syn = "1"`, transitively or otherwise.
|
||||
|
||||
There is no PR for this fix as there was no longer a dedicated development branch for `0.6`,
|
||||
but discussion can be found in [issue #2418].
|
||||
|
||||
As of this release, the `0.7` release is in alpha and so development is no longer occurring against `0.6`.
|
||||
This fix will be forward-ported to `0.7`.
|
||||
|
||||
[issue #2418]: https://github.com/launchbadge/sqlx/issues/2418
|
||||
|
||||
## 0.6.2 - 2022-09-14
|
||||
|
||||
[25 pull requests][0.6.2-prs] were merged this release cycle.
|
||||
|
@ -1596,3 +1819,47 @@ Fix docs.rs build by enabling a runtime feature in the docs.rs metadata in `Carg
|
|||
[@DXist]: https://github.com/DXist
|
||||
[@Wopple]: https://github.com/Wopple
|
||||
[@TravisWhitehead]: https://github.com/TravisWhitehead
|
||||
[@ThibsG]: https://github.com/ThibsG
|
||||
[@rongcuid]: https://github.com/rongcuid
|
||||
[@moatra]: https://github.com/moatra
|
||||
[@penberg]: https://github.com/penberg
|
||||
[@saiintbrisson]: https://github.com/saiintbrisson
|
||||
[@FSMaxB]: https://github.com/FSMaxB
|
||||
[@95ulisse]: https://github.com/95ulisse
|
||||
[@miles170]: https://github.com/miles170
|
||||
[@ar3s3ru]: https://github.com/ar3s3ru
|
||||
[@cdbfoster]: https://github.com/cdbfoster
|
||||
[@andyquinterom]: https://github.com/andyquinterom
|
||||
[@CosmicHorrorDev]: https://github.com/CosmicHorrorDev
|
||||
[@VictorKoenders]: https://github.com/VictorKoenders
|
||||
[@joehillen]: https://github.com/joehillen
|
||||
[@OverHash]: https://github.com/OverHash
|
||||
[@laundmo]: https://github.com/laundmo
|
||||
[@nbaztec]: https://github.com/nbaztec
|
||||
[@bgeron]: https://github.com/bgeron
|
||||
[@benesch]: https://github.com/benesch
|
||||
[@nstinus]: https://github.com/nstinus
|
||||
[@grgi]: https://github.com/grgi
|
||||
[@sergeiivankov]: https://github.com/sergeiivankov
|
||||
[@jaysonsantos]: https://github.com/jaysonsantos
|
||||
[@dbrgn]: https://github.com/dbrgn
|
||||
[@grantkee]: https://github.com/grantkee
|
||||
[@bnoctis]: https://github.com/bnoctis
|
||||
[@aschey]: https://github.com/aschey
|
||||
[@df51d]: https://github.com/df51d
|
||||
[@codahale]: https://github.com/codahale
|
||||
[@arlyon]: https://github.com/arlyon
|
||||
[@SergioBenitez]: https://github.com/SergioBenitez
|
||||
[@tgeoghegan]: https://github.com/tgeoghegan
|
||||
[@vizvasrj]: https://github.com/vizvasrj
|
||||
[@phlip9]: https://github.com/phlip9
|
||||
[@MidasLamb]: https://github.com/MidasLamb
|
||||
[@utkarshgupta137]: https://github.com/utkarshgupta137
|
||||
[@Arcayr]: https://github.com/Arcayr
|
||||
[@mdecimus]: https://github.com/mdecimus
|
||||
[@Razican]: https://github.com/Razican
|
||||
[@southball]: https://github.com/southball
|
||||
[@alilleybrinker]: https://github.com/alilleybrinker
|
||||
[@titaniumtraveler]: https://github.com/titaniumtraveler
|
||||
[@nyurik]: https://github.com/nyurik
|
||||
[@stepantubanov]: https://github.com/stepantubanov
|
787
Cargo.lock
generated
787
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
39
Cargo.toml
39
Cargo.toml
|
@ -10,20 +10,19 @@ members = [
|
|||
"sqlx-mysql",
|
||||
"sqlx-postgres",
|
||||
"sqlx-sqlite",
|
||||
# FIXME: uncomment these for full release
|
||||
# "examples/mysql/todos",
|
||||
# "examples/postgres/axum-social-with-tests",
|
||||
# "examples/postgres/files",
|
||||
# "examples/postgres/json",
|
||||
# "examples/postgres/listen",
|
||||
# "examples/postgres/todos",
|
||||
# "examples/postgres/mockable-todos",
|
||||
# "examples/postgres/transaction",
|
||||
# "examples/sqlite/todos",
|
||||
"examples/mysql/todos",
|
||||
"examples/postgres/axum-social-with-tests",
|
||||
"examples/postgres/files",
|
||||
"examples/postgres/json",
|
||||
"examples/postgres/listen",
|
||||
"examples/postgres/todos",
|
||||
"examples/postgres/mockable-todos",
|
||||
"examples/postgres/transaction",
|
||||
"examples/sqlite/todos",
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.7.0-alpha.3"
|
||||
version = "0.7.0"
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
repository = "https://github.com/launchbadge/sqlx"
|
||||
|
@ -114,17 +113,17 @@ regexp = ["sqlx-sqlite?/regexp"]
|
|||
|
||||
[workspace.dependencies]
|
||||
# Core Crates
|
||||
sqlx-core = { version = "=0.7.0-alpha.3", path = "sqlx-core" }
|
||||
sqlx-macros-core = { version = "=0.7.0-alpha.3", path = "sqlx-macros-core" }
|
||||
sqlx-macros = { version = "=0.7.0-alpha.3", path = "sqlx-macros" }
|
||||
sqlx-core = { version = "=0.7.0", path = "sqlx-core" }
|
||||
sqlx-macros-core = { version = "=0.7.0", path = "sqlx-macros-core" }
|
||||
sqlx-macros = { version = "=0.7.0", path = "sqlx-macros" }
|
||||
|
||||
# Driver crates
|
||||
sqlx-mysql = { version = "=0.7.0-alpha.3", path = "sqlx-mysql" }
|
||||
sqlx-postgres = { version = "=0.7.0-alpha.3", path = "sqlx-postgres" }
|
||||
sqlx-sqlite = { version = "=0.7.0-alpha.3", path = "sqlx-sqlite" }
|
||||
sqlx-mysql = { version = "=0.7.0", path = "sqlx-mysql" }
|
||||
sqlx-postgres = { version = "=0.7.0", path = "sqlx-postgres" }
|
||||
sqlx-sqlite = { version = "=0.7.0", path = "sqlx-sqlite" }
|
||||
|
||||
# Facade crate (for reference from sqlx-cli)
|
||||
sqlx = { version = "=0.7.0-alpha.3", path = "." }
|
||||
sqlx = { version = "=0.7.0", path = ".", default-features = false }
|
||||
|
||||
# Common type integrations shared by multiple driver crates.
|
||||
# These are optional unless enabled in a workspace crate.
|
||||
|
@ -150,8 +149,8 @@ features = ["time", "net", "sync", "fs", "io-util", "rt"]
|
|||
default-features = false
|
||||
|
||||
[dependencies]
|
||||
sqlx-core = { workspace = true, features = ["offline", "migrate"], default-features = false }
|
||||
sqlx-macros = { workspace = true, default-features = false, optional = true }
|
||||
sqlx-core = { workspace = true, features = ["offline", "migrate"] }
|
||||
sqlx-macros = { workspace = true, optional = true }
|
||||
|
||||
sqlx-mysql = { workspace = true, optional = true }
|
||||
sqlx-postgres = { workspace = true, optional = true }
|
||||
|
|
|
@ -9,4 +9,4 @@ anyhow = "1.0"
|
|||
futures = "0.3"
|
||||
sqlx = { path = "../../../", features = [ "mysql", "runtime-tokio-native-tls" ] }
|
||||
structopt = "0.3"
|
||||
tokio = { version = "1.20.0", features = ["macros"]}
|
||||
tokio = { version = "1.20.0", features = ["rt", "macros"]}
|
||||
|
|
|
@ -14,7 +14,7 @@ enum Command {
|
|||
Done { id: u64 },
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
let args = Args::from_args_safe()?;
|
||||
let pool = MySqlPool::connect(&env::var("DATABASE_URL")?).await?;
|
||||
|
|
|
@ -8,7 +8,7 @@ edition = "2021"
|
|||
[dependencies]
|
||||
# Primary crates
|
||||
axum = { version = "0.5.13", features = ["macros"] }
|
||||
sqlx = { version = "0.6.2", path = "../../../", features = ["runtime-tokio-rustls", "postgres", "time", "uuid"] }
|
||||
sqlx = { path = "../../../", features = ["runtime-tokio-rustls", "postgres", "time", "uuid"] }
|
||||
tokio = { version = "1.20.1", features = ["rt-multi-thread", "macros"] }
|
||||
|
||||
# Important secondary crates
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "files"
|
||||
name = "sqlx-example-postgres-files"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
@ -8,5 +8,5 @@ edition = "2021"
|
|||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
sqlx = { path = "../../../", features = ["postgres", "runtime-tokio-native-tls"] }
|
||||
tokio = { version = "1.20.0", features = ["macros"]}
|
||||
tokio = { version = "1.20.0", features = ["rt", "macros"]}
|
||||
dotenvy = "0.15.0"
|
||||
|
|
|
@ -26,7 +26,7 @@ impl Display for PostWithAuthorQuery {
|
|||
}
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
let pool = PgPool::connect(&dotenvy::var("DATABASE_URL")?).await?;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "json"
|
||||
name = "sqlx-example-postgres-json"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
workspace = "../../../"
|
||||
|
@ -10,6 +10,6 @@ dotenvy = "0.15.0"
|
|||
futures = "0.3"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
sqlx = { path = "../../../", features = ["postgres", "json"] }
|
||||
sqlx = { path = "../../../", features = ["runtime-tokio", "postgres", "json"] }
|
||||
structopt = "0.3"
|
||||
tokio = { version = "1.20.0", features = ["macros"]}
|
||||
tokio = { version = "1.20.0", features = ["rt", "macros"]}
|
||||
|
|
|
@ -30,7 +30,7 @@ struct Row {
|
|||
person: Json<Person>,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
let args = Args::from_args_safe()?;
|
||||
let pool = PgPool::connect(&dotenvy::var("DATABASE_URL")?).await?;
|
||||
|
|
|
@ -5,6 +5,6 @@ edition = "2021"
|
|||
workspace = "../../../"
|
||||
|
||||
[dependencies]
|
||||
sqlx = { path = "../../../", features = [ "postgres" ] }
|
||||
sqlx = { path = "../../../", features = [ "runtime-tokio", "postgres" ] }
|
||||
futures = "0.3.1"
|
||||
tokio = { version = "1.20.0", features = ["macros"]}
|
||||
tokio = { version = "1.20.0", features = ["rt-multi-thread", "macros", "time"]}
|
||||
|
|
|
@ -2,9 +2,16 @@ use futures::StreamExt;
|
|||
use futures::TryStreamExt;
|
||||
use sqlx::postgres::PgListener;
|
||||
use sqlx::{Executor, PgPool};
|
||||
use std::pin;
|
||||
use std::pin::pin;
|
||||
use std::sync::atomic::{AtomicI64, Ordering};
|
||||
use std::time::Duration;
|
||||
|
||||
/// How long to sit in the listen loop before exiting.
|
||||
///
|
||||
/// This ensures the example eventually exits, which is required for automated testing.
|
||||
const LISTEN_DURATION: Duration = Duration::from_secs(5);
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
println!("Building PG pool.");
|
||||
|
@ -12,13 +19,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
std::env::var("DATABASE_URL").expect("Env var DATABASE_URL is required for this example.");
|
||||
let pool = sqlx::PgPool::connect(&conn_str).await?;
|
||||
|
||||
let mut listener = PgListener::connect(&conn_str).await?;
|
||||
let mut listener = PgListener::connect_with(&pool).await?;
|
||||
|
||||
// let notify_pool = pool.clone();
|
||||
let _t = async_std::task::spawn(async move {
|
||||
stream::interval(Duration::from_secs(2))
|
||||
.for_each(|_| notify(&pool))
|
||||
.await
|
||||
let notify_pool = pool.clone();
|
||||
let _t = tokio::spawn(async move {
|
||||
let mut interval = tokio::time::interval(Duration::from_secs(2));
|
||||
|
||||
while !notify_pool.is_closed() {
|
||||
interval.tick().await;
|
||||
notify(¬ify_pool).await;
|
||||
}
|
||||
});
|
||||
|
||||
println!("Starting LISTEN loop.");
|
||||
|
@ -40,10 +50,28 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
listener.execute("SELECT pg_sleep(6)").await?;
|
||||
|
||||
let mut stream = listener.into_stream();
|
||||
while let Some(notification) = stream.try_next().await? {
|
||||
println!("[from stream]: {:?}", notification);
|
||||
|
||||
// `Sleep` must be pinned
|
||||
let mut timeout = pin!(tokio::time::sleep(LISTEN_DURATION));
|
||||
|
||||
loop {
|
||||
tokio::select! {
|
||||
res = stream.try_next() => {
|
||||
if let Some(notification) = res? {
|
||||
println!("[from stream]: {:?}", notification);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
},
|
||||
_ = timeout.as_mut() => {
|
||||
// Don't run forever
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pool.close().await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ anyhow = "1.0"
|
|||
futures = "0.3"
|
||||
sqlx = { path = "../../../", features = ["postgres", "runtime-tokio-native-tls"] }
|
||||
structopt = "0.3"
|
||||
tokio = { version = "1.20.0", features = ["macros"]}
|
||||
tokio = { version = "1.20.0", features = ["rt", "macros"]}
|
||||
dotenvy = "0.15.0"
|
||||
async-trait = "0.1.41"
|
||||
mockall = "0.11"
|
||||
|
|
|
@ -15,7 +15,7 @@ enum Command {
|
|||
Done { id: i64 },
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
dotenvy::dotenv().ok();
|
||||
let args = Args::from_args_safe()?;
|
||||
|
|
|
@ -9,5 +9,5 @@ anyhow = "1.0"
|
|||
futures = "0.3"
|
||||
sqlx = { path = "../../../", features = ["postgres", "runtime-tokio-native-tls"] }
|
||||
structopt = "0.3"
|
||||
tokio = { version = "1.20.0", features = ["macros"]}
|
||||
tokio = { version = "1.20.0", features = ["rt", "macros"]}
|
||||
dotenvy = "0.15.0"
|
||||
|
|
|
@ -14,7 +14,7 @@ enum Command {
|
|||
Done { id: i64 },
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
let args = Args::from_args_safe()?;
|
||||
let pool = PgPool::connect(&env::var("DATABASE_URL")?).await?;
|
||||
|
|
|
@ -7,4 +7,4 @@ workspace = "../../../"
|
|||
[dependencies]
|
||||
sqlx = { path = "../../../", features = [ "postgres", "runtime-tokio-native-tls" ] }
|
||||
futures = "0.3.1"
|
||||
tokio = { version = "1.20.0", features = ["macros"]}
|
||||
tokio = { version = "1.20.0", features = ["rt-multi-thread", "macros"]}
|
||||
|
|
|
@ -11,12 +11,14 @@ async fn insert_and_verify(
|
|||
test_id,
|
||||
"test todo"
|
||||
)
|
||||
.execute(&mut *transaction)
|
||||
// In 0.7, `Transaction` can no longer implement `Executor` directly,
|
||||
// so it must be dereferenced to the internal connection type.
|
||||
.execute(&mut **transaction)
|
||||
.await?;
|
||||
|
||||
// check that inserted todo can be fetched inside the uncommitted transaction
|
||||
let _ = query!(r#"SELECT FROM todos WHERE id = $1"#, test_id)
|
||||
.fetch_one(transaction)
|
||||
.fetch_one(&mut **transaction)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -9,4 +9,4 @@ anyhow = "1.0"
|
|||
futures = "0.3"
|
||||
sqlx = { path = "../../../", features = ["sqlite", "runtime-tokio-native-tls"] }
|
||||
structopt = "0.3"
|
||||
tokio = { version = "1.20.0", features = ["macros"]}
|
||||
tokio = { version = "1.20.0", features = ["rt", "macros"]}
|
||||
|
|
|
@ -14,7 +14,7 @@ enum Command {
|
|||
Done { id: i64 },
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
let args = Args::from_args_safe()?;
|
||||
let pool = SqlitePool::connect(&env::var("DATABASE_URL")?).await?;
|
||||
|
@ -53,7 +53,7 @@ VALUES ( ?1 )
|
|||
"#,
|
||||
description
|
||||
)
|
||||
.execute(&mut conn)
|
||||
.execute(&mut *conn)
|
||||
.await?
|
||||
.last_insert_rowid();
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ use anyhow::{bail, Context};
|
|||
use chrono::Utc;
|
||||
use console::style;
|
||||
use sqlx::migrate::{AppliedMigration, Migrate, MigrateError, MigrationType, Migrator};
|
||||
use sqlx::Connection;
|
||||
use std::borrow::Cow;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::fmt::Write;
|
||||
|
@ -170,6 +171,8 @@ pub async fn info(migration_source: &str, connect_opts: &ConnectOpts) -> anyhow:
|
|||
}
|
||||
}
|
||||
|
||||
let _ = conn.close().await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -249,6 +252,13 @@ pub async fn run(
|
|||
}
|
||||
}
|
||||
|
||||
// Close the connection before exiting:
|
||||
// * For MySQL and Postgres this should ensure timely cleanup on the server side,
|
||||
// including decrementing the open connection count.
|
||||
// * For SQLite this should checkpoint and delete the WAL file to ensure the migrations
|
||||
// were actually applied to the database file and aren't just sitting in the WAL file.
|
||||
let _ = conn.close().await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -310,6 +320,8 @@ pub async fn revert(
|
|||
println!("No migrations available to revert");
|
||||
}
|
||||
|
||||
let _ = conn.close().await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ authors.workspace = true
|
|||
repository.workspace = true
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
features = ["offline", "runtime-tokio-native-tls"]
|
||||
features = ["offline"]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
@ -93,5 +93,5 @@ event-listener = "2.5.2"
|
|||
dotenvy = "0.15"
|
||||
|
||||
[dev-dependencies]
|
||||
sqlx = { workspace = true, features = ["postgres", "sqlite", "mysql", "migrate"] }
|
||||
sqlx = { workspace = true, features = ["postgres", "sqlite", "mysql", "migrate", "macros"] }
|
||||
tokio = { version = "1", features = ["rt"] }
|
||||
|
|
|
@ -8,6 +8,8 @@ authors.workspace = true
|
|||
repository.workspace = true
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
# for conditional compilation
|
||||
_rt-async-std = ["async-std", "sqlx-core/_rt-async-std"]
|
||||
_rt-tokio = ["tokio", "sqlx-core/_rt-tokio"]
|
||||
|
@ -36,7 +38,7 @@ time = ["sqlx-core/time", "sqlx-mysql?/time", "sqlx-postgres?/time", "sqlx-sqlit
|
|||
uuid = ["sqlx-core/uuid", "sqlx-mysql?/uuid", "sqlx-postgres?/uuid", "sqlx-sqlite?/uuid"]
|
||||
|
||||
[dependencies]
|
||||
sqlx-core = { workspace = true, default-features = false, features = ["offline"] }
|
||||
sqlx-core = { workspace = true, features = ["offline"] }
|
||||
sqlx-mysql = { workspace = true, features = ["offline", "migrate"], optional = true }
|
||||
sqlx-postgres = { workspace = true, features = ["offline", "migrate"], optional = true }
|
||||
sqlx-sqlite = { workspace = true, features = ["offline", "migrate"], optional = true }
|
||||
|
|
|
@ -11,6 +11,7 @@ repository.workspace = true
|
|||
proc-macro = true
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
# for conditional compilation
|
||||
_rt-async-std = ["sqlx-macros-core/_rt-async-std"]
|
||||
|
@ -39,7 +40,7 @@ uuid = ["sqlx-macros-core/uuid"]
|
|||
json = ["sqlx-macros-core/json"]
|
||||
|
||||
[dependencies]
|
||||
sqlx-core = { workspace = true, default-features = false, features = ["any"] }
|
||||
sqlx-core = { workspace = true, features = ["any"] }
|
||||
sqlx-macros-core = { workspace = true }
|
||||
|
||||
proc-macro2 = { version = "1.0.36", default-features = false }
|
||||
|
|
|
@ -5,6 +5,7 @@ use sqlx_core::connection::ConnectOptions;
|
|||
use sqlx_core::error::Error;
|
||||
use sqlx_core::executor::Executor;
|
||||
use std::fmt::Write;
|
||||
use std::str::FromStr;
|
||||
use std::time::Duration;
|
||||
use url::Url;
|
||||
|
||||
|
@ -12,7 +13,15 @@ impl ConnectOptions for SqliteConnectOptions {
|
|||
type Connection = SqliteConnection;
|
||||
|
||||
fn from_url(url: &Url) -> Result<Self, Error> {
|
||||
Self::from_db_and_params(url.path(), url.query())
|
||||
// SQLite URL parsing is handled specially;
|
||||
// we want to treat the following URLs as equivalent:
|
||||
//
|
||||
// * sqlite:foo.db
|
||||
// * sqlite://foo.db
|
||||
//
|
||||
// If we used `Url::path()`, the latter would return an empty string
|
||||
// because `foo.db` gets parsed as the hostname.
|
||||
Self::from_str(url.as_str())
|
||||
}
|
||||
|
||||
fn connect(&self) -> BoxFuture<'_, Result<Self::Connection, Error>>
|
||||
|
|
Loading…
Reference in a new issue