A safe, extensible ORM and Query Builder for Rust
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.
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.
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.
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.
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.
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.
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!
In addition to the Diesel core and committer teams, 10 people contributed to this release. A huge thank you to:
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!
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:
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.
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:
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.
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.
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.
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.
In addition to the core team, 10 people contributed to this release. A huge thank you to:
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.
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:
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: