Changelog History
Page 1
-
v2.0.2 Changes
October 11, 2022๐ Fixed
- ๐ Reverted a fix from the 2.0.1 release that breaks valid
INSERT โฆ ON CONFLICT
queries
- ๐ Reverted a fix from the 2.0.1 release that breaks valid
-
v2.0.1 Changes
October 07, 2022๐ Fixed
- Fixed an issue with
diesel_cli
generating incompatible type names for thegenerate_missing_sql_type_definitions
feature on PostgreSQL - ๐ Fixed an issue how
diesel_cli
handles sqlite urls while checking if a given database exists - ๐ Fixed an issue with
PgConnection
becoming unusable after hitting a database error in certain situations - ๐ Fixed an issue with diesel generating invalid SQL for certain
INSERT โฆ ON CONFLICT
queries - 0๏ธโฃ Fixed
diesel_derives
generating code that triggers the disabled by defaultunused_qualifications
lint
- Fixed an issue with
-
v2.0.0 Changes
April 22, 2022โ Added
๐
MysqlConnection::establish
is able to initiate an SSL connection while specifying certificate roots. The database URL should contain anssl_ca
parameter with a path pointing to the certificate roots. See docs if desired.MysqlConnection::establish
is able to initiate an SSL connection. The database URL should containssl_mode
parameter with a value of the MySQL client command option--ssl-mode
if desired.Connection
andSimpleConnection
traits are implemented for a broader range ofr2d2::PooledConnection<M>
types when ther2d2
feature is enabled.โ Added
DatabaseErrorKind::ReadOnlyTransaction
to allow applications to handle errors caused by writing when only allowed to read.All expression methods can now be called on expressions of nullable types.
โ Added
BoxedSqlQuery
. This allows users to do a variable amount of.sql
or.bind
calls without changing the underlying type.โ Added
.sql
toSqlQuery
andUncheckedBind
to allow appending SQL code to an existing query.The
MacAddr
SQL type can now be used without enabling thenetwork-address
feature.โ Added support for SQLite's
UPSERT
. You can use this feature above SQLite version 3.24.0.โ Added ability to create custom aggregate functions in SQLite.
Multiple aggregate expressions can now appear together in the same select clause. See the upgrade notes for details.
ValidGrouping
has been added to represent whether an expression is valid for a given group by clause, and whether or not it's aggregate. It replaces the functionality ofNonAggregate
. See the upgrade notes for details.It is now possible to inspect the type of values returned from the database in such a way to support constructing a dynamic value depending on this type.
โ Added a
without-deprecated
feature that unconditionally disables deprecated items. Use this feature flag to verify that none of your dependencies is setting thewith-deprecated
flag internally.โ Added support for PostgreSQL's
SIMILAR TO
andNOT SIMILAR TO
.Added
#[diesel(serialize_as)]
analogous to#[diesel(deserialize_as)]
. This allows customization of the serialization behaviour ofInsertable
andAsChangeset
structs.โ Added support for
GROUP BY
clausesโ Added support for
UNION
,UNION ALL
,INTERSECT
,INTERSECT ALL
,EXCEPT
,EXCEPT ALL
clausesโ Added the error position for PostgreSQL errors
โ Added ability to create custom collation functions in SQLite.
โ Added support for SQLite's
IS
andIS NOT
.โ Add support for HAVING clauses.
โ Added support for SQL functions without arguments for SQLite.
Diesel CLI will now generate SQL type definitions for SQL types that are not supported by diesel out of the box. It's possible to disable this behavior via the
generate_missing_sql_type_definitions
config option.โ Added an option to
#[derive(Insertable)]
that let you insertNULL
values instead ofDEFAULT
values forOption<T>
โ Added support for all the derive attributes being inside
#[diesel(...)]
Added support for
RETURNING
expressions for Sqlite via thereturning_clauses_for_sqlite_3_35
featureโ Added support for table aliasing via the
alias!
macroโ Added support for the usage of slices of references with
belonging_to
fromBelongingToDsl
โ Added support for updating individual array elements
UPDATE table SET array_column[1] = true
โ Adds an
ipnet-address
feature flag, allowing support (de)serializing IP values from the database using types provided byipnet
. This feature may be enabled concurrently with the previously existingnetwork-address
feature.๐ We've added support for loading values using libpq's row-by-row mode via the new iterator interface
โ Adds
Timestamp
,Timestamptz
support for appropriate types fortime v0.3.9
. This feature enables using thetime
crate as an alternative tochrono
.
โ Removed
- ๐ All previously deprecated items have been removed.
- ๐ Support for
uuid
version < 0.7.0 has been removed. - ๐ Support for
bigdecimal
< 0.0.13 has been removed. - ๐ Support for
pq-sys
< 0.4.0 has been removed. - ๐ Support for
mysqlclient-sys
< 0.2.5 has been removed. - ๐ Support for
time
(0.1) types has been removed. - ๐ Support for
chrono
< 0.4.19 has been removed. - ๐ The minimal supported version of libsqlite3-sys is now 0.17.2.
- ๐ The
NonNull
trait for sql types has been removed in favour of the newSqlType
trait. no_arg_sql_function!
has been deprecated without replacement. [sql_function!
][sql-function-2-0-0] can now be used for functions with zero arguments. See the migration guide for more details.- ๐ Support for
barrel
based migrations has been removed for now. We are happy to add this support back as soon asbarrel
integrates with our new migration framework. - ๐ The deprecated bash completions command (
diesel bash-completions
) has been removed. Usediesel completions <shell>
instead.
๐ Changed
๐ The minimal officially supported rustc version is now 1.56.0
Interacting with a database requires a mutable connection.
The way [the
Backend
trait][backend-2-0-0] handles itsRawValue
type has been changed to allow non-references. Users of this type (e.g. code written&DB::RawValue
or&<DB as Backend>::RawValue>
) should use [backend::RawValue<DB>
][raw-value-2-0-0] instead. Implementors ofBackend
should check the relevant section of the migration guide.
๐ [backend-2-0-0]: http://docs.diesel.rs/diesel/backend/trait.Backend.html ๐ [raw-value-2-0-0]: http://docs.diesel.rs/diesel/backend/type.RawValue.html
๐ The type metadata for MySQL has been changed to include sign information. If you are implementing
HasSqlType
forMysql
manually, you may need to adjust your implementation to fully use the new unsigned variants inMysqlType
The
RawValue
types for theMysql
andPostgresql
backend where changed from[u8]
to distinct opaque types. If you used the concreteRawValue
type somewhere you need to change it tomysql::MysqlValue
orpg::PgValue
.๐ The
uuidv07
feature was renamed touuid
, due to the removal of support for older uuid versionsBoxed queries (constructed from
.into_boxed()
) are nowSend
.The handling of mixed aggregate values is more robust. Invalid queries such as
.select(max(id) + other_column)
are now correctly rejected, and valid queries such as.select((count_star(), max(other_column)))
are now correctly accepted. For more details, see [the migration guide](2-0-migration).NonAggregate
is now a trait alias forValidGrouping<()>
for expressions that are not aggregate. On stable this is a normal trait with a blanket impl, but it should never be implemented directly. With theunstable
feature, it will use trait aliases which prevent manual implementations.
Due to language limitations, we cannot make the new trait alias by itself represent everything it used to, so in some rare cases code changes may be required. See [the migration guide](2-0-migration) for details.
Various
__NonExhaustive
variants in different (error-) enums are replaced with#[non_exhaustive]
. If you matched on one of those variants explicitly you need to introduce a wild card match instead.FromSql::from_sql
is changed to construct value from non nullable database values. To construct a rust value for nullable values use the newFromSql::from_nullable_sql
method instead.Custom sql types are now required to implement the new
SqlType
trait. Diesel will automatically create implementations of that trait for all types having a#[derive(SqlType)]
๐ The workflow for manually implementing support custom types has changed. Implementing
FromSqlRow<ST, DB>
is not required anymore, as this is now implied by implementingFromSql<ST, DB>
. The requirement of implementingQueryable<ST, DB>
remains unchanged. For types using#[derive(FromSqlRow)]
no changes are required as the derive automatically generates the correct codeThe structure of our deserialization trait has changed. Loading values from the database requires now that the result type implements
FromSqlRow<ST, DB>
. Diesel provides wild card implementations for types implementingQueryable<ST, DB>
orQueryableByName<DB>
so non generic code does not require any change. For generic code you likely need to replace a trait bound onQueryable<ST, DB>
with a trait bound onFromSqlRow<ST, DB>
and a bound toQueryableByName<DB>
withFromSqlRow<Untyped, DB>
.CLI flags of
only-tables
andexcept-tables
are now interpreted as regular expressions. Similarly,only_tabels
andexcept_tables
indiesel.toml
are treated as regular expressions.Now you can sort column fields by name with the
column-sorting
option. It can be set to eitherordinal_position
(default) orname
. This ensures stable sorting even if columns are removed and re-added.โก๏ธ The
Queryable<ST,DB>
trait was updated to be made faillible, in order to properly handle cases where you detect a data inconsistency between fields on deserialization (that e.g. was supposed to be made impossible by DBCHECK
s). Thebuild
function now returns adiesel::deserialize::Result<Self>
instead of aSelf
.๐
TypeMetadata::MetadataLookup
is now?Sized
.Multiple implementations of
Connection<Backend=Pg>
are now possible because of the newPgMetadataLookup
trait.๐ For the
Pg
backend,TypeMetadata::MetadataLookup
has changed todyn PgMetadataLookup
.Diesel's migration framework was rewritten from the ground. Existing migrations continue to be compatible with the rewrite, but code calling into
diesel_migrations
requires an update. See the [migration guide](2-0-migration) for details.eq_any()
now emits a= ANY()
expression for the postgresql backend instead ofIN()
ne_all()
now emits a!= ALL()
expression for the postgresql backend instead ofNOT IN()
0๏ธโฃ The sqlite backend now uses a single batch insert statement if there are now default values present in the values clause
The MySQL connection is using the CLIENT_FOUND_ROWS from now on. This means that updating rows without changing any values will return the number of matched rows (like most other SQL servers do), as opposed to the number of changed rows.
The definition of
ToSql::to_sql
andQueryFragment::walk_ast
has changed to allow serializing values without copying the value itself. This is useful for database backends like sqlite where you can directly share a buffer with the database. Beside of the changed signature, existing impls of this trait should remain unchanged in almost all cases.The
PIPES_AS_CONCAT
sql_mode is no longer set 0๏ธโฃ by default. This setting requires a modification to MySQL query parsing that is ๐ not supported by certain systems (such as Vitess). If you are using MySQL and executing raw queries with the||
operator, you will need to rewrite your queries or setPIPES_AS_CONCAT
manually.
๐ Fixed
Many types were incorrectly considered non-aggregate when they should not have been. All types in Diesel are now correctly only considered non-aggregate if their parts are.
Offset clauses without limit clauses resulted into invalid sql using the mysql or sqlite backend. Both do not support such clauses without a preceding limit clause. For those backend Diesel does now generate a fake limit clause in case no explicit limit clause was given. As consequence of this change generic query code may require additional trait bounds as requested from the compiler. Third party backends are required to explicitly provide
QueryFragment
impls forLimitOffsetClause<L, O>
now.Nullability requirements are now properly enforced for nested joins. Previously, only the rules for the outer-most join were considered. For example,
users.left_join(posts).left_join(comments)
would allow selecting any columns fromposts
. That will now fail to compile, and any selections fromposts
will need to be made explicitly nullable.Diesel CLI will now look for
diesel.toml
to determine the project root before looking forCargo.toml
.Any relative paths in
diesel.toml
will now be treated as relative to the project root (the directory containing eitherdiesel.toml
orCargo.toml
). They are no longer dependent on the current working directory (for all directories in the same project)๐ง The SQLite backend is now configured to interpret URIs. See [the SQLite URI documentation] for additional details.
๐ [the SQLite URI documentation]: https://www.sqlite.org/uri.html
๐จ We've refactored our type translation layer for Mysql to handle more types now.
๐จ We've refactored our type level representation of nullable values. This allowed us to fix multiple long standing bugs regarding the correct handling of nullable values in some corner cases (#104, #2274)
Parenthesis are now inserted around all infix operations provided by diesel's
ExpressionMethods
traitsQueries containing a
distinct on
clause check now on compile time that a compatible order clause was set.Implementations of custom SQLite SQL functions now check for panics
๐จ
diesel print-schema
now generatesArray<Nullable<ST>>
rather thanArray<ST>
for Postgres Array types. Existence ofNULL
values in database arrays would previously result in deserialization errors. Non-nullable arrays are now opt in (by schema patching).
๐ Deprecated
All the diesel derive attributes that are not inside
#[diesel(...)]
diesel_(prefix|postfix|infix)_operator!
have been deprecated. These macros are now available without thediesel_
prefix. With Rust 2018 they can be invoked asdiesel::infix_operator!
instead.๐
diesel::pg::upsert
has been deprecated to support upsert queries on more than one backend. Please usediesel::upsert
instead.๐
diesel::dsl::any
anddiesel::dsl::all
are now deprecated in favour ofExpressionMethods::eq_any()
andExpressionMethods::ne_all()
-
v1.4.8 Changes
September 20, 2021๐ Fixed
- ๐ Fixed a incompatibly between
diesel
anddiesel_migrations
when building both crates with cargos newresolver = "2"
enabled. This change ensures compatibility with the upcomming 2021 rust edition.
- ๐ Fixed a incompatibly between
-
v1.4.7 Changes
June 08, 2021๐ Fixed
- โก๏ธ Updated
libsqlite3-sys
to allow version 0.22 - โก๏ธ Updated
ipnetwork
to allow version 0.18
- โก๏ธ Updated
-
v1.4.6 Changes
March 05, 2021๐ Fixed
- ๐ Fixed a use-after-free issue in the
QueryableByName
implementation of ourSqlite
backend - โก๏ธ Updated several dependencies
- ๐ Fixed a use-after-free issue in the
-
v1.4.5 Changes
June 09, 2020๐ 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
libmysqlclient
versions - โ Remove some potential harmful usages of
mem::uninitialized
-
v1.4.4 Changes
March 22, 2020๐ Fixed
- โก๏ธ Update several dependencies
- ๐ Fixed a bug with printing embedded migrations
As part of this release also updated versions of
migration_internals
andmigration_macros
are published. -
v1.4.3 Changes
October 11, 2019๐ 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_derives
anddiesel_migrations
are updated to syn 1.0
-
v1.4.2 Changes
March 19, 2019๐ Fixed
- Parenthesis are now inserted around all mathematical operations. This means
that
(2.into_sql() + 3) * 4
will correctly evaluate to 20 as expected. Previously we would generate SQL that evaluated to 14. This could even result in runtime errors if multiple types were involved (for example,interval * (integer + 1)
)
- Parenthesis are now inserted around all mathematical operations. This means
that