NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #2071 most downloaded on crates.io
Internal implementation of diesels migration mechanism
Last release 1 years ago
12 Sep 2025
Release timing varies
gaps range from 5 weeks to 2.1 years
Most releases are documented
notes for 12 of 14 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
18 releases · first in 2017
Added limit() and offset() DSL to combination clauses such as UNION
limit() and offset() DSL to combination clauses such as UNION#[derive(Identifiable)] ignoring attribute #[diesel(serialize_as)] on primary keysAsChangeset via #[diesel(embed)]#[diesel(skip_update)] attribute for the AsChangeset derive to skip updating a field present in the structdiesel::r2d2::TestCustomizer, which allows users to customize their diesel::r2d2::Pools
in a way that makes the pools suitable for use in parallel tests.Json and Jsonb support for the SQLite backend.#[diesel::declare_sql_function] attribute macro to easily define support for
multiple sql functions at once via an extern "SQL" block[print_schema] allow_tables_to_appear_in_same_query_config = "fk_related_tables" to generate separate allow_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 same allow_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)wasm32-unknown-unknown target support for sqlite backend.CAST operator[print_schema] allow_tables_to_appear_in_same_query_config = "none" to generate no allow_tables_to_appear_in_same_query! calls. (Default: "all_tables".). (#4333)[print_schema] pg_domains_as_custom_types parameter 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)a.eq_any(b) was non-nullable even if a and b were nullable.InstrumentationEvent::BeginTransaction for immediate and exclusive transactions in SQLiteDELETE FROM.ipnetwork to allow version 0.21.DIESEL_LOG logging filter env variable instead of the default RUST_LOG one (#4575)One column per quarter.
Nothing published for this version
Deprecated sql_function! in favour of define_sql_function! which provides compatibility with #[dsl::auto_type]
[print_schema] except_custom_type_definitions = ["Vector"]. If a custom type matches one element on the list it's skipped.rowid aliases when no explicit primary key is defined for print-schema#[dsl::auto_type] attribute macro, allowing to infer type of query fragment functionsSelectable derives, which allows skipping specifying select_expression_type most of the time, in turn enabling most queries to be written using just a Selectable derive.#[diesel(skip_insertion)] field attribute to the Insertable derive macro, allowing fields which map to generated columns to be skipped during insertion.sqlite-integer-primary-key-is-bigint configuration option, usable with SQLite 3.37 or above, allowing to use BigInt for INTEGER PRIMARY KEY columns in SQLite for tables without the WITHOUT ROWID attribute (SQLite doc).print_schema entry in diesel.toml (e.g. [print_schema.user1]), which allows generating multiple schema.rs filesCOPY TO and COPY FROM statementschrono::Duration to postgresql's INTERVAL sql typeserialize_database_to_buffer and deserialize_readonly_database_from_buffer methods in SqliteConnection to support serialization/deserialization of SQLite databases to and from byte buffers.SerializedDatabase wrapper type for a serialized database that is dynamically allocated by calling serialize_database_to_buffer. This RAII wrapper deallocates the memory when it goes out of scope with sqlite3_free.sql_function! in favour of define_sql_function! which provides compatibility with #[dsl::auto_type]The minimal officially supported rustc version is now 1.65.0
custom_type_derives config option to customize the derives for SQL
type definitions automatically generated by Diesel CLI.#[derive(MultiConnection)] proc-macro that lets you easily implement diesel::Connection
for an enum of connections to different database backends.--diff-schema flag to the diesel migration generate command that generates a migration based
on the difference between your database and the provided schema.rs fileON CONFLICT (...) DO UPDATE ... [WHERE ...] conditional clause support for PostgreSQL.ON DUPLICATE KEY DO UPDATE syntax through the existing upsert functions.distinct_on for PostgreSQL,
like: .distinct_on((column_a, column_b)).schema.rs fileAdded a without-deprecated feature that unconditionally disables deprecated items. Use this feature flag to verify that none of your dependencies is s…
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.
uuid version < 0.7.0 has been removed.bigdecimal < 0.0.13 has been removed.pq-sys < 0.4.0 has been removed.mysqlclient-sys < 0.2.5 has been removed.time (0.1) types has been removed.chrono < 0.4.19 has been removed.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.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.diesel bash-completions) has been removed.
Use diesel completions <shell> instead.The minimal officially supported rustc version is now 1.56.0
Interacting with a database requires a mutable connection.
The way the Backend trait 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> instead. Implementors of Backend
should check the relevant section of the migration guide.
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.
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 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_tables 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 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()
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
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.
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.
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).
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()
Nothing published for this version
Nothing published for this version
This release fixes a minor memory safety issue in SQLite. This bug would only occur in an error handling branch that should never occur in practice.
embed_migrations! will no longer emit an unused import warning
embed_migrations! will no longer emit an unused import warninguuidv07Diesel CLI can be configured to error if a command would result in changes
to your schema file by passing --locked-schema. This is intended for use
in CI and production deploys, to ensure that the committed schema file is
up to date.
A helper trait has been added for implementing ToSql for PG composite types.
See WriteTuple for details.
Added support for MySQL's UNSIGNED TINYINT
DatabaseErrorKind::SerializationFailure has been added, corresponding to
SQLSTATE code 40001 (A SERIALIZABLE isolation level transaction failed to
commit due to a read/write dependency on another transaction). This error is
currently only detected on PostgreSQL.
Diesel CLI can now generate completions for zsh and fish. See diesel completions --help for details.
#[belongs_to] can now accept types that are generic over lifetimes (for
example, if one of the fields has the type Cow<'a, str>). To define an
association to such a type, write #[belongs_to(parent = "User<'_>")]
Nullable<Text> now supports ilike expression on in PostgreSQL.
diesel_manage_updated_at('table_name') is now available on SQLite. This
function can be called in your migrations to create a trigger which
automatically sets the updated_at column, unless that column was updated in
the query.
Diesel's derives now require that extern crate diesel; be at your crate root
(e.g. src/lib.rs or src/main.rs)
Tinyint has been renamed to TinyInt and an alias has been created from Tinyint to TinyInt.
The minimal officially supported rustc version is now 1.31.0
diesel_infer_schema has been deprecated. diesel print-schema is now the only way to generate database schema. Diesel CLI can be configured to automati…
Diesel CLI now supports a configuration file. See diesel.rs/guides/configuring-diesel-cli for details.
sql_function! now supports generic functions. See the documentation for
sql_function! for more details.
sql_function! now supports aggregate functions like sum and max, by
annotating them with #[aggregate]. This skips the implementation of
NonAggregate for your function. See the documentation for
sql_function! for more details.
sql_function! now supports renaming the function by annotating it with
#[sql_name = "SOME_FUNCTION"]. This can be used to support functions with
multiple signatures such as coalesce, by defining multiple rust functions
(with different names) that have the same #[sql_name].
Added sqlite-bundled feature to diesel_cli to make installing on
some platforms easier.
Custom SQL functions can now be used with SQLite. See the docs for details.
All functions and operators provided by Diesel can now be used with numeric operators if the SQL type supports it.
PgInterval can now be used with -, *, and /.
Vec<T> is now Insertable. It is no longer required to always place an &
in front of .values.
Added support for PG tuples. See sql_types::Record for details.
FOR SHARE,
SKIP LOCKED, NO WAIT, and more. See QueryDsl for details.sql_function! has been redesigned. The syntax is now sql_function!(fn lower(x: Text) -> Text);. The output of the new syntax is slightly different
than what was generated in the past. See the documentation for
sql_function! for more details.diesel print-schema and infer_schema! now properly handle unsigned types
in MySQLdiesel_infer_schema has been deprecated. diesel print-schema is now the
only way to generate database schema. Diesel CLI can be configured to
automatically regenerate your schema file when migrations are run. See
diesel.rs/guides/configuring-diesel-cli for details.
Uses of sql_function! in the form sql_function!(foo, foo_t, (x: Integer))
have been deprecated in favor of a new design (listed above). Note: Due to a
bug in Rust, you may not see
a deprecation warning from usage of the old form. As always, if you're
concerned about relying on deprecated code, we recommend attempting to build
your app with default-features turned off (specifically excluding the
with-deprecated feature).
The --whitelist and --blacklist options to diesel print-schema have been
deprecated and renamed --only-tables and --exclude-tables.
Added SqlLiteral::bind(). This is intended to be used for binding values to small SQL fragments. Use sql_query if you are writing full queries.
Added SqlLiteral::bind().
This is intended to be used for binding values to small SQL fragments.
Use sql_query if you are writing full queries.
Added support for INSERT INTO table (...) SELECT ... queries. Tables, select
select statements, and boxed select statements can now be used just like any
other Insertable value.
Any insert query written as insert_into(table).values(values) can now be
written as values.insert_into(table). This is particularly useful when
inserting from a select statement, as select statements tend to span multiple
lines.
Diesel's derives can now produce improved error messages if you are using a
nightly compiler, and enable the unstable feature. For the best errors, you
should also set RUSTFLAGS="--cfg procmacro2_semver_exempt".
Added support for specifying ISOLATION LEVEL, DEFERRABLE, and READ ONLY
on PG transactions. See PgConnection::build_transaction for details.
BEGIN IMMEDIATE and BEGIN EXCLUSIVE on SQLite.
See SqliteConnection::immediate_transaction and
SqliteConnection::exclusive_transaction for detailsTables with more than 56 columns are now supported by enabling the
128-column-tables feature.
Delete statements can now be boxed. This is useful for conditionally modifying
the where clause of a delete statement. See DeleteStatement::into_boxed
for details.
UpdateStatement::into_boxed
for details.Added order_by as an alias for order.
Added then_order_by, which appends to an ORDER BY clause rather than
replacing it. This is useful with boxed queries to dynamically construct an
order by clause containing an unknown number of columns.
#[derive(Insertable)] can now work on structs with fields that implement
Insertable (meaning one field can map to more than one column). Add
#[diesel(embed)] to the field to enable this behavior.
Queries that treat a subselect as a single value (e.g. foo = (subselect))
are now supported by calling .single_value().
#[derive(Insertable)] implements now Insertable also on the struct itself,
not only on references to the struct
ConnectionError now implements PartialEq.
Columns generated by table! now implement Default
#[derive(AsChangeset)] now implements AsChangeset on the struct itself,
and not only on a reference to the struct
Added support for deserializing Numeric into BigDecimal on SQLite. SQLite
has no arbitrary precision type, so the result will still have floating point
rounding issues. This is primarily to support things like avg(int_col),
which we define as returning Numeric
The bounds on impl ToSql for Cow<'a, T> have been loosened to no longer
require that T::Owned: ToSql.
32-column-tables are now enabled by default.
ne_any has been renamed to ne_all.
The large-tables feature has been has been renamed to 32-column-tables.
The huge-tables feature has been renamed to 64-column-tables.
IncompleteUpdateStatement has been removed. Use UpdateStatement instead.
diesel database setup now correctly handles database URLs containing query
strings
diesel migration list shows the proper migration order when mixing
old and new timestamp formats. (The migrations were always run in the correct
order, this only affects the display logic of migration list)
#[derive(Identifiable)] now correctly associates #[primary_key] with the
column name, not field name.
Select statements can no longer incorrectly appear in an expression context.
exists can no longer incorrectly receive values other than select
statements.
MysqlConnection::establish can now properly handle IPv6 addresses wrapped in
square brackets.
* No changes
*IMPORTANT NOTE* Due to [several][rust-deprecation-bug-1] [bugs][rust-deprecation-bug-2] in Rust, many of the deprecations in this release may not sho…
r2d2-diesel has been merged into Diesel proper. You should no longer rely
directly on r2d2-diesel or r2d2. The functionality of both is exposed from
diesel::r2d2.
r2d2::PooledConnection now implements Connection. This means that you
should no longer need to write &*connection when using r2d2.
The BINARY column type name is now supported for SQLite.
The QueryId trait can now be derived.
FromSqlRow can now be derived for types which implement FromSql.
AsExpression can now be derived for types which implement ToSql.
HasSqlType, NotNull, and SingleValue can now be derived with
#[derive(SqlType)]. See the docs for those traits for more information.
The return type of FromSql, FromSqlRow, and QueryableByName can now be
written as deserialize::Result<Self>.
The return type of ToSql can now be written as serialize::Result.
Added support for SQLite's INSERT OR IGNORE and MySQL's INSERT IGNORE
via the insert_or_ignore function.
min and max can now be used with array expressions.
Added diesel::dsl::array, which corresponds to a PG ARRAY[] literal.
Added the not_none! macro, used by implementations of FromSql which do not
expect NULL.
Added result::UnexpectedNullError, an Error type indicating that an
unexpected NULL was received during deserialization.
Added .or_filter, which behaves identically to .filter, but using OR
instead of AND.
helper_types now contains a type for every method defined in
expression_methods, and every function in dsl.
Added FromSql impls for *const str and *const [u8] everywhere that
String and Vec are supported. These impls do not allocate, and are
intended for use by other impls which need to parse a string or bytes, and
don't want to allocate. These impls should never be used outside of another
FromSql impl.
with-deprecated feature by adding default-features = false to
Cargo.toml.Deprecated impl_query_id! in favor of #[derive(QueryId)]
Deprecated specifying a column name as #[column_name(foo)]. #[column_name = "foo"] should be used instead.
The types module has been deprecated. It has been split into sql_types,
serialize, and deserialize.
query_source::Queryable and query_source::QueryableByName have been
deprecated. These traits have been moved to deserialize.
backend::TypeMetadata has been deprecated. It has been moved to sql_types.
types::ToSqlOutput has been deprecated. It has been renamed to
serialize::Output.
helper_types::Not is now helper_types::not
infer_schema! generates valid code when run against a database with no
tables.Nothing published for this version
All deprecated items have been removed.
#[derive(QueryableByName)] can now handle structs that have no associated
table. If the #[table_name] annotation is left off, you must annotate each
field with #[sql_type = "Integer"]
#[derive(QueryableByName)] can now handle embedding other structs. To have a
field whose type is a struct which implements QueryableByName, rather than a
single column in the query, add the annotation #[diesel(embed)]
The QueryDsl trait encompasses the majority of the traits that were
previously in the query_dsl module.
Executing select statements on SQLite will no longer panic when the database
returns SQLITE_BUSY
table!s which use the Datetime type with MySQL will now compile correctly,
even without the chrono feature enabled.
#[derive(QueryableByName)] will now compile correctly when there is a shadowed Result type in scope.
BoxableExpression can now be used with types that are not 'static
Connection::test_transaction now requires that the error returned implement Debug.
query_builder::insert_statement::InsertStatement is now accessed as
query_builder::InsertStatement
query_builder::insert_statement::UndecoratedInsertRecord is now accessed as
query_builder::UndecoratedInsertRecord
#[derive(QueryableByName)] now requires that the table name be explicitly
stated.
Most of the traits in query_dsl have been moved to query_dsl::methods.
These traits are no longer exported in prelude. This should not affect most
apps, as the behavior of these traits is provided by QueryDsl. However, if
you were using these traits in where clauses for generic code, you will need
to explicitly do use diesel::query_dsl::methods::WhateverDsl. You may also
need to use UFCS in these cases.
If you have a type which implemented QueryFragment or Query, which you
intended to be able to call execute or load on, you will need to manually
implement RunQueryDsl for that type. The trait should be unconditionally
implemented (no where clause beyond what your type requires), and the body
should be empty.
All deprecated items have been removed.
LoadDsl and FirstDsl have been removed. Their functionality now lives in
LoadQuery.
Nothing published for this version
Nothing published for this version
Deprecated insert_default_values() in favor of insert_into(table).default_values()
The .for_update() method has been added to select statements, allowing
construction of SELECT ... FOR UPDATE.
Added insert_into(table).default_values() as a replacement for
insert_default_values()
Added insert_into(table).values(values) as a replacement for
insert(values).into(table).
Added support for MySQL's REPLACE INTO as replace_into(table).
Added replace_into(table).values(values) as a replacement for
insert_or_replace(values).into(table).
Added on_conflict_do_nothing on InsertStatement as a replacement for
on_conflict_do_nothing on Insertable structs.
Added on_conflict on InsertStatement as a replacement for
on_conflict on Insertable structs.
filter can now be called on update and delete statements. This means that
instead of update(users.filter(...)) you can write
update(users).filter(...). This allows line breaks to more naturally be
introduced.
Subselects can now reference columns from the outer table. For example,
users.filter(exists(posts.filter(user_id.eq(users::id)))) will now compile.
TextExpressionMethods is now implemented for expressions of type
Nullable<Text> as well as Text.
allow_tables_to_appear_in_same_query! can now take more than 2 tables, and is the same
as invoking it separately for every combination of those tables.
Added sql_query, a new API for dropping to raw SQL that is more pleasant to
use than sql for complete queries. The main difference from sql is that
you do not need to state the return type, and data is loaded from the query by
name rather than by index.
Added a way to rename a table in the table! macro with #[sql_name="the_table_name"]
Added support for PostgreSQL's DISTINCT ON. See
.distinct_on() for more details
The signatures of QueryId, Column, and FromSqlRow have all changed to
use associated constants where appropriate.
You will now need to invoke allow_tables_to_appear_in_same_query! any time two tables
appear together in the same query, even if there is a joinable! invocation for those tables.
diesel_codegen should no longer explicitly be used as a dependency. Unless
you are using infer_schema! or embed_migrations!, you can simply remove it
from your Cargo.toml. All other functionality is now provided by diesel
itself.
Code using infer_schema! or infer_table_from_schema! must now add
diesel_infer_schema to Cargo.toml, and #[macro_use] extern crate diesel_infer_schema to src/lib.rs
Code using embed_migrations! must now add diesel_migrations to Cargo.toml,
and #[macro_use] extern crate diesel_migrations to src/lib.rs
The migrations module has been moved out of diesel and into
diesel_migrations
Deprecated insert_default_values() in favor of
insert_into(table).default_values()
Deprecated insert(values).into(table) in favor of
insert_into(table).values(values).
Deprecated insert_or_replace(values).into(table) in favor of
replace_into(table).values(values).
Deprecated .values(x.on_conflict_do_nothing()) in favor of
.values(x).on_conflict_do_nothing()
Deprecated .values(x.on_conflict(y, do_nothing())) in favor of
.values(x).on_conflict(y).do_nothing()
Deprecated .values(x.on_conflict(y, do_update().set(z))) in favor of
.values(x).on_conflict(y).do_update().set(z)
Deprecated enable_multi_table_joins in favor of
allow_tables_to_appear_in_same_query!
Deprecated SqlLiteral#bind. sql is intended for use with small fragments
of SQL, not complete queries. Writing bind parameters in raw SQL when you are
not writing the whole query is error-prone. Use sql_query if you need raw
SQL with bind parameters.
IntoInsertStatement and BatchInsertStatement have been removed. It's
unlikely that your application is using these types, but InsertStatement is
now the only "insert statement" type.
Citext as a type alias for Text has been removed. Writing
citext_column.eq("foo") would perform a case-sensitive comparison. More
fleshed out support will be required.
When using MySQL and SQLite, dates which cannot be represented by chrono
(such as 0000-00-00) will now properly return an error instead of panicking.
MySQL URLs will now properly percent decode the username and password.
References to types other than str and slice can now appear on structs which
derive Insertable or AsChangeset.
Deserializing a date/time/timestamp column into a chrono type on SQLite will
now handle any value that is in a format documented as valid for SQLite's
strftime function except for the string 'now'.
Your coding agent can read these notes before it upgrades. Set up the MCP server →