Skip to content

Commit 874b8dc

Browse files
authored
Merge pull request #4043 from weiznich/prepare/2.2
Prepare a diesel 2.2 release
2 parents df338ca + 3590611 commit 874b8dc

File tree

21 files changed

+186
-85
lines changed

21 files changed

+186
-85
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ concurrency:
2121
jobs:
2222
check_and_test:
2323
name: Check
24-
needs: [sqlite_bundled, rustfmt_and_clippy, postgres_bundled]
24+
needs: [sqlite_bundled, rustfmt_and_clippy, postgres_bundled, mysql_bundled, typos]
2525
strategy:
2626
fail-fast: false
2727
matrix:
@@ -449,7 +449,7 @@ jobs:
449449
RUSTDOCFLAGS: -Zsanitizer=address
450450
RUSTFLAGS: -Zsanitizer=address
451451
ASAN_OPTIONS: detect_stack_use_after_return=1
452-
run: cargo +stable -Z build-std test --manifest-path diesel/Cargo.toml --no-default-features --features "sqlite extras libsqlite3-sys libsqlite3-sys/bundled libsqlite3-sys/with-asan" --target x86_64-unknown-linux-gnu
452+
run: cargo +stable -Z build-std test --manifest-path diesel/Cargo.toml --no-default-features --features "sqlite extras __with_asan_tests" --target x86_64-unknown-linux-gnu
453453

454454
postgres_bundled:
455455
name: Check postgres bundled + Postgres with asan
@@ -491,7 +491,7 @@ jobs:
491491
RUSTDOCFLAGS: -Zsanitizer=address
492492
RUSTFLAGS: -Zsanitizer=address
493493
ASAN_OPTIONS: detect_stack_use_after_return=1
494-
run: cargo +stable -Z build-std test --manifest-path diesel/Cargo.toml --no-default-features --features "postgres pq-sys pq-sys/bundled pq-src/with-asan" --target x86_64-unknown-linux-gnu
494+
run: cargo +stable -Z build-std test --manifest-path diesel/Cargo.toml --no-default-features --features "postgres extras __with_asan_tests" --target x86_64-unknown-linux-gnu
495495

496496
mysql_bundled:
497497
name: Check mysql bundled + Mysql with asan
@@ -543,7 +543,7 @@ jobs:
543543
LSAN_OPTIONS: suppressions=/tmp/suppr.txt
544544
run: |
545545
echo "leak:mysql_server_init" > /tmp/suppr.txt
546-
cargo +stable -Z build-std test --manifest-path diesel/Cargo.toml --no-default-features --features "mysql mysqlclient-sys mysqlclient-sys/bundled mysqlclient-src/with-asan" --target x86_64-unknown-linux-gnu
546+
cargo +stable -Z build-std test --manifest-path diesel/Cargo.toml --no-default-features --features "mysql extras __with_asan_tests" --target x86_64-unknown-linux-gnu
547547
548548
minimal_rust_version:
549549
name: Check Minimal supported rust version (1.78.0)
@@ -576,8 +576,6 @@ jobs:
576576
typos:
577577
name: Spell Check with Typos
578578
runs-on: ubuntu-latest
579-
if: github.event_name == 'push' || !github.event.pull_request.draft
580-
581579
steps:
582580
- name: Checkout Actions Repository
583581
uses: actions/checkout@v4

CHANGELOG.md

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ Increasing the minimal supported Rust version will always be coupled at least wi
1010

1111
## Unreleased
1212

13+
## [2.2.0] 2024-05-31
14+
1315
### Added
1416

15-
* Support `[print_schema] exclude_custom_type_definitions=["Vector"]`. If a `custom type` matches one element on the list it's skipped.
17+
* Support `[print_schema] exclude_custom_type_definitions = ["Vector"]`. If a `custom type` matches one element on the list it's skipped.
1618
* Added automatic usage of all sqlite `rowid` aliases when no explicit primary key is defined for `print-schema`
1719
* Added a `#[dsl::auto_type]` attribute macro, allowing to infer type of query fragment functions
1820
* Added the same type inference on `Selectable` derives, which allows skipping specifying `select_expression_type` most of the time, in turn enabling most queries to be written using just a `Selectable` derive.
@@ -23,13 +25,64 @@ Increasing the minimal supported Rust version will always be coupled at least wi
2325
* Add `sqlite-integer-primary-key-is-bigint` configuration option, usable with SQLite 3.37 or above, allowing to use `BigInt` for `INTEGER PRIMARY KEY` columns in SQLite for tables without the `WITHOUT ROWID` attribute ([SQLite doc](https://www.sqlite.org/lang_createtable.html#rowid)).
2426
* Support for multiple `print_schema` entry in `diesel.toml` (e.g. `[print_schema.user1]`), which allows generating multiple schema.rs files
2527
* Add support for `COPY TO` and `COPY FROM` statements
28+
* Add support for mapping `chrono::Duration` to postgresql's `INTERVAL` sql type
29+
* Added `serialize_database_to_buffer` and `deserialize_readonly_database_from_buffer` methods in `SqliteConnection` to support serialization/deserialization of SQLite databases to and from byte buffers.
30+
* Added `SerializedDatabase` wrapper type for a serialized database that is dynamically allocated by calling `serialize_database_to_buffer`. This RAII wrapper deallocates the memory when it goes out of scope with `sqlite3_free`.
2631

2732
### Changed
2833

2934
* The minimal officially supported rustc version is now 1.78.0
3035
* Deprecated `sql_function!` in favour of `define_sql_function!` which provides compatibility with `#[dsl::auto_type]`
3136
* Deserialization error messages now contain information about the field that failed to deserialize
3237

38+
## [2.1.6] 2024-04-19
39+
40+
* Fix using `BoxableExpression` with having clauses
41+
* Fix using numeric expressions with aliased fields
42+
* Minor documentation fixes
43+
44+
## [2.1.5] 2024-03-15
45+
46+
* Fix `impl SqlOrd` postgres > postgres_backend feature flag.
47+
* Allow `Queryable` to be used with multiple table names.
48+
* Fix an inconsistent unit test
49+
* Fix a clippy lint
50+
* Fix ./bin/test feature flag calls.
51+
* Update `libsqlite3-sys` to allow version 0.28 as well
52+
53+
## [2.1.4] 2023-11-14
54+
55+
* Update `libsqlite3-sys` to allow version 0.27 as well
56+
57+
## [2.1.3] 2023-10-05
58+
59+
* Increased accidently decreased limit around element count in `DISTINCT ON` and `ORDER BY` clauses again as that broke existing code
60+
61+
## [2.1.2] 2023-09-25
62+
63+
## Fixed
64+
65+
* Fixed another potential breaking chaneg around queries containing `DISTINCT ON` and `ORDER BY` clauses consisting of custom sql expressions (e.g. `.nullable()`)
66+
* Fixed an issue where `#[derive(Selectable)]` and `#[diesel(check_for_backend)]` generates invalid rust code if the struct contains lifetimes/generic types
67+
68+
## [2.1.1] 2023-08-25
69+
70+
## Fixed
71+
72+
* Fixed an issue in diesel-cli that lead to using unquoted table names in one of the internal queries
73+
* Fixed a bug in `diesel print-schema` that lead to generating invalid `table!` macros if both the `#[sql_name]` and the `#[max_length]` attribute are present
74+
* Fixed an issue in diesel-cli that lead to ignoring certain foreign key constraints for postgresql
75+
* Fixed an crash while using `diesel print-schema` with really old sqlite versions
76+
* Fixed an issue where `#[diesel(check_for_backend)]` ignored `#[diesel(deserialize_as)]` attributes
77+
* Fixed several issues with the new `#[derive(MultiConnection)]` feature
78+
* Fixed some edge cases in our sqlite timestamp parsing behaviour
79+
* `diesel migration generate --diff-schema` now respects table filters as setup for `print-schema` via `diesel.toml`
80+
* Fixed a potential breaking change around queries containing `DISTINCT ON` and `ORDER BY` clauses consisting of custom sql expressions (e.g. `diesel::dsl::sql`)
81+
82+
## Added
83+
84+
* Support for bigdecimal 0.4
85+
3386
## [2.1.0] 2023-05-26
3487

3588
### Changed
@@ -38,8 +91,6 @@ Increasing the minimal supported Rust version will always be coupled at least wi
3891

3992
### Added
4093

41-
* Added `serialize_database_to_buffer` and `deserialize_readonly_database_from_buffer` methods in `SqliteConnection` to support serialization/deserialization of SQLite databases to and from byte buffers.
42-
* Added `SerializedDatabase` wrapper type for a serialized database that is dynamically allocated by calling `serialize_database_to_buffer`. This RAII wrapper deallocates the memory when it goes out of scope with `sqlite3_free`.
4394
* Added the `custom_type_derives` config option to customize the derives for SQL
4495
type definitions automatically generated by Diesel CLI.
4596
* Add a `#[derive(MultiConnection)]` proc-macro that lets you easily implement `diesel::Connection`
@@ -2047,3 +2098,10 @@ queries or set `PIPES_AS_CONCAT` manually.
20472098
[2.0.3]: https://github.com/diesel-rs/diesel/compare/v.2.0.2...v2.0.3
20482099
[2.0.4]: https://github.com/diesel-rs/diesel/compare/v.2.0.3...v2.0.4
20492100
[2.1.0]: https://github.com/diesel-rs/diesel/compare/v.2.0.0...v2.1.0
2101+
[2.1.1]: https://github.com/diesel-rs/diesel/compare/v.2.1.0...v2.1.1
2102+
[2.1.2]: https://github.com/diesel-rs/diesel/compare/v.2.1.1...v2.1.2
2103+
[2.1.3]: https://github.com/diesel-rs/diesel/compare/v.2.1.2...v2.1.3
2104+
[2.1.4]: https://github.com/diesel-rs/diesel/compare/v.2.1.3...v2.1.4
2105+
[2.1.5]: https://github.com/diesel-rs/diesel/compare/v.2.1.4...v2.1.5
2106+
[2.1.6]: https://github.com/diesel-rs/diesel/compare/v.2.1.5...v2.1.6
2107+
[2.2.0]: https://github.com/diesel-rs/diesel/compare/v.2.1.0...v2.2.0

diesel/Cargo.toml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "diesel"
3-
version = "2.1.4"
3+
version = "2.2.0"
44
license = "MIT OR Apache-2.0"
55
description = "A safe, extensible ORM and Query Builder for PostgreSQL, SQLite, and MySQL"
66
readme = "README.md"
@@ -11,6 +11,7 @@ keywords = ["orm", "database", "sql"]
1111
categories = ["database"]
1212
edition = "2021"
1313
rust-version.workspace = true
14+
include = ["src/**.rs", "tests/**.rs", "LICENSE-*", "README.md"]
1415

1516
[dependencies]
1617
byteorder = { version = "1.0", optional = true }
@@ -20,7 +21,7 @@ libsqlite3-sys = { version = ">=0.17.2, <0.29.0", optional = true, features = ["
2021
mysqlclient-sys = { version = ">=0.2.5, <0.4.0", optional = true }
2122
mysqlclient-src = { version = "0.1.0", optional = true }
2223
pq-sys = { version = ">=0.4.0, <0.7.0", optional = true }
23-
pq-src = { version = "0.1", optional = true }
24+
pq-src = { version = "0.2", optional = true }
2425
quickcheck = { version = "1.0.3", optional = true }
2526
serde_json = { version = ">=0.8.0, <2.0", optional = true }
2627
url = { version = "2.1.0", optional = true }
@@ -38,7 +39,7 @@ itoa = { version = "1.0.0", optional = true }
3839
time = { version = "0.3.9", optional = true, features = ["macros"] }
3940

4041
[dependencies.diesel_derives]
41-
version = "~2.1.0"
42+
version = "~2.2.0"
4243
path = "../diesel_derives"
4344

4445
[dev-dependencies]
@@ -56,21 +57,29 @@ huge-tables = ["64-column-tables"]
5657
32-column-tables = ["diesel_derives/32-column-tables"]
5758
64-column-tables = ["32-column-tables", "diesel_derives/64-column-tables"]
5859
128-column-tables = ["64-column-tables", "diesel_derives/128-column-tables"]
59-
postgres = ["pq-sys", "postgres_backend"]
60-
sqlite = ["libsqlite3-sys", "diesel_derives/sqlite", "time?/formatting", "time?/parsing"]
61-
mysql = ["mysqlclient-sys", "url", "percent-encoding", "bitflags", "mysql_backend"]
60+
postgres = ["dep:pq-sys", "postgres_backend"]
61+
sqlite = ["dep:libsqlite3-sys", "diesel_derives/sqlite", "time?/formatting", "time?/parsing"]
62+
mysql = ["dep:mysqlclient-sys", "dep:url", "dep:percent-encoding", "dep:bitflags", "mysql_backend"]
6263
without-deprecated = ["diesel_derives/without-deprecated"]
6364
with-deprecated = ["diesel_derives/with-deprecated"]
64-
network-address = ["ipnetwork", "libc"]
65-
ipnet-address = ["ipnet", "libc"]
66-
numeric = ["num-bigint", "bigdecimal", "num-traits", "num-integer"]
67-
postgres_backend = ["diesel_derives/postgres", "bitflags", "byteorder", "itoa"]
68-
mysql_backend = ["diesel_derives/mysql", "byteorder"]
65+
network-address = ["dep:ipnetwork", "dep:libc"]
66+
ipnet-address = ["dep:ipnet", "dep:libc"]
67+
numeric = ["dep:num-bigint", "dep:bigdecimal", "dep:num-traits", "dep:num-integer"]
68+
postgres_backend = ["diesel_derives/postgres", "dep:bitflags", "dep:byteorder", "dep:itoa"]
69+
mysql_backend = ["diesel_derives/mysql", "dep:byteorder"]
6970
returning_clauses_for_sqlite_3_35 = []
7071
i-implement-a-third-party-backend-and-opt-into-breaking-changes = []
7172
r2d2 = ["diesel_derives/r2d2", "dep:r2d2"]
7273
chrono = ["diesel_derives/chrono", "dep:chrono"]
7374
time = ["diesel_derives/time", "dep:time"]
75+
__with_asan_tests = [
76+
"libsqlite3-sys?/bundled",
77+
"libsqlite3-sys?/with-asan",
78+
"pq-sys?/bundled",
79+
"pq-src?/with-asan",
80+
"mysqlclient-sys?/bundled",
81+
"mysqlclient-src?/with-asan",
82+
]
7483

7584
[package.metadata.docs.rs]
7685
features = ["postgres", "mysql", "sqlite", "extras"]

diesel/src/expression/functions/aggregate_folding.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ define_sql_function! {
3030
/// ```rust
3131
/// # include!("../../doctest_setup.rs");
3232
/// # use diesel::dsl::*;
33-
/// # #[cfg(feature = "bigdecimal")]
33+
/// # #[cfg(feature = "numeric")]
3434
/// # extern crate bigdecimal;
3535
/// #
3636
/// # fn main() {

diesel/src/mysql/connection/bind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ mod tests {
747747
use crate::mysql::connection::stmt::Statement;
748748
use crate::prelude::*;
749749
use crate::sql_types::*;
750-
#[cfg(feature = "bigdecimal")]
750+
#[cfg(feature = "numeric")]
751751
use std::str::FromStr;
752752

753753
fn to_value<ST, T>(

diesel/src/mysql/types/numeric.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[cfg(feature = "bigdecimal")]
1+
#[cfg(feature = "numeric")]
22
mod bigdecimal {
33
use bigdecimal::{BigDecimal, FromPrimitive};
44
use std::io::prelude::*;
@@ -8,7 +8,7 @@ mod bigdecimal {
88
use crate::serialize::{self, IsNull, Output, ToSql};
99
use crate::sql_types::Numeric;
1010

11-
#[cfg(all(feature = "mysql_backend", feature = "bigdecimal"))]
11+
#[cfg(all(feature = "mysql_backend", feature = "numeric"))]
1212
impl ToSql<Numeric, Mysql> for BigDecimal {
1313
fn to_sql<'b>(&'b self, out: &mut Output<'b, '_, Mysql>) -> serialize::Result {
1414
write!(out, "{}", *self)
@@ -17,7 +17,7 @@ mod bigdecimal {
1717
}
1818
}
1919

20-
#[cfg(all(feature = "mysql_backend", feature = "bigdecimal"))]
20+
#[cfg(all(feature = "mysql_backend", feature = "numeric"))]
2121
impl FromSql<Numeric, Mysql> for BigDecimal {
2222
fn from_sql(value: MysqlValue<'_>) -> deserialize::Result<Self> {
2323
match value.numeric_value()? {

diesel/src/pg/types/mod.rs

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -428,20 +428,35 @@ pub mod sql_types {
428428
///
429429
/// ### [`ToSql`] impls
430430
///
431-
#[cfg_attr(feature = "ipnetwork", doc = " - [`ipnetwork::IpNetwork`][IpNetwork]")]
432-
#[cfg_attr(feature = "ipnet", doc = " - [`ipnet::IpNet`][IpNet]")]
433-
#[cfg_attr(not(any(feature = "ipnetwork", feature = "ipnet")), doc = "N/A")]
431+
#[cfg_attr(
432+
feature = "network-address",
433+
doc = " - [`ipnetwork::IpNetwork`][IpNetwork]"
434+
)]
435+
#[cfg_attr(feature = "ipnet-address", doc = " - [`ipnet::IpNet`][IpNet]")]
436+
#[cfg_attr(
437+
not(any(feature = "network-address", feature = "ipnet-address")),
438+
doc = "N/A"
439+
)]
434440
///
435441
/// ### [`FromSql`] impls
436442
///
437-
#[cfg_attr(feature = "ipnetwork", doc = " - [`ipnetwork::IpNetwork`][IpNetwork]")]
438-
#[cfg_attr(feature = "ipnet", doc = " - [`ipnet::IpNet`][IpNet]")]
439-
#[cfg_attr(not(any(feature = "ipnetwork", feature = "ipnet")), doc = "N/A")]
443+
#[cfg_attr(
444+
feature = "network-address",
445+
doc = " - [`ipnetwork::IpNetwork`][IpNetwork]"
446+
)]
447+
#[cfg_attr(feature = "ipnet-address", doc = " - [`ipnet::IpNet`][IpNet]")]
448+
#[cfg_attr(
449+
not(any(feature = "network-address", feature = "ipnet-address")),
450+
doc = "N/A"
451+
)]
440452
///
441453
/// [`ToSql`]: crate::serialize::ToSql
442454
/// [`FromSql`]: crate::deserialize::FromSql
443-
#[cfg_attr(feature = "ipnetwork", doc = " [IpNetwork]: ipnetwork::IpNetwork")]
444-
#[cfg_attr(feature = "ipnet", doc = " [IpNet]: ipnet::IpNet")]
455+
#[cfg_attr(
456+
feature = "network-address",
457+
doc = " [IpNetwork]: ipnetwork::IpNetwork"
458+
)]
459+
#[cfg_attr(feature = "ipnet-address", doc = " [IpNet]: ipnet::IpNet")]
445460
///
446461
/// # Examples
447462
///
@@ -487,20 +502,35 @@ pub mod sql_types {
487502
///
488503
/// ### [`ToSql`] impls
489504
///
490-
#[cfg_attr(feature = "ipnetwork", doc = " - [`ipnetwork::IpNetwork`][IpNetwork]")]
491-
#[cfg_attr(feature = "ipnet", doc = " - [`ipnet::IpNet`][IpNet]")]
492-
#[cfg_attr(not(any(feature = "ipnetwork", feature = "ipnet")), doc = "N/A")]
505+
#[cfg_attr(
506+
feature = "network-address",
507+
doc = " - [`ipnetwork::IpNetwork`][IpNetwork]"
508+
)]
509+
#[cfg_attr(feature = "ipnet-address", doc = " - [`ipnet::IpNet`][IpNet]")]
510+
#[cfg_attr(
511+
not(any(feature = "network-address", feature = "ipnet-address")),
512+
doc = "N/A"
513+
)]
493514
///
494515
/// ### [`FromSql`] impls
495516
///
496-
#[cfg_attr(feature = "ipnetwork", doc = " - [`ipnetwork::IpNetwork`][IpNetwork]")]
497-
#[cfg_attr(feature = "ipnet", doc = " - [`ipnet::IpNet`][IpNet]")]
498-
#[cfg_attr(not(any(feature = "ipnetwork", feature = "ipnet")), doc = "N/A")]
517+
#[cfg_attr(
518+
feature = "network-address",
519+
doc = " - [`ipnetwork::IpNetwork`][IpNetwork]"
520+
)]
521+
#[cfg_attr(feature = "ipnet-address", doc = " - [`ipnet::IpNet`][IpNet]")]
522+
#[cfg_attr(
523+
not(any(feature = "network-address", feature = "ipnet-address")),
524+
doc = "N/A"
525+
)]
499526
///
500527
/// [`ToSql`]: crate::serialize::ToSql
501528
/// [`FromSql`]: crate::deserialize::FromSql
502-
#[cfg_attr(feature = "ipnetwork", doc = " [IpNetwork]: ipnetwork::IpNetwork")]
503-
#[cfg_attr(feature = "ipnet", doc = " [IpNet]: ipnet::IpNet")]
529+
#[cfg_attr(
530+
feature = "network-address",
531+
doc = " [IpNetwork]: ipnetwork::IpNetwork"
532+
)]
533+
#[cfg_attr(feature = "ipnet-address", doc = " [IpNet]: ipnet::IpNet")]
504534
///
505535
/// # Examples
506536
///

0 commit comments

Comments
 (0)