All versions since v0.10.1
v0.10.1
This is a minor bugfix release to address a bug in 0.10.0 involving infer_table_from_schema! specifying a table from a schema other than public. Two version bumps which were backwards compatible have also been included.
v0.11.0 (The one where we support MySQL)
The headline features for this release are MySQL support and limited PG upsert support. MySQL support works exactly as you’d expect. Just add features = ["mysql"] to your Cargo.toml, pass a connection URL (where the scheme is mysql:// and the path is the name of the database) to MysqlConnection::establish and you’re off. Keep in mind that if you’re following the getting started guide, MySQL does not support the RETURNING clause, so methods like get_result and get_results won’t work.
PostgreSQL upsert was a feature added in PG 9.5 and has been one of our most requested features. The full upsert API is quite complex, but we’ve added support for ON CONFLICT DO NOTHING, as this covered the highest percentage of use cases with the lowest amount of work. You can see examples in the docs. Support for the full upsert syntax will be coming in 0.12
In addition to the headline features, there were plenty of quality of life improvements and bug fixes. As always, you can see a full list of changes by reading the changelog.
In addition to the Diesel core team, 6 additional contributors worked on this release. A huge thank you to:
- Brandon W Maister
- Eijebong
- Georg Semmler
- Jimmy Cuadra
- Jovansonlee Cesar
- jacob
I’d also like to thank everybody who helped this release by opening issues, finding bugs, and asking/answering questions in our gitter room.
v0.11.1
This release is a minor bug fix release that handles two edge cases in 0.11’s new behavior.
v0.11.2
This release has no code changes other than bumping the allowed version for pq-sys and mysqlclient-sys. The versions released alongside 0.11 attempted to generate the bindings at compile time. This required a bleeding edge version of clang, and caused too many issues for too many people. The latest versions of those two libraries include pre-generated bindings.
If you need to use bindings generated by the old version, you can
explicitly depend on that version with cargo update --precise
v0.11.3
No changes. @sgrif is bad at releasing things.
v0.11.4
This release addresses a memory safety issue in our interaction with libmysqlclient. There was an undocumented assumption made by that library which we were not taking into consideration, resulting in a use-after-free bug. This was resulting in a segmentation fault on some systems.
While this issue is quite serious, we are not issuing a CVE or a security advisory. The bug resulted in 4 bytes being written to a handful of values. It could not be exploited to cause a security issue.
v0.12.0
The main feature of this release is support for PG’s ON CONFLICT DO UPDATE, which brings our support for upsert on PG to nearly the entire range of possible syntax. Additionally, this release contains support for some new data types and operators, and several bug fixes.
Finally, the way that we handle joins has been going through a huge overhaul internally. For the most part this doesn’t affect public API yet, but you may notice an increase in compile times, and more things “just working” the way you’d expect when working with joins. This work will hopefully lead to 3+ table joins in the next release.
As always, you can find the full release notes in the CHANGELOG
In addition to the core team, 11 people contributed to this release. A huge thank you to:
- Taryn Hill
- Eijebong
- Martijn de Haan
- Mrmaxmeier
- Daniel Durante
- Patrick Fernie
- Erich Cordoba
- Sid Ngeth
- pfernie
- John Gallagher
- theduke
0.13.0
This release adds support for date and time types with SQLite, allows for raw SQL to use bind parameters, and updates our dependencies (notably allowing serde 1.0).
As always, you can find the full release notes in the CHANGELOG
In addition to the core team, 11 people contributed to this release. A huge thank you to:
- Tobias Schottdorf
- Dorian Scheidt
- Danilo Bargen
- Enether
- John Gallagher
- James Kominick
- pfernie
- Blake Pettersson
- Mark Catley
- Bastien Orivel
- Sunrin SHIMURA (keen)
- kardeiz
v0.14.0 (The one with all the joins)
One of the oldest issues in Diesel was that we limited the number of tables that could appear in a single query to 2. The problem was never about having more than 2 tables, but safely and correctly proving in the type system what would and could not be selected from that join.
With 0.14, that restriction has been removed. The query builder now supports joins containing an arbitrary number of tables. You may find that you need to call enable_multi_table_joins! for a few tables, but that need should go away in the future as specialization matures.
In addition to the headline feature, this release includes support for several new datatypes (including NUMERIC/DECIMAL which has been widely requested), and other small quality of life improvements. As always, you can see the CHANGELOG for the full release notes.
The Road to 1.0
A recent point of discussion among the core team has been what remaining blockers we have for releasing a version 1.0. The roadmap doesn’t necessarily include everything that would make us “feature complete”. It focuses on the set of changes that we think are likely to require breaking changes.
We expect that this will be the last 0.x release. You can follow the milestone here. Additionally, we all agreed that the biggest blocker to a 1.0 release is improvements to our documentation. We’re going to be doing a big push in the coming months to clean things up, and are looking for help from the community. You can follow that project here, or just come join us in our gitter room to talk about how you can help.
There will be a blog post with more details about this in the coming weeks.
Contributors
In addition to the core team, 10 people contributed to this release. A huge thank you to:
- Dorian Scheidt
- FliegendeWurst
- Georg Semmler
- JD Gonzales
- Jim McGrath
- Kieran
- Ruben De Smet
- Sunrin SHIMURA (keen)
- Tshepang Lekhonkhobe
- theduke
Core Team Changes
With this release, we are also making some changes to the core team to better reflect the current active maintainers. In recognition of his fantastic work, we’re pleased to welcome @Eijebong to the core team. Many early members of the team have also since moved onto other projects. To reflect that, Mike Piccolo, Matt Casper, and Sam Phippen are all being moved to the core team alumni.
v0.13.1
This is a bugfix release addressing an issue with sum and avg. These were mistakenly treated as returning the same type as their argument. However, these functions return NULL when run against an empty database, which could result in errors.
v0.14.1
This is a bugfix release addressing an issue with sum and avg. These were mistakenly treated as returning the same type as their argument. However, these functions return NULL when run against an empty database, which could result in errors.
v0.15.0
This is a minor release containing a few quality of life features. We were originally planning to ship these with 1.0, but they’re specifically needed by some production users.
The biggest feature here is the ability to manually specify the ON clause of a join, which is separate from the associations API. You can also use this to join to tables which otherwise have no association between them (but this will also require you to invoke enable_multi_table_joins!).
In addition to the Diesel core team, 6 people contributed to this release. A huge thank you to:
- Alex Kitchens
- Maciej Dziardziel
- Pyry Kontio
- Sunrin SHIMURA (keen)
- king6cong
- wangcong
v0.15.2
This is a minor bugfix release which addresses an issue with encoding of BigDecimal objects with PostgreSQL. Diesel would previously incorrectly encode certain numbers resulting in a runtime error.
v0.16.0
This release contains some changes to how joins work with Diesel, which we wanted to release as far in advance of 1.0 as possible. With this release, #[belongs_to] no longer generates the code required to join between two tables. The macro joinable! must be invoked instead. However, if you are using infer_schema! or diesel print-schema, these invocations will be generated based on the foreign keys in your database.
Also included in this release is the ability to rename columns. This is most useful when your columns conflict with Rust keywords. See the changelog for details.
In addition to the Diesel core team, 11 people contributed to this release. A huge thank you to:
- Alex Alvarez
- Georg Semmler
- Graham Grochowski
- JD Gonzales
- Lance Carlson
- Maciej
- Robert Balicki
- Sharad Chand
- Taryn Hill
- debris
- klieth
v0.99.0 (It's basically 1.0 except it's not)
This release is by far the largest Diesel has ever had. It serves 2 purposes. You can consider this release to be a beta for 1.0. However, 1.0 will have an important significant difference. Anything that is deprecated as of this release will not be present in the 1.0 release. This includes functions which were newly deprecated in 0.99. We know this may introduce a migration burden for some people, so we will continue to support the 0.99 line with bug fixes as long as there is demand and it is reasonable to do so.
Headline Features
This release is mainly focused on ergonomics. Our main new feature is the sql_query function. This is a new API which behaves similarly to sql, but it is entirely focused on cases where you want to write the entire query yourself. The main difference from sql is that you do not need to specify the return type of the query, and values are fetched by name rather than by index. This feature is still early, and there’s a lot of features still to come (specifically evolving #[derive(QueryableByName)], but we think this feature will ease a lot of pains for cases where Diesel doesn’t quite do what you need.
Additionally, you can now use tuples for inserts the same as you can for updates. If you’ve ever wanted to insert a row with just 1 or 2 values, and been annoyed that you needed a struct that you’re only using in this one place, this feature will make you happy. We’ll have new guides highlighting this feature soon.
Additionally, this release comes with a ton of quality of life features. Many of these changes are focused around making it easier to introduce line breaks naturally in your code. For example, .filter is now implemented on UpdateStatement, meaning you can write update(foo).filter(bar) instead of update(foo.filter(bar)). We’ve also introduced new APIs for insert and PG upsert which will have similar readability improvements.
Breaking Changes
This release includes more deprecations than any release prior. In particular, insert has been deprecated, along with our entire PG upsert API. All deprecations in this release have direct replacements, which will lead to code which formats much more nicely. It should be a mostly mechanical replacement for most apps. See the CHANGELOG file for details.
Growing the Team
With this release, we’d like to welcome several new members to the Diesel committer team. @weiznich, @notryanb, and @katrinabrock you’ve all done excellent work and we’re very excited to officially welcome you to the team!
Additional Thanks
In addition to the Diesel core and committer teams, 10 people contributed to this release. A huge thank you to:
- Adam Perry
- Alex Kitchens
- Alexey Zabelin
- Arnar Mar Sig
- Bob
- Jordan
- Lauri Apple
- Maxime “pep” Buquet
- William Murphy
- bippityboppity
Our only remaining blockers from this release and 1.0 are documentation changes, and having this tested in the wild. Thank you to every one of our users for your support, and we look forward to Diesel 1.0 by the end of the year!
1.0.0 Beta 1
This release contains 2 major changes from 0.99.0. The first is not news, we have removed all deprecated code from the codebase. However, this release also contains some major restructuring of the query_dsl module.
Traits related to the construction of queries, such as SelectDsl, FilterDsl, etc. Have been merged into a single QueryDsl trait. Traits related to the execution of queries, such as ExecuteDsl and LoadDsl have been merged into a single RunQueryDsl trait. The individual method traits still exist under the query_dsl::methods module, but they are no longer exported from prelude.
Though we promised there would be no significant changes other than documentation, during our process of documenting this module, it became clear that making this change would make discovering how to use Diesel’s query builder dramatically easier. It also gives us a much more centralized place to document these logically grouped methods. While we do not expect this change to break many apps, it is significant enough to warrant an early release.
Most applications should not need to care about this change. Code which is just doing use diesel::prelude::* and calling these methods will continue to work with no changes (though error messages will be improved if you make a mistake).
However, if you had code that was implementing QueryFragment or Query, and expected to be able to call .execute, .load, or similar on it (such as the Pagination helper in crates.io), you will need to add impl<Conn> RunQueryDsl<Conn> for YourType.
If you have code that is calling query builder methods generically (e.g. if you have where T: FilterDsl<Something>, you will likely need to explicitly import things from query_dsl::methods
In addition to those changes, there are some minor improvements to #[derive(QueryableByName)] which we had planned on releasing as 0.99.2.
Stability
With this release, 0.99.x will only receive bug fixes and security patches. No new features will be backported to that branch. However, 0.99 can be considered our first “LTS” release. While we have not yet determined what exactly that means for Diesel, you can be assured that release line will continue to be supported for as long as there is demand.
We do not plan on having a 1.0.0.beta2, but there may be additional minor breaking changes in that release if it is needed. If there are any code changes between now and 1.0.0, even non-breaking ones, we will have a release candidate before the final release.
Looking Ahead
As with 0.99.0, we expect that the only significant change between this release and 1.0.0 will be documentation. We expect that the final release of 1.0.0 will be before the end of the year.
Our only blocker for a final 1.0 release continues to be documentation. There is a lot of work to do before the end of the year. We need help from the community to reach our goal of releasing this year. If you’re interested in helping out, join the impl period working group channel.
1.0.0-rc1
Happy holidays!
This release contains no major code changes. There are a handful of minor bug fixes (the most notable being that SQLite no longer panics when we receive SQLITE_BUSY), but most changes are related to ensuring that our API documentation renders better.
We do not expect any further changes to the codebase of any kind (other than the version number) between this release and 1.0.0. Assuming no critical issues are found with this release candidate, the code as it exists at this point will be released as 1.0.0 on 2017-12-30.
1.0.0
We didn’t quite make it for 2017, but Diesel 1.0 is finally here! There are no changes between Diesel 1.0 and 1.0.0-rc1.
1.0.0 marks stability for Diesel. While there are many more features that will be added in the future, there will be no breaking changes from this point forward without a major version bump (which we do not anticipate happening for many years).
A lot has happened since Diesel 0.1 was released over 2 years ago. While it would be impossible to list every major change that has happened since then, here are a few highlights:
- Expanded from a PostgreSQL specific library to supporting SQLite and MySQL
- Went from nightly-only to nightly-optional to working purely on stable Rust
diesel print-schemareplacedinfer_schema!as the go-to way to infer your database schema.- Added support for a significant portion of SQL queries which could not be represented in 0.1
It’s been a great honor to watch this community grow and thrive as this library has developed. I look forward to continuing to evolve Diesel, and seeing how far it can go.
In addition to the Diesel core team, 98 people have contributed to Diesel. A huge thank you to everyone who made this and every prior release possible:
- Adam Perry
- Adrian Perez de Castro
- Alex Alvarez
- Alex Kitchens
- Alexey Zabelin
- Andrew Lazarus
- Andrew Ryan Lazarus
- Arnar Mar Sig
- Barosl Lee
- Blake Pettersson
- Bob
- Boris-Chengbiao Zhou
- Brandon W Maister
- Cameron Alexander
- Cengiz Can
- Christopher Brickley
- Cyryl Płotnicki
- Daniel Durante
- Danilo Bargen
- David Szotten
- Derek Prior
- Dimiter Petrov
- Dorian Scheidt
- Enether
- Eric Kidd
- Erich Cordoba
- FliegendeWurst
- Flux Xu
- Garrett Squire
- Georg Semmler
- Graham Grochowski
- JD Gonzales
- Jake Goulding
- Jakob Gillich
- James Kominick
- Jethro Beekman
- Jim McGrath
- Jimmy Cuadra
- John Gallagher
- Jordan
- Josh Holmer
- Jovansonlee Cesar
- Katrina Brock
- Kieran
- Konstantinos Sideris
- Lance Carlson
- Lauri Apple
- Maciej
- Maciej Dziardziel
- Mark Catley
- Martijn de Haan
- Mathieu Rochette
- Matt Casper
- Maxime “pep” Buquet
- Michael Macias
- Michael Stock
- Mike Piccolo
- Mrmaxmeier
- Patrick Fernie
- Paul Lange
- Peter Marheine
- Pyry Kontio
- Rasmus Kaj
- Richard Dodd
- Robert Balicki
- Robert Maloney
- Ruben De Smet
- Ryan Blecher
- Sam Phippen
- Sebastian Blei
- Sergio Benitez
- Severen Redwood
- Sharad Chand
- Sid Ngeth
- Stu Black
- Sunrin SHIMURA (keen)
- Tamir Duberstein
- Taryn Hill
- Tess Griffin
- Tim Brooks
- Tobias Schottdorf
- Tom Houlé
- Tshepang Lekhonkhobe
- Will Murphy
- William Murphy
- benaryorg
- bippityboppity
- debris
- derekdreery
- jacob
- jethrogb
- kardeiz
- king6cong
- klieth
- pfernie
- theduke
- wangcong
1.1.0
Improved Support for Adding New Types
The primary focus of this release was improving the ergonomics of adding support for new types in Diesel.
For implementing new SQL types, we’ve added #[derive(SqlType)] which implements many traits that you need to implement for every SQL type. See the documentation for HasSqlType for details on this derive.
For implementing new mappings, we’ve added #[derive(FromSqlRow)] and #[derive(AsExpression)]. These derives will replace the majority of the boilerplate that was previously required when supporting new types. Adding support for new types in Diesel 1.1 should only require implementing FromSql and ToSql. The derives will handle the rest.
We’ve also provided FromSql impls for *const str and *const [u8]. Due to the design of FromSql, we can’t provide impls for &str and &[u8] without a breaking change. However many impls just need to parse a string or some bytes, and don’t need the allocation that would come from String or Vec<u8>. This will require unsafe code to use, but should make certain implementations more efficient.
Finally, we’ve restructured how our serialize/deserialize modules are structured, and provided type aliases to make implementations of FromSql and ToSql more consise.
r2d2_diesel is Now Part of Diesel
Finally, this release merges r2d2_diesel into Diesel itself. The main benefit of doing this is that we can implement Connection for PooledConnection, removing the need for explicit &* when using r2d2. This should also help to prevent version mismatches when changing Diesel versions.
To use the new r2d2 support, remove r2d2 and r2d2_diesel from your Cargo.toml. Add the r2d2 to your enabled features on diesel. Replace extern crate r2d2 with pub use diesel::r2d2. Replace any r2d2_diesel:: with diesel::r2d2::.
Thanks
In addition to the headline features, there were dozens of smaller additions which should make using Diesel even better! As always, you can check the CHANGELOG for a full list of changes in this release.
In addition to the Diesel core team, 8 people contributed to this release. A huge thank you to:
- Ashe Connor
- Chris Pick
- Evan
- Georg Semmler
- MarcManiez
- Martin Lindhe
- Oliver Schneider
- Ryan Blecher
1.1.1
This release fixes a minor issue with our r2d2 support. In 1.1 we recommend that people access r2d2 via diesel::r2d2. However, r2d2 has a type called Error, which was shadowed by our own type called Error in that same module, making it inaccessible. This release adds an alias PoolError to point at r2d2::Error.
Thanks to YetAnotherMinion for working on this release.
1.2.0
This release contains several long awaited features.
We’ve re-introduced the ability to use bind params with the sql function, in a way which is harder to mis-use. This functionality was present prior to 1.0, but was removed when sql_function was added over concerns about its use with the rest of the query builder. Recent developments have proved those concerns to be valid, but this new API fills that niche. Thanks to @notryanb for taking the lead on this feature.
We’ve also added the ability to insert from a select statement (e.g. queries in the form of INSERT INTO table (...) SELECT .... This is a feature request that has come up repeatedly since release, and we’re happy to finally bring it to you. We’ve also added alternate forms of our insert API which feel better when used with select statements. You can find the full details in the CHANGELOG.
Finally, we’ve rewritten our custom dervies from scratch to take advantage of new diagnostic tools in recent versions of nightly Rust. If you turn on the unstable feature of Diesel on a nightly compiler, you’ll find that you get dramatically improved error messages from our derives. For the best error messages, you should also set RUSTFLAGS="--cfg procmacro2_semver_exempt".
Additionally, as of this release, Diesel is now powered by the blockchain. Because it’s 2018 and that’s how it works now I guess. See the CHANGELOG for full details.
In addition to the headline features, there were a ton of features that we don’t have time to mention here. As always, for a full list of changes you can find a full list in the CHANGELOG.
Thanks
Thank you to everyone who helped make this release happen through bug reports, and discussion on Gitter. While we don’t have a way to collect stats on that form of contribution…
In addition to the Diesel core team, 14 people contributed code to this release. A huge thank you to:
- Alex Kitchens
- Andrew Weiss
- Arun Kulshreshtha
- Brandur
- EloD10
- Jacob Chae
- Jordan Petridis
- Josh Leeb-du Toit
- Kerollmops
- Mathias Svensson
- Ryan Blecher
- Sander Maijers
- Seth Larson
- YetAnotherMinion
v1.3.0
New Features
This release includes a couple of major changes to how Diesel projects are developed. In the past, we’ve had 2 ways to generate schema.rs. A procedural macro called infer_schema!, and a CLI command diesel print-schema. We’ve recommended using the CLI command for a long time, but infer_schema! was still useful for early prototypes.
At the beginning of a project, your database schema changes much more frequently. It’s extremely annoying to have to remember to run a second command after running your migrations.
Diesel CLI 1.3 now supports a configuration file to customize its behavior. One of the new capabilities this provides is the ability to automatically regenerate schema.rs whenever you run or revert a migration. This means you no longer have to remember to run diesel print-schema when things change.
Because of this, we are deprecating diesel_infer_schema. 1.3 will be the final release of that crate. However, diesel_infer_schema 1.3 will continue to work with diesel until at least Diesel 2.0. You can see all of the capabilities of the new configuration file at http://diesel.rs/guides/configuring-diesel-cli.
This release also includes a complete redesign of the sql_function! macro. The new syntax is significantly closer to normal Rust. For example, what used to be written as:
sql_function! { lower, lower_t, (x: Text) -> Text, "Here are the docs for `lower`It's awkward to make multiline"}Can now be written as:
sql_function! { /// Here are the docs for `lower` /// It's just a normal doc comment. fn lower(x: Text) -> Text;}The new form also supports much more than the old one, including aggregate functions, function renaming, and generic functions. Things like MAX could previously not be expressed with sql_function!. However, now the definition looks like this:
sql_function! { #[aggregate] fn max<ST: SqlOrd + IntoNullable>(expr: ST) -> ST::Nullable;}Finally, the redesigned sql_function! supports user defined functions on SQLite. SQLite differs from other databases, in that custom functions aren’t defined in SQL. Instead you give it a C function pointer to use for the body. With Diesel, you can just give us any Rust closure that takes appropriate argument types, and we’ll handle gluing that to SQLite for you.
You can find examples for all of this in the docs for sql_function!.
In addition to the headline features, this release includes a ton of quality of life changes including expanded support for locking clauses, more global support for mathematic operators, and more. As always, for a full list of changes you can find it in [the changelog].
[the changelog]: https://github.com/diesel-rs/diesel/blob/v1.3.0/CHANGELOG.md
Thanks
Thank you to everyone who helped make this release happen through bug reports, and discussion on Gitter. While we don’t have a way to collect stats on that form of contribution, it’s greatly appreciated.
In addition to the Diesel core team, 12 people contributed code to this release. A huge thank you to:
- Aleksey Ivanov
- Christopher Brickley
- David Reid
- Diggory Blake
- Graham Turner
- Katharina
- Matt Kraai
- Nick Babcock
- Richard Petrie
- Simon Dickson
- Sunrin SHIMURA
- Thierry Berger
1.3.2
This release contains two major bugfixes. This release fixes the behavior of unsigned types on MySQL, and a compile time issue caused by the use of #[sql_name] in sql_function! with no return type. This release only affects users who are using unsigned types on MySQL, or who had code which failed to compile with 1.3.1.
1.3.3
This is a small bugfix release, addressing an issue with MySQL 8.0. The behavior of the C API in libmysqlclient changed in this version of MySQL, causing problems when a connection pool was used with Diesel.
If you are not using MySQL, or are on a version older than 8.0, this release does not affect you.
v1.4.0
New Features
In contrast to the last release most changes in this release are minor or internal. We’ve added support for newer versions of some dependency crates (libsqlite-sys, uuid, ipnetwork).
Diesel CLI got a command line flag to check if a generated schema matches the already existing one. This is useful for CI setups to check there if the committed generated schema file matches the committed migrations.
We’ve added support for the diesel_mange_updated_at('table_name') SQL function on SQLite. This function handles the setup of an trigger that automatically updates the updated_at column on update operations.
Additionally several helpers were added to support the deserialisation of tuples and composite types on PostgreSQL.
As always, a full list of changes can be found it in the changelog
Thanks
Thank you to everyone who helped make this release happen through bug reports, and discussion on Gitter. While we don’t have a way to collect stats on that form of contribution, it’s greatly appreciated.
In addition to the Diesel core team, 29 people contributed code to this release. A huge thank you to:
- Aleksey Ivanov
- Andrew Speed
- Carlos Diaz-Padron
- Daniel Silverstone
- Dirkjan Ochtman
- Dominik Sander
- Eyal Kalderon
- Galuh Sahid
- Hirokazu Hata
- Jake Goulding
- Jo Liss
- Josh Leeb-du Toit
- Kevin Stenerson
- kpcyrd
- Marcus Stollsteimer
- Matej Stuchlik
- Nikita Sivakov
- notryanb
- Rasmus Kaj
- Richard Petrie
- Rotem Yaari
- Ryan Leckey
- Sergio Benitez
- Simon Heath
- Stephen Muss
- Trinh Hoang Anh
1.4.3
Fixed
- Updated several dependencies
- Fixed an issue where the postgresql backend exploits implementation defined behaviour
- Fixed issue where rustdoc failed to build the documentation
diesel_derivesanddiesel_migrationsare updated to syn 1.0
1.4.4
Fixed
- Update several dependencies
- Fixed a bug with printing embedded migrations
As part of this release also updated versions of migration_internals and migration_macros are published.
1.4.5
Fixed
- Update several dependencies
- Fixed an issue where transactions that would fail to commit would leave the connection in a broken non-committed non-rolled-back state.
- Fix a bug that result in leaking sockets/file descriptors on failed connection attempts for postgresql
- Fix an incompatibility with newer
libmysqlclientversions - Remove some potential harmful usages of
mem::uninitialized
1.4.6
Fixed
- Fixed a use-after-free issue in the
QueryableByNameimplementation of ourSqlitebackend - Updated several dependencies
1.4.7
- Updated
libsqlite3-systo allow version 0.22 - Updated
ipnetworkto allow version 0.18
1.4.8
This release fixes an incompatibility between features passed to diesel and diesel_migrations while using cargos new resolver feature (resolver = "2") which will become the new default with the upcoming Rust 2021 edition
Diesel 2.0.0
Diesel 2.0.0 contains the contributions of more than 130 people. More than 1700 commits were submitted over a span of 3 years.
As part of this release we introduced numerous new features and rewrote large parts of the internal structure. Check out our changelog for a complete list of changes. As this is a new major Diesel release it contains a number of breaking changes. Checkout our migration guide for details about how to handle those breaking changes.
This release contains the following parts:
- diesel 2.0.0-rc.0
- diesel_derives 2.0.0-rc.0
- diesel_migrations 2.0.0-rc.0
- diesel_cli 2.0.0-rc.0
- diesel_dynamic_schema 0.2.0-rc.0
This release marks a first prerelease of the upcoming Diesel 2.0 release. We ask you for your help to finalise the release. Checkout the “Timeline for a Diesel 2.0 release” section for details about how you can help us finishing the release.
Features
As a highlight Diesel 2.0.0 adds support for the following features:
- Fully type checked
GROUP BYsupport - Support for table aliasing
- Support for defining select clauses via a corresponding type
- Support for
UNION/INTERSECTqueries
Support for GROUP BY clauses
Diesel 2.0 adds support for GROUP BY clauses for select queries.
This means queries like the following one will just work.
users::table.inner_join(posts::table) .group_by(users::id) .select((users::name, count(posts::id)))As this is the case for all other Diesel built-in query dsl, this construct is fully checked at compile time. This means Diesel
will ensure that the GROUP BY clause is valid for the current query and it will also ensure that expressions appearing inside
of your SELECT clause will match the aggregation rules provided by the current GROUP BY clause.
Support for table aliasing
Diesel 2.0 adds support for table aliasing. This enables users to write queries, where a table appears more than once in the corresponding
FROM clause. For this Diesel provides a Diesel::alias! macro that allows to define new alias for existing tables.
The following query demonstrates the support for this feature:
// Define new table alias for the existing `users` tablelet users1 = diesel::alias!(schema::users as user1);
// Use the corresponding alias inside any existing queryusers::table .inner_join(users1.on(users::id).eq(users1.field(users::id)))) .select((users::id, users::name, users1.field(users::name))) .order_by(users1.field(users::id))Again all of this is checked at compile time. So similar to a normal table, columns from aliases are only allowed to appear if the corresponding query actually uses the alias.
Implied selection via the new Selectable trait
Diesel 2.0 features a new Selectable trait and derive that lets users declare that a type expects a certain kind of select clause.
The major use case for this feature is to ensure that columns from a specific query are always requested in the right order
for a corresponding type implementing Queryable. This also works for complex queries involving joins or other kinds of nesting.
#[derive(Queryable, Selectable)]struct User { id: i32, name: String,}
let first_user = users.select(User::as_select()).first(connection)?;Diesel enforces at type system level that once you provided such a select clause via User::as_select() you are only allowed
to construct this type from the returned result of the corresponding query. This means there is no need to specify the User type
twice in the query above.
Support for UNION/INTERSECT/EXCEPT queries
Diesel 2.0 extents the query builder to support query combinations via UNION/INTERSECT/EXCEPT. This allows you
to easily chain multiple queries together as long as they return fields of the same type. Queries like the following
one are now supported:
users.select(user_name.nullable()) .union(animals.select(animal_name).filter(animal_name.is_not_null()))As always this is checked at compile time to reject invalid queries, like for example that ones containing select clauses with different fields.
Call for Participation
The release of Diesel 2.0 does not only include the features listed above, but also marks the point where the following things can be provided by third party crates:
- Custom
QueryDslextensions to support previously unsupported SQL features. Checkoutdiesel_full_text_searchfor an example - Alternative query dsl implementations reusing the existing
Connectioninfrastructure - Custom
Connectionimplementations for existing backends - Custom
ConnectionandBackendimplementations for previously unsupported backends. Checkout diesel-oci for an example.
We encourage our community to try out those features. Especially we would like to see experimentation around:
- Previously unsupported database backends
- Pure rust implementations of existing backend implementations. Checkout this and this discussion for starting points.
- Alternative query dsl implementations. Checkout this discussion as starting point.
Please get in touch with us for pointers, help and details.
Input for Future Roadmap
With the release of Diesel 2.0 the planing for our next releases start. Hopefully they will not take as long as Diesel 2.0. We are looking for input on which features are wanted by our community. Please open a discussion thread with your idea in our discussion forum.
Weiznich will work on improving error messages for trait heavy crates based on a Rust Foundation Project Grant. This work will hopefully improve error messages for Diesel as well. If you are aware of bad error messages please submit a minimal example here.
Thanks
As part of this release we would like to welcome @Ten0 as part of the diesel core team.
Thank you to everyone who helped make this release happen through bug reports, and discussion on Gitter. While we don’t have a way to collect stats on that form of contribution, it’s greatly appreciated.
In addition to the Diesel core team, 141 people contributed code to this release. A huge thank you to:
- Alessandro Menezes
- Alexander ‘z33ky’ Hirsch
- Alexei Pastuchov
- Alice Ryhl
- Amila Welihinda
- Andre Braga Reis
- Andreas Runfalk
- Andrew Safigan
- Andrew Speed
- Andy Russell
- Artem Vorotnikov
- Arve Seljebu
- Billy Chan
- Blas Rodriguez Irizar
- Bryan Henry
- Callym
- Caroline Glassberg-Powell
- Cassie Jones
- Chenxi Yuan
- Chris Eckhardt
- Chris Hanks
- Chris Maddox
- Chris West (Faux)
- Clouds Flowing
- Corentin Henry
- Daniel Buse
- Danilo Bargen
- David Teller
- David Tulig
- DebugSteven
- Diggory Blake
- Dmitriy Pleshevskiy
- Dusty Mabe
- DrVilepis
- EclipsedSolari
- Emile Fugulin
- Emm
- Emmanuel Surleau
- Erlend Langseth
- Felix Watts
- Filip Gospodinov
- Garrett Thornburg
- Giorgio Gambino
- Grégory Obanos
- Hal Gentz
- Han Xu
- Heliozoa
- Henk van der Laan
- Henry Boisdequin
- Hirokazu Hata
- Iban Eguia (Razican)
- Igor Raits
- Ivan Tham
- JR Heard
- Jean SIMARD
- Jeremy Stucki
- Jiří Sejkora
- jigaoqiang
- Joel Parker Henderson
- John Brandt
- Jonas Platte
- Jonas Schievink
- Joshua Koudys
- Juhasz Sandor
- Justice4Joffrey
- Katharina Fey
- Kevin King
- Kevin Kirchner
- Khionu Sybiern
- Kitsu
- Koisell
- Kononnable
- Leonardo Yvens
- Lukas Markeffsky
- Maccesch
- Marc-Stefan Cassola
- Martell Malone
- Martijn Groeneveldt
- Martin Nordholts
- Matthew Kuo
- Matthieu Guillemot
- Mcat12
- Meven
- Mike Cronce
- Mr Ceperka
- Nafiul Islam
- Nathan Papapietro
- Nicholas Yang
- Oliver Cooper
- Otto Castle
- Pankaj Jangid
- Paolo Barbolini
- Paul Le Corre
- Paul Martensen
- Pavan Kumar Sunkara
- Paweł Przeniczny
- Philip Trauner
- Raphael Arias
- Roman
- Ryan Leckey
- Sarthak Singh
- Scott Driggers
- Sean Klein
- Simon Ertl
- Spencer Taylor
- Steven Chu
- Storm Timmermans
- Sébastien Santoro
- Takayuki Maeda
- Thomas Constantine Moore
- Thomas Eizinger
- Thomas Etter
- Tom MacWright
- Tuetuopay
- Urhengulas
- Vanio Begic
- WebeWizard
- William Myers
- Yin Jifeng
- Yuki Okushi
- Zane Duffield
- blackghost1987
- czotomo
- dchenk
- ejc Drobnič
- gorbit99
- hasezoey
- hi-rustin
- kevinpoitra
- kpcyrd
- matthew-dowdell
- ode79
- ropottnik
- telios
- theredfish
- zoewithabang
- Zhenhui Xie
- Émile Fugulin
- κeen
- 二手掉包工程师
- 棒棒彬_Binboy
Diesel 2.0.1
This is a bugfix release containing the following fixes:
- Fixed an issue with
diesel_cligenerating incompatible type names for thegenerate_missing_sql_type_definitionsfeature on PostgreSQL - Fixed an issue how
diesel_clihandles sqlite urls while checking if a given database exists - Fixed an issue with
PgConnectionbecoming unusable after hitting a database error in certain situations - Fixed an issue with diesel generating invalid SQL for certain
INSERT … ON CONFLICTqueries - Fixed
diesel_derivesgenerating code that triggers the disabled by defaultunused_qualificationslint
This release includes updated versions of diesel, diesel_cli and diesel_derives
Diesel 2.0.2
Fixed
- Reverted a fix from the 2.0.1 release that breaks valid
INSERT … ON CONFLICTqueries
Diesel 2.0.3
Fixed
- Fixed a bug with our transaction manager implementation that caused by marking transactions as broken which could be recovered.
- Fixed an issue with the combination of
BoxableExpressionand order clauses
Diesel-derives 2.0.2
- Fixing the fallout of a breaking change from
quoteby not using their internal API
Diesel 2.0.4
Fixed
- Workaround the missing name resolution in rust-analyzer. This should fix type inference for some diesel queries. (It remains broken for queries containing
.filter()/.inner_join()/.left_join(). These require fixes in rust-analyzer itself) - Fixed a bug that could lead to inserting null values instead of empty values for custom sqlite types
- Fixed a bug that could lead to an unexpected panic while providing an out of bounds bind for
sql_queryin the sqlite backend - Fixed some mysql backend specific impl being behind the
mysqlinstead of themysql_backendfeature flag
Added
- Support for
libsqlite3-sys0.26
Diesel 2.1.0
Diesel 2.1.0 contains the contributions of 42 people. More than 380 commits were submitted over a span of 9 months.
This release contains several new features and improves existing features. It introduces support for generating migrations based on the diff between your schema.rs file and your database via Diesel CLI. Diesel derives now provides a #[derive(MultiConnection)] derive macro that allows to easily combine different database connections into a single enum, which implements Connection on its own. The MySQL backend gets support for upsert queries via the ON DUPLICATE KEYS syntax. Finally we provide new tooling to improve complex error messages generated for common error cases. Check out our changelog for a complete list of changes.
This release wouldn’t be possible without the support of our contributors and sponsors. If you want to support diesels development, consider joining the reviewer team, submitting PR’s, help writing documentation or sponsor the maintainers.
Migration generation
Diesel CLI now includes support for generating migrations based on the difference of your schema.rs file and your local database.
This works as following:
- Start editing your
schema.rsfile, for example by adding your first table:
diesel::table! { users { id -> Integer, name -> Text, }}- Run
diesel migration generate my_first_migration --diff-schema --database-url DATABASE_URL - Checkout, verify and possible modify the generated migration:
-- Your SQL goes hereCREATE TABLE `users`( `id` INTEGER NOT NULL PRIMARY KEY, `name` TEXT NOT NULL);- Run the migration via
diesel migration run --database-url DATABASE_URL
It’s important to note that the generated migrations can only contain information that are part of the schema.rs file. This explicitly excludes default value, custom check constraints and similar SQL features. We expect the generated migrations to be a good starting point for writing the actual migration you need, we do not expect them to include all necessary information in all cases or to provide the perfect solution in each scenario.
MultiConnection support
Diesel now includes a #[derive(MultiConnection)] proc macro derive, which allows to easily support more than one database backend in a single application. It can be applied to an enum of different connections:
#[derive(diesel::MultiConnection)]pub enum AnyConnection { Postgresql(diesel::PgConnection), Mysql(diesel::MysqlConnection), Sqlite(diesel::SqliteConnection),}Afterwards the AnyConnection type can be used as ordinary connection:
fn use_multi(conn: &mut AnyConnection) -> QueryResult<()> { // Use the connection enum as any other connection type // for inserting/updating/loading/… diesel::insert_into(users::table) .values(users::name.eq("Sean")) .execute(conn)?;
let users = users::table.load::<(i32, String)>(conn)?; Ok(())}By default this connection type will only support a subset of SQL that’s supported by all inner connection types. By being an enum it’s easy to fallback to backend specific SQL as soon as required. We provide this feature as derive macro so that it is possible to:
- Select the backends you actually use
- Allow to use third party connections as well (this requires the third party connection to be based at least on diesel 2.1 and to implement the
MultiConnectionHelpertrait in addition to the existingConnectiontrait.
Upsert support for the MySQL backend
Diesel 2.1 adds support for INSERT INTO … ON DUPLICATE KEYS … queries for the MySQL backend using the existing upsert framework. It’s now possible to write such queries using the diesel provided DSL:
diesel::insert_into(users) .values(&user2) .on_conflict(diesel::dsl::DuplicatedKeys) .do_update() .set(name.eq("I DONT KNOW ANYMORE")) .execute(conn)?;Improved error messages
We spend some effort to improve error messages generated by rustc for common diesel issues further.
Consider the following example:
table! { users { id -> Integer, name -> Text, }}
#[derive(Queryable)]struct User { name: String, id: i32,}
users::table.load::<User>(&mut conn)which would generate the following error message:
error[E0277]: the trait bound `(diesel::sql_types::Integer, diesel::sql_types::Text): load_dsl::private::CompatibleType<User, Mysql>` is not satisfied --> src/main.rs:20:31 |20 | users::table.load::<User>(&mut conn); | ---- ^^^^^^^^^ the trait `load_dsl::private::CompatibleType<User, Mysql>` is not implemented for `(diesel::sql_types::Integer, diesel::sql_types::Text)` | | | required by a bound introduced by this call | = help: the following other types implement trait `load_dsl::private::CompatibleType<U, DB>`: (ST0, ST1) (ST0, ST1, ST2) (ST0, ST1, ST2, ST3) (ST0, ST1, ST2, ST3, ST4) (ST0, ST1, ST2, ST3, ST4, ST5) (ST0, ST1, ST2, ST3, ST4, ST5, ST6) (ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7) (ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, ST8) and 24 others = note: required for `users::table` to implement `LoadQuery<'_, _, User>`note: required by a bound in `diesel::RunQueryDsl::load` --> /home/weiznich/.cargo/git/checkouts/diesel-6e3331fb3b9331ec/ef6252e/diesel/src/query_dsl/mod.rs:1543:15 |1543 | Self: LoadQuery<'query, Conn, U>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `diesel::RunQueryDsl::load`This is caused by an field order mismatch between what your query returns and what your struct expects the query to return.
With diesel 2.0 we introduced the Selectable trait and a corresponding derive. That allows to automatically generate a matching select clause to prevent such issues from happening. While this already solved parts of the problem it does not solve the following case:
#[derive(Queryable, Selectable)]struct User { name: i32, id: i32,}
users::table.select(User::as_select()).load(&mut conn);which generates the following error message:
error[E0277]: the trait bound `expression::select_by::SelectBy<User, _>: load_dsl::private::CompatibleType<_, _>` is not satisfied --> src/main.rs:20:49 |20 | users::table.select(User::as_select()).load(&mut conn); | ---- ^^^^^^^^^ the trait `load_dsl::private::CompatibleType<_, _>` is not implemented for `expression::select_by::SelectBy<User, _>` | | | required by a bound introduced by this call | = help: the trait `load_dsl::private::CompatibleType<U, DB>` is implemented for `expression::select_by::SelectBy<U, DB>` = note: required for `SelectStatement<FromClause<users::table>, query_builder::select_clause::SelectClause<expression::select_by::SelectBy<User, _>>>` to implement `LoadQuery<'_, _, _>`note: required by a bound in `diesel::RunQueryDsl::load` --> /home/weiznich/.cargo/git/checkouts/diesel-6e3331fb3b9331ec/ef6252e/diesel/src/query_dsl/mod.rs:1543:15 |1543 | Self: LoadQuery<'query, Conn, U>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `diesel::RunQueryDsl::load`This is caused by a type mismatch in the name field. With diesel 2.1 we now introduce an additional #[diesel(check_for_backend(diesel::backend::BackendType))] attribute that greatly improves the error messages generated for these cases. This helps pining down which field exactly causes a type mismatch.
By applying this attribute to our example:
#[derive(Queryable, Selectable)]#[diesel(check_for_backend(diesel::mysql::Mysql))]struct User { name: i32, id: i32,}we get the following error message:
error[E0277]: the trait bound `i32: FromSql<diesel::sql_types::Text, Mysql>` is not satisfied --> src/main.rs:13:11 |13 | name: i32, | ^^^ the trait `FromSql<diesel::sql_types::Text, Mysql>` is not implemented for `i32` | = help: the trait `FromSql<diesel::sql_types::Integer, Mysql>` is implemented for `i32` = note: required for `i32` to implement `diesel::Queryable<diesel::sql_types::Text, Mysql>` = note: required for `i32` to implement `FromSqlRow<diesel::sql_types::Text, Mysql>` = help: see issue #48214This error message now points to the exact cause of the issue: You cannot deserialize an Text value into a i32 field. This attribute accepts one or more diesel backend type to check the struct definition against. It requires that the struct is using either both, #[derive(Queryable)] and #[derive(Selectable)] or #[derive(QueryableByName)].
Internal changes
Changes listed here are relevant for crates using the i-implement-a-third-party-backend-and-opt-into-breaking-changes feature flag.
With Diesel 2.1 we have migrated some traits to use GAT. This affects the following traits:
RowGatWorkaroundConnectionGatWorkaroundHasRawValueHasBindCollector
These traits are removed in favour of generic associated types on the corresponding child trait.
Additionally we slightly relaxed one trait bound on BindCollector::push_bound_value to allow unsized values there as well.
Thanks
Thank you to everyone who helped make this release happen through sponsoring, bug reports, and discussion on GitHub and Gitter. While we don’t have a way to collect stats on that form of contribution, it’s greatly appreciated.
In addition to the Diesel core team, 42 people contributed code to this release. A huge thank you to:
- 6293
- Aleksei Orazov
- Alexx Roche
- AndrolGenhald
- AndyJado
- Artemis Livingstone
- czotomo
- Diana
- Elliott Forde
- Elrendio
- Gorg Worgington
- Heliozoa
- Ian
- Jake Goulding
- Jeff Schwab
- Jeremy Lardenois
- johnmai
- Leonardo Yvens
- mikemcdermottredjack
- Moritz Hedtke
- MOZGIII
- Neil Svedberg
- Neo
- Nishant Joshi
- Oliver Cooper
- Omid Rad
- Pablito Labarta
- Pavan Kumar Sunkara
- Peter Todorov
- Rutvik Patel
- Sanchith Hegde
- schlamar
- sebasv
- Silas McCroskey
- Šimon Lukašík
- Steven Chu
- stormofice
- Thomas Sieverding
- Trevor Gross
- Yuki Okushi
- 无穷无尽的爱
- 管唯宇
Diesel 2.1.1
Fixed
- Fixed an issue in diesel-cli that lead to using unquoted table names in one of the internal queries
- Fixed a bug in
diesel print-schemathat lead to generating invalidtable!macros if both the#[sql_name]and the#[max_lenght]attribute are present - Fixed an issue in diesel-cli that lead to ignoring certain foreign key constraints for postgresql
- Fixed an crash while using
diesel print-schemawith really old sqlite versions - Fixed an issue where
#[diesel(check_for_backend)]ignored#[diesel(deserialize_as)]attributes - Fixed several issues with the new
#[derive(MultiConnection)]feature - Fixed some edge cases in our sqlite timestamp parsing behaviour
diesel migration generate --diff-schemanow respects table filters as setup forprint-schemaviadiesel.toml- Fixed a potential breaking change around queries containing
DISTINCT ONandORDER BYclauses consisting of custom sql expressions (e.g.diesel::dsl::sql)
Added
- Support for bigdecimal 0.4
You can support the development of diesel by sponsoring the project on github
Diesel 2.1.2
- Fixed another potential breaking chaneg around queries containing
DISTINCT ONandORDER BYclauses consisting of custom sql expressions (e.g..nullable()) - Fixed an issue where
#[derive(Selectable)]and#[diesel(check_for_backend)]generates invalid rust code if the struct contains lifetimes/generic types
You can support the development of diesel by contributions or by sponsoring the project on Github.
Diesel 2.1.3
- Increased accidentally decreased limit around element count in
DISTINCT ONandORDER BYclauses again as that broke existing code
Diesel 2.1.4
- Update
libsqlite3-systo allow version 0.27 as well
You can support the development of diesel by contributions or by sponsoring the project on Github.
Diesel 2.1.5
- Fix
impl SqlOrdpostgres > postgres_backend feature flag. - Allow
Queryableto be used with multiple table names. - Update
libsqlite3-systo allow version 0.28 as well
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.1.4…v2.1.5
Diesel 2.1.6
- Fix using
BoxableExpressionwith having clauses - Fix using numeric expressions with aliased fields
- Minor documentation fixes
You can support the development of diesel by contributions or by sponsoring the project on Github.
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.1.5…v2.1.6
Diesel 2.2.0
This release wouldn’t be possible without the support of our contributors and sponsors. If you want to support diesels development, consider joining the reviewer team, submitting PR’s, help writing documentation or sponsor the maintainers.
Added
- Support
[print_schema] exclude_custom_type_definitions = ["Vector"]. If acustom typematches one element on the list it’s skipped. - Added automatic usage of all sqlite
rowidaliases when no explicit primary key is defined forprint-schema - Added a
#[dsl::auto_type]attribute macro, allowing to infer type of query fragment functions - Added the same type inference on
Selectablederives, which allows skipping specifyingselect_expression_typemost of the time, in turn enabling most queries to be written using just aSelectablederive. - Added an optional
#[diesel(skip_insertion)]field attribute to theInsertablederive macro, allowing fields which map to generated columns to be skipped during insertion. - Support for connection instrumentation. This allows to inspect any query run by your application
- Logging in diesel-cli
- Support for libsqlite3-sys 0.28
- Add
sqlite-integer-primary-key-is-bigintconfiguration option, usable with SQLite 3.37 or above, allowing to useBigIntforINTEGER PRIMARY KEYcolumns in SQLite for tables without theWITHOUT ROWIDattribute (SQLite doc). - Support for multiple
print_schemaentry indiesel.toml(e.g.[print_schema.user1]), which allows generating multiple schema.rs files - Add support for
COPY TOandCOPY FROMstatements - Add support for mapping
chrono::Durationto postgresql’sINTERVALsql type - Added
serialize_database_to_bufferanddeserialize_readonly_database_from_buffermethods inSqliteConnectionto support serialization/deserialization of SQLite databases to and from byte buffers. - Added
SerializedDatabasewrapper type for a serialized database that is dynamically allocated by callingserialize_database_to_buffer. This RAII wrapper deallocates the memory when it goes out of scope withsqlite3_free.
Changed
- The minimal officially supported rustc version is now 1.78.0
- Deprecated
sql_function!in favour ofdefine_sql_function!which provides compatibility with#[dsl::auto_type] - Deserialization error messages now contain information about the field that failed to deserialize
New Contributors
- @tp-woven made their first contribution in https://github.com/diesel-rs/diesel/pull/3650
- @aumetra made their first contribution in https://github.com/diesel-rs/diesel/pull/3657
- @sintemal made their first contribution in https://github.com/diesel-rs/diesel/pull/3660
- @DannyGoldberg made their first contribution in https://github.com/diesel-rs/diesel/pull/3681
- @ernest-rudnicki made their first contribution in https://github.com/diesel-rs/diesel/pull/3690
- @cr0sh made their first contribution in https://github.com/diesel-rs/diesel/pull/3699
- @dsp made their first contribution in https://github.com/diesel-rs/diesel/pull/3713
- @snf made their first contribution in https://github.com/diesel-rs/diesel/pull/3714
- @moulins made their first contribution in https://github.com/diesel-rs/diesel/pull/3724
- @surban made their first contribution in https://github.com/diesel-rs/diesel/pull/3734
- @gmanninglive made their first contribution in https://github.com/diesel-rs/diesel/pull/3725
- @BlackDex made their first contribution in https://github.com/diesel-rs/diesel/pull/3747
- @retro-git made their first contribution in https://github.com/diesel-rs/diesel/pull/3792
- @moyeah made their first contribution in https://github.com/diesel-rs/diesel/pull/3805
- @kriswuollett made their first contribution in https://github.com/diesel-rs/diesel/pull/3777
- @szepeviktor made their first contribution in https://github.com/diesel-rs/diesel/pull/3821
- @hgzimmerman made their first contribution in https://github.com/diesel-rs/diesel/pull/3841
- @brocaar made their first contribution in https://github.com/diesel-rs/diesel/pull/3854
- @peter-scholtens made their first contribution in https://github.com/diesel-rs/diesel/pull/3855
- @formlogic-kirk made their first contribution in https://github.com/diesel-rs/diesel/pull/3862
- @yagince made their first contribution in https://github.com/diesel-rs/diesel/pull/3888
- @c410-f3r made their first contribution in https://github.com/diesel-rs/diesel/pull/3879
- @dullbananas made their first contribution in https://github.com/diesel-rs/diesel/pull/3904
- @colem213 made their first contribution in https://github.com/diesel-rs/diesel/pull/3908
- @greyblake made their first contribution in https://github.com/diesel-rs/diesel/pull/3917
- @longsleep made their first contribution in https://github.com/diesel-rs/diesel/pull/3926
- @dennybiasiolli made their first contribution in https://github.com/diesel-rs/diesel/pull/3939
- @epompeii made their first contribution in https://github.com/diesel-rs/diesel/pull/3849
- @stormshield-kg made their first contribution in https://github.com/diesel-rs/diesel/pull/3940
- @sabify made their first contribution in https://github.com/diesel-rs/diesel/pull/3943
- @forest1102 made their first contribution in https://github.com/diesel-rs/diesel/pull/3796
- @dvogel made their first contribution in https://github.com/diesel-rs/diesel/pull/3921
- @Tanguille made their first contribution in https://github.com/diesel-rs/diesel/pull/3956
- @ISibboI made their first contribution in https://github.com/diesel-rs/diesel/pull/3751
- @DavisRayM made their first contribution in https://github.com/diesel-rs/diesel/pull/3982
- @kornelski made their first contribution in https://github.com/diesel-rs/diesel/pull/3980
- @momobel made their first contribution in https://github.com/diesel-rs/diesel/pull/3977
- @Sagebati made their first contribution in https://github.com/diesel-rs/diesel/pull/4002
- @MixusMinimax made their first contribution in https://github.com/diesel-rs/diesel/pull/4026
- @tommymcc made their first contribution in https://github.com/diesel-rs/diesel/pull/4021
- @dessalines made their first contribution in https://github.com/diesel-rs/diesel/pull/4019
- @bachmannscode made their first contribution in https://github.com/diesel-rs/diesel/pull/4015
- @McDic made their first contribution in https://github.com/diesel-rs/diesel/pull/4037
- @z33ky made their first contribution in https://github.com/diesel-rs/diesel/pull/4030
- @JonBoyleCoding made their first contribution in https://github.com/diesel-rs/diesel/pull/3944
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.1.0…v2.2.0
Diesel 2.2.1
You can support the development of diesel by contributions or by sponsoring the project on Github.
- Fixed using
#[dsl::auto_type]with functions that accept reference arguments - Fixed using
#[derive(Queryable)]with structs that use a type namedRowas field type - Fixed a regression that prevented using
mysqlclient-sys0.2.x with diesel 2.2 - Fixed connecting to postgres database using the scram-sha-256 authentication method on windows while using the bundled postgres builds
- Improved the error messages in diesel-cli for cases where a file/folder was not found
- Fixed several version detection bugs in mysqlclient-sys to use pre-generated bindings in more situations
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.2.0…v2.2.1
Diesel 2.2.2
- Support for libsqlite3-sys 0.29.0
- Fixed a potential panic in the sqlite cursor implementation
- Fixed support for rust numeric operators with columns of the type
Numeric - Removed the
SerializedDatabase::newfunction due to unsoundness
You can support the development of diesel by contributions or by sponsoring the project on Github.
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.2.1…v2.2.2
Diesel 2.2.3
- Support for libsqlite3-sys 0.30.0
- Fixed a possible vulnerability in how Diesel handled protocol level bind parameters. See the SQL Injection isn’t Dead: Smuggling Queries at Protocol Level presentation from DEF CON for details
- Fixed an issue with a possibly ambiguous trait resolution in
#[derive(QueryableByName)]
You can support the development of diesel by contributions or by sponsoring the project on Github.
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.2.2…v2.2.3
Diesel 2.2.4
Fixed
- Fix an issue where empty queries could trigger undefined behaviour in the sqlite backend
Diesel 2.2.5
- Add a typedef for
ReturningandCountso that#[auto_type]works with such queries - Fixed an issue that allowed to pass non-boolean expressions to
.and()and.or()which would result in queries failing at runtime - Officially deprecating the gitter room
You can support the development of diesel by contributions or by sponsoring the project on Github.
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.2.4…v2.2.5
Diesel 2.2.6
What’s Changed
- Remove more mentions of gitter from the documentation
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.2.5…v2.2.6
Diesel 2.2.7
Fixed
- Fixed diesel thinking
a.eq_any(b)was non-nullable even ifaandbwere nullable. - Generate
InstrumentationEvent::BeginTransactionfor immediate and exclusive transactions in SQLite - Minimize the amount of duplicated code generated for
diesel::debug_query - Updated
ipnetworkto allow version 0.21. - Updated
libsqlite3-systo allow version 0.31.0 - Updated
pq-systo allow version 0.7.0 - Add support for numeric operators (+-*/) in
#[diesel::auto_type] - Add support for joins to sub-jons to aliases
You can support the development of diesel by contributions or by sponsoring the project on Github
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.2.6…v2.2.7
Diesel 2.2.8
Fixed
- Allow
#[diesel(check_for_backend(_))]to check fields with#[diesel(embed)]annotations - Improve custom compile error message around
CompatibleType - Fix a bug that restricted the number of allowed columns in
COPY FROMstatements to 12 - Expose some SqliteValue helper functions
- Use consistent whitespace in
ASC/DESC,DISTINCT ON, andDELETE FROMclauses
You can support the development of diesel by contributions or by sponsoring the project on Github
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.2.7…v2.2.8
Diesel 2.2.9
Fixed
- Fix an issue where
diesel migration generate --diff-schemaincorrectly uses the primary key of table B as the referenced column rather than the primary key of table A when B has a foreign key pointing to table A. - Bump maximal supported libsqlite3-sys version to 0.32.0 and add explicit feature entries for the
uuidandserde_jsonfeature. - Fixed an issue where diesel generated unnamed prepared statements would fail with an
unanmed prepared statement not founderror with pgbouncer. - Fix an issue with converting
ipnet::Ipnetvalues with an subnet to SQL values
You can support the development of diesel by contributions or by sponsoring the project on Github
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.2.8…v2.2.9
Diesel 2.2.10
Fixed
- Support for libsqlite3-sys 0.33.0
- Fixed potential ambiguities in code generated by various derives
You can support the development of diesel by contributions or by sponsoring the project on Github
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.2.9…v2.2.10
Diesel 2.2.11
What’s Changed
- Disallow mixing aggregate and non-aggregate expressions in
DISTINCT ONclauses - Fixed an item referenced by a non-absolute path in
#[derive(MultiConnection)] - Improved compiler errors in some cases
- Improved the documentation for creating SqliteConnections for concurrent applications
You can support the development of Diesel by contributions or by sponsoring the project on Github
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.2.10…v2.2.11
Diesel 2.2.12
Fixed
- Added support for libsqlite3-sys 0.35.0
- Fixed a wrong oid for the
oid[]type in the PostgreSQL backend - Worked around an issue with broken nullable detection with certain versions of libmysqlclient shipped by ubuntu
- Improved compiler errors in many more cases
You can support the development of Diesel by contributions or by sponsoring the project on GitHub
Call for Input
We are looking for input on a newly designed derive to make constructing queries easier. See here for details.
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.2.11…v2.2.12
Diesel 2.3.0
This release includes a several large extensions to the query DSL provided by Diesel and also helps increases the number of platforms you can use Diesel on out of the box. Notable changes include:
- Improved query construction via
#[derive(HasQuery)] - Added support for window functions
- Using SQLite with WASM in your browser
- Extended support for various types, functions and operators in the PostgreSQL backend
- Support for
JSONandJSONBin the SQLite backend
See the release blog for the full announcement
You can support the development of Diesel by:
- Contributing Code, Documentation or Guides. Checkout the planing for Diesel 2.4 for open tasks.
- Providing knowledge and help to maintain the MySQL/MariaDB backend. This is currently the only in-tree backend that is not used by any maintainers, so having someone around that actually uses this backend would be very helpful for the Diesel project.
- Answering questions in our discussion forum
- Reporting bugs in our issue tracker
- Helping triaging issues in our issue tracker
- Sponsoring the maintainers.
Added
- Added
limit()andoffset()DSL to combination clauses such asUNION - Fixed
#[derive(Identifiable)]ignoring attribute#[diesel(serialize_as)]on primary keys - Added embedded struct support for
AsChangesetvia#[diesel(embed)] - Added a
#[diesel(skip_update)]attribute for theAsChangesetderive to skip updating a field present in the struct - Support for libsqlite3-sys 0.35.0
- Add support for built-in PostgreSQL range operators and functions
- Support for postgres multirange type
- Added
diesel::r2d2::TestCustomizer, which allows users to customize theirdiesel::r2d2::Pools in a way that makes the pools suitable for use in parallel tests. - Added support for built-in PostgreSQL range operators and functions
- Added support for various built-in PostgreSQL array functions
- Added
JsonandJsonbsupport for the SQLite backend. - Added a
#[diesel::declare_sql_function]attribute macro to easily define support for multiple sql functions at once via anextern "SQL"block - Support
[print_schema] allow_tables_to_appear_in_same_query_config = "fk_related_tables"to generate separateallow_tables_to_appear_in_same_query!calls containing only tables that are related through foreign keys. (Default:"all_tables".) It is not possible to build queries using two tables that don’t appear in the sameallow_tables_to_appear_in_same_query!call, but that macro generates O(n²) rust code, so this option may be useful to reduce compilation time. (#4333) - Added
wasm32-unknown-unknowntarget support for sqlite backend. - Add support for the
CASToperator - Support
[print_schema] allow_tables_to_appear_in_same_query_config = "none"to generate noallow_tables_to_appear_in_same_query!calls. (Default:"all_tables".). (#4333) - Add
[print_schema] pg_domains_as_custom_typesparameter to generate custom types for PostgreSQL domains that matches any of the regexes in the given list. (Default:[].) This option allows an application to selectively give special meaning for the serialization/deserialization of these types, avoiding the default behavior of treating the domain as the underlying type. (#4592) - Add support for batch insert and upsert statements with returning for SQLite
- Add support for window functions and aggregate expressions.
Fixed
- Fixed diesel thinking
a.eq_any(b)was non-nullable even ifaandbwere nullable. - Generate
InstrumentationEvent::BeginTransactionfor immediate and exclusive transactions in SQLite - Use a single space instead of two spaces between
DELETE FROM. - Diesel CLI now ensures that migration versions are always unique. If it fails to generate a unique version, it will return an error. The new version format remains compatible with older Diesel versions.
- Updated
ipnetworkto allow version 0.21.
Changed
- Use distinct
DIESEL_LOGlogging filter env variable instead of the defaultRUST_LOGone (#4575) - The minimal supported Rust version is now 1.86.0
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.2.0…v2.3.0
Diesel 2.3.2
Fixed
- Fixed an incompatibility with libmariadb versions shipped by debian
- Fixed docs.rs builds
- Fixed applying patch file schema.rs file with formatting
- Allow to compare DatabaseErrorKind values
(Diesel 2.3.1 did not contain any changes beside the version bump to retrigger the docs.rs build)
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.3.0…v2.3.2
You can support the development of Diesel by:
- Contributing Code, Documentation or Guides. Checkout the planing for Diesel 2.4 for open tasks.
- Providing knowledge and help to maintain the MySQL/MariaDB backend. This is currently the only in-tree backend that is not used by any maintainers, so having someone around that actually uses this backend would be very helpful for the Diesel project.
- Answering questions in our discussion forum
- Reporting bugs in our issue tracker
- Helping triaging issues in our issue tracker
- Sponsoring the maintainers.
Diesel 2.3.3
Fixed
- Fix displaying binds in instrumentations for
#[derive(MultiConnection)] - Support artifact attestation for binaries build for releases
- Stop using absolute paths in generated diesel.toml
- Explicitly qualify
Okin code generated by derives to avoid naming conflicts
Starting with Diesel-CLI 2.3.3 you can verify that you downloaded the correct binaries via GitHub’s artifact attestation
gh attestation verify diesel_cli-x86_64-unknown-linux-gnu.tar.xz -R diesel-rs/dieselFull Changelog: https://github.com/diesel-rs/diesel/compare/v2.3.2…v2.3.3
You can support the development of Diesel by:
- Contributing Code, Documentation or Guides. Checkout the planing for Diesel 2.4 for open tasks.
- Providing knowledge and help to maintain the MySQL/MariaDB backend. This is currently the only in-tree backend that is not used by any maintainers, so having someone around that actually uses this backend would be very helpful for the Diesel project.
- Answering questions in our discussion forum
- Reporting bugs in our issue tracker
- Helping triaging issues in our issue tracker
- Sponsoring the maintainers.
Diesel 2.3.4
Fixed
- Fix an issue with breaking changes in libmariadb
- Fix documentation links for helper types
- Fix using
#[diesel(embed)]withOption<Inner>types - Fix documentation for concurrent migration runs
You can support the development of Diesel by:
- Contributing Code, Documentation or Guides. Checkout the planing for Diesel 2.4 for open tasks.
- Providing knowledge and help to maintain the MySQL/MariaDB backend. This is currently the only in-tree backend that is not used by any maintainers, so having someone around that actually uses this backend would be very helpful for the Diesel project.
- Answering questions in our discussion forum
- Reporting bugs in our issue tracker
- Helping triaging issues in our issue tracker
- Sponsoring the maintainers.
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.3.3…v2.3.4
Diesel 2.3.5
Fixes
- Fix another libmariadb related issue with time types
- Improve compile time error messages for
#[derive(Insertable)] - Bump supported version of sqlite-wasm-rs to 0.5.0
- Minor documentation fixes
- Make the
returning_clauses_for_sqlite_3_35feature enable thesqlitefeature by default - Include a fix for a nightly rust name resolution ambiguity
You can support the development of Diesel by:
- Contributing Code, Documentation or Guides. Checkout the planing for Diesel 2.4 for open tasks.
- Providing knowledge and help to maintain the MySQL/MariaDB backend. This is currently the only in-tree backend that is not used by any maintainers, so having someone around that actually uses this backend would be very helpful for the Diesel project.
- Answering questions in our discussion forum
- Reporting bugs in our issue tracker
- Helping triaging issues in our issue tracker
- Sponsoring the maintainers.
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.3.4…v2.3.5
Diesel 2.3.6 Latest
Fixed
- Added support for mysqlclient-sys 0.5.0
- Fix generating valid schema if a column is named
table - Fixed a regression with
#[derive(Insertable)]if the same field type is used with different lifetime values
You can support the development of Diesel by:
- Contributing Code, Documentation or Guides. Checkout the planing for Diesel 2.4 for open tasks.
- Providing knowledge and help to maintain the MySQL/MariaDB backend. This is currently the only in-tree backend that is not used by any maintainers, so having someone around that actually uses this backend would be very helpful for the Diesel project.
- Answering questions in our discussion forum
- Reporting bugs in our issue tracker
- Helping triaging issues in our issue tracker
- Sponsoring the maintainers.
Full Changelog: https://github.com/diesel-rs/diesel/compare/v2.3.5…v2.3.6