All Versions
62
Latest Version
Avg Release Cycle
91 days
Latest Release
56 days ago

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
  • v2.0.1 Changes

    October 07, 2022

    ๐Ÿ›  Fixed

    • Fixed an issue with diesel_cli generating incompatible type names for the generate_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 default unused_qualifications lint
  • 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 an ssl_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 contain ssl_mode parameter with a value of the MySQL client command option --ssl-mode if desired.

    • Connection and SimpleConnection traits are implemented for a broader range of r2d2::PooledConnection<M> types when the r2d2 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 to SqlQuery and UncheckedBind to allow appending SQL code to an existing query.

    • The MacAddr SQL type can now be used without enabling the network-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 of NonAggregate. 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 the with-deprecated flag internally.

    • โž• Added support for PostgreSQL's SIMILAR TO and NOT SIMILAR TO.

    • Added #[diesel(serialize_as)] analogous to #[diesel(deserialize_as)]. This allows customization of the serialization behaviour of Insertable and AsChangeset 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 and IS 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 insert NULL values instead of DEFAULT values for Option<T>

    • โž• Added support for all the derive attributes being inside #[diesel(...)]

    • Added support for RETURNING expressions for Sqlite via the returning_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 from BelongingToDsl

    • โž• 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 by ipnet. This feature may be enabled concurrently with the previously existing network-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 for time v0.3.9. This feature enables using the time crate as an alternative to chrono.

    โœ‚ 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 new SqlType 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 as barrel integrates with our new migration framework.
    • ๐Ÿšš The deprecated bash completions command (diesel bash-completions) has been removed. Use diesel 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 its RawValue 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 of Backend 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 for Mysql manually, you may need to adjust your implementation to fully use the new unsigned variants in MysqlType

    • The RawValue types for the Mysql and Postgresql backend where changed from [u8] to distinct opaque types. If you used the concrete RawValue type somewhere you need to change it to mysql::MysqlValue or pg::PgValue.

    • ๐Ÿ‘ The uuidv07 feature was renamed to uuid, due to the removal of support for older uuid versions

    • Boxed queries (constructed from .into_boxed()) are now Send.

    • 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 for ValidGrouping<()> 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 the unstable 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 new FromSql::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 implementing FromSql<ST, DB>. The requirement of implementing Queryable<ST, DB> remains unchanged. For types using #[derive(FromSqlRow)] no changes are required as the derive automatically generates the correct code

    • The 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 implementing Queryable<ST, DB> or QueryableByName<DB> so non generic code does not require any change. For generic code you likely need to replace a trait bound on Queryable<ST, DB> with a trait bound on FromSqlRow<ST, DB> and a bound to QueryableByName<DB> with FromSqlRow<Untyped, DB>.

    • CLI flags of only-tables and except-tables are now interpreted as regular expressions. Similarly, only_tabels and except_tables in diesel.toml are treated as regular expressions.

    • Now you can sort column fields by name with the column-sorting option. It can be set to either ordinal_position (default) or name. 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 DB CHECKs). The build function now returns a diesel::deserialize::Result<Self> instead of a Self.

    • ๐Ÿ“‡ TypeMetadata::MetadataLookup is now ?Sized.

    • Multiple implementations of Connection<Backend=Pg> are now possible because of the new PgMetadataLookup trait.

    • ๐Ÿ“‡ For the Pg backend, TypeMetadata::MetadataLookup has changed to dyn 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 of IN()

    • ne_all() now emits a != ALL() expression for the postgresql backend instead of NOT 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 and QueryFragment::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 set PIPES_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 for LimitOffsetClause<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 from posts. That will now fail to compile, and any selections from posts will need to be made explicitly nullable.

    • Diesel CLI will now look for diesel.toml to determine the project root before looking for Cargo.toml.

    • Any relative paths in diesel.toml will now be treated as relative to the project root (the directory containing either diesel.toml or Cargo.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 traits

    • Queries 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 generates Array<Nullable<ST>> rather than Array<ST> for Postgres Array types. Existence of NULL 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 the diesel_ prefix. With Rust 2018 they can be invoked as diesel::infix_operator! instead.

    • ๐Ÿ—„ diesel::pg::upsert has been deprecated to support upsert queries on more than one backend. Please use diesel::upsert instead.

    • ๐Ÿ—„ diesel::dsl::any and diesel::dsl::all are now deprecated in favour of ExpressionMethods::eq_any() and ExpressionMethods::ne_all()

  • v1.4.8 Changes

    September 20, 2021

    ๐Ÿ›  Fixed

    • ๐Ÿ›  Fixed a incompatibly between diesel and diesel_migrations when building both crates with cargos new resolver = "2" enabled. This change ensures compatibility with the upcomming 2021 rust edition.
  • v1.4.7 Changes

    June 08, 2021

    ๐Ÿ›  Fixed

    • โšก๏ธ Updated libsqlite3-sys to allow version 0.22
    • โšก๏ธ Updated ipnetwork to allow version 0.18
  • v1.4.6 Changes

    March 05, 2021

    ๐Ÿ›  Fixed

    • ๐Ÿ›  Fixed a use-after-free issue in the QueryableByName implementation of our Sqlite backend
    • โšก๏ธ Updated several dependencies
  • 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 and migration_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 and diesel_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))