Skip to content

Update Rust crate diesel_migrations to v2 - #30

Open
renovate[bot] wants to merge 1 commit into
masterfrom
renovate/diesel_migrations-2.x
Open

renovate[bot] wants to merge 1 commit into
masterfrom
renovate/diesel_migrations-2.x

Conversation

@renovate

@renovate renovate Bot commented Sep 25, 2022 •

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Type Update Change
diesel_migrations (source) dev-dependencies major 1.4 → 2.0

Release Notes

diesel-rs/diesel (diesel_migrations)

v2.4.0

Compare Source

Added
  • Add support for Batch-Update for PostgreSQL, MySQL and SQLite
  • Diesel-Migrations now contains a migration source that easily allows you to register Rust based migrations
  • Diesel-Migrations now contains a migration source that allows you to combine migrations from several different sources
  • Added InsertStatement::execute_returning_id for MySQL and MariaDB, returning the AUTO_INCREMENT value that a single-row insert sets (None if it sets none) without the extra SELECT LAST_INSERT_ID() round trip. It is available for tables whose table! definition marks a column with the new #[auto_increment] attribute, which diesel print-schema now emits for those backends.
  • Added SqliteConnection::with_raw_connection to provide safe, callback-based access to the raw *mut sqlite3 handle for advanced SQLite C APIs (session extension, hooks, etc.)
  • Added SqliteConnection::on_commit and SqliteConnection::remove_commit_hook to register a callback invoked when a transaction is about to be committed, wrapping sqlite3_commit_hook
  • Added SqliteConnection::on_authorize and SqliteConnection::remove_authorizer to register an authorizer callback that allows, denies, or ignores SQL actions during statement compilation, wrapping sqlite3_set_authorizer, along with the AuthorizerContext and AuthorizerDecision types
  • Added SqliteConnection::on_trace and SqliteConnection::remove_trace to register a callback for SQL execution tracing (statement, profile, and row events), wrapping sqlite3_trace_v2, along with the SqliteTraceEvent and SqliteTraceFlags types
  • Added SqliteConnection::on_update and SqliteConnection::remove_update_hook to register row-change callbacks (insert, update, or delete) through a SqliteUpdateRouter, wrapping sqlite3_update_hook, together with the SqliteUpdateRouter, SqliteChangeEvent, SqliteChangeOp, SqliteChangeOps, and DynamicChangeTable types. SqliteUpdateRouter::on accepts a table! table (including a schema-qualified one), and SqliteUpdateRouter::on_dynamic accepts a runtime diesel_dynamic_schema table
  • Added SqliteConnection::on_collation_needed and SqliteConnection::remove_collation_needed_hook to register a callback invoked when SQLite encounters an unknown collation sequence, wrapping sqlite3_collation_needed, along with the CollationNeededContext and SqliteTextRep types
  • Added json_extract and jsonb_extract SQL function support for the SQLite backend
  • Added json_insert and jsonb_insert SQL function support for the SQLite backend
  • Added json_replace, jsonb_replace, json_set, and jsonb_set SQL function support for the SQLite backend
  • Added SqliteConnection::get_read_only_blob method to stream blob's from a SQLite database to Rust via std::io::Read
  • Added support for casting to REAL in SQLite.
  • Added ToSql, FromSql, Queryable, and AsExpression impls for Rc<T>, Arc<T>, and Box<T> (including Rc/Arc<dyn BoxableExpression> for cloneable dynamic query fragments and the <str> / <[u8]> unsized variants).
  • Added diesel::pg::returning::old to refer to a column's pre-update value using the RETURNING old.col syntax in a PostgreSQL UPDATE or INSERT ... ON CONFLICT ... DO UPDATE statement (requires PostgreSQL >=18).
  • Added a custom-count-column-tables feature that allows you to configure the maximal number of supported columns per table via the DIESEL_MAX_COLUMN_COUNT environment variable
  • Added register_auto_extension, cancel_auto_extension, and reset_auto_extension for the SQLite backend to register statically linked extensions that run for every new connection.
  • Added SqliteConnection::set_limit, SqliteConnection::get_limit, and SqliteConnection::set_recommended_security_limits to configure SQLite's per-connection runtime limits (sqlite3_limit) via the new SqliteLimit enum.
  • Added support for #[cfg(...)] attributes on individual columns inside the table! macro, so a schema whose columns vary by enabled crate features can live in a single table! block instead of duplicated feature gated modules.
  • Added SqliteConnection methods to configure SQLite's per-connection sqlite3_db_config options: set_defensive/is_defensive, set_trusted_schema/is_trusted_schema, with_load_extension_enabled, set_fts3_tokenizer_enabled/is_fts3_tokenizer_enabled, set_writable_schema/is_writable_schema, set_attach_create_enabled/is_attach_create_enabled, set_attach_write_enabled/is_attach_write_enabled, set_triggers_enabled/are_triggers_enabled, set_views_enabled/are_views_enabled, set_foreign_keys_enabled/are_foreign_keys_enabled, and set_double_quoted_strings_dml/are_double_quoted_strings_dml_enabled (plus the _ddl variants).
  • Added SqliteConnection::attach_database and SqliteConnection::detach_database helpers that run ATTACH DATABASE/DETACH DATABASE with the file path and schema name passed as bound parameters, avoiding hand-assembled statements and path escaping. They pair with the set_attach_create_enabled and set_attach_write_enabled hardening knobs.
  • Added SqliteFunctionBehavior and a register_impl_with_behavior function (generated next to register_impl/register_nondeterministic_impl by #[declare_sql_function]) to register custom SQLite functions with explicit behavior flags (DETERMINISTIC, INNOCUOUS, DIRECTONLY, SUBTYPE).
  • Added a RunQueryDslSupport trait to indicate types that should implement RunQueryDsl in a sync/async agnostic way
  • Added a #[derive(diesel::Enum)] proc-macro to easily map Rust enums to database enums.
  • Added support for generating matching Rust enums for database enums in Diesel-CLI
  • Added #[diesel_async] attribute to #[derive(MultiConnection)] to support async MultiConnections.
  • Exposed the SQLite bind values collected for a query under the i-implement-a-third-party-backend-and-opt-into-breaking-changes feature, via public SqliteBindCollector and SqliteBindCollectorData, each with a binds() iterator over the live values and the owned snapshot respectively, plus the SqliteBindValueRef and OwnedSqliteBindValue enums.
  • Exposed GroupByClause and NoGroupByClause under the i-implement-a-third-party-backend-and-opt-into-breaking-changes feature so third-party crates can distinguish grouped and ungrouped SelectStatement types.
  • Added --no-schema CLI flag to the migration run subcommand
  • Added SqliteConnection::vacuum and SqliteConnection::vacuum_into to rebuild a database or write a vacuumed copy of it to a new file, each accepting an optional schema name to target an attached database, with the destination path passed as a bind parameter.
  • Added BoxedCloneQuery type. This is a boxed query that uses Arc to allow the query to be cloned.
  • Added SqliteConnection::wal_checkpoint to checkpoint the write-ahead log through the typed WalCheckpointMode enum, returning a WalCheckpointOutcome with the busy flag and frame counts, and accepting an optional schema name where None checkpoints every attached database.
  • Added the diesel::sqlite::pragma module to declare SQLite pragmas as types, read them per schema or per connection into a Rust type the caller chooses, and assign them integer, keyword or quoted text values, with the built-in PageCount and FreelistCount pragmas for a database's total and reclaimable page counts, the AutoVacuum pragma for its auto_vacuum mode as an AutoVacuumMode, and the IncrementalVacuum pragma to release freelist pages in incremental mode.
  • Added a MariaDB backend including a MariadbConnection
  • Added support for RETURNING clauses to the MariaDB backend
  • Added support for VALUES(column) in Upsert for Mysql and Mariadb
  • Added the UnsignedTiny, UnsignedSmall, UnsignedMedium and UnsignedBig variants to NumericRepresentation for the MySQL and MariaDB backends
  • diesel print-schema now uses the COMMENT ON TYPE of a PostgreSQL enum as the doc comment of its generated Rust enum. The doc comments of the generated Rust enums and of their rust_types module now follow with_docs like those of tables and columns, which they did not before: none with no-doc-comments, only the type comment with only-database-comments, and the type comment or else the generated doc comment with database-comments-fallback-to-auto-generated-doc-comment.
  • Added the AsExpression coercions of now and today (to Timestamptz, Nullable<Timestamp>, Nullable<Date>, …) to &now, &&now, &today and &&today, so a #[derive(AsChangeset)] struct with a now, &now, today or &today field can be used by reference, for instance in a batch update
  • Added diesel::connection::DatabaseVersion, a database version that orders by major, minor and patch including support to read the database version from any provided connection
  • Added support for Uuid to Mariadb
  • Added DatabaseErrorInformation::sqlstate, returning the SQLSTATE of a database error as a SqlState, whose class is a SqlStateClass including exposing the SQLSTATE for error from database connections that support it
  • Added the sqlstate crate holding SqlState, SqlStateClass, InvalidSqlState and the SQLSTATE constants, which diesel re-exports
  • Added named_parameters attribute to the declare_sql_function macro to allow passing function parameters using named notation on backends that support it
  • Added support for database views via a new view! macro
Fixed
  • Fixed view! query sources missing the ToInnerJoin and CombineDsl impls that table! ones get, so a .nullable() selection through a join that contains a view, and a UNION/INTERSECT/EXCEPT on a view or on an alias of one, now compile.
  • Fixed IpNetwork written as a PostgreSQL Cidr to clear the host bits, as IpNet already does, instead of sending a value the server rejects with invalid external "cidr" value.
  • Fixed SqliteReadOnlyBlob::close closing the underlying SQLite handle twice.
  • Fixed SqliteReadOnlyBlob seeks before byte zero to return InvalidInput without changing the cursor, instead of overflowing or clamping to zero.
  • Fixed PostgreSQL array serialization to set the header's null flag when an element is NULL. PostgreSQL ignored the missing flag, but Diesel could not deserialize such arrays.
  • Fixed SQLite value reads to panic instead of creating invalid slices or returning incorrect data when SQLite allocation fails. Row iteration reports a failed value duplication as an error instead.
  • Fixed a use after free where reading a SQLite value in a second representation, for example a blob as text, invalidated slices another SqliteValue of the same field had returned. Such a read now works on a copy of the value.
  • Bpchar is now a distinct PostgreSQL SQL type (previously a hidden alias for Varchar). Binds on CHAR(N) / BPCHAR columns are now sent with OID 1042, allowing PostgreSQL to use the column's index instead of casting it to text.
  • Fix non-deterministic test failures on PostgreSQL caused by loading rows without ORDER BY and assuming insertion order
  • diesel_derives does now correctly handle feature flag unification in mixed build/target dependency situations
  • Fixed several panics in the serialization and deserialization code for PostgreSQL and MySQL
  • Tighten requirements for SqliteConnection::deserialize_readonly_database to closely match the upstream requirements
  • diesel print-schema now generates joinable! and allow_tables_to_appear_in_same_query! for PostgreSQL foreign keys across multiple configured schemas
  • Fixed an overflow while converting a PostgreSQL Interval into a chrono::Duration, which panicked with debug assertions enabled and silently produced a wrong, sometimes negative, duration without them
  • diesel print-schema and diesel migration generate --diff-schema no longer drop joinable! definitions on MariaDB when two tables reuse one foreign key constraint name, which MariaDB permits from 12.1 onwards
  • The SQLite JSONB reader now rejects a null, true or false element that declares a payload or uses a multi byte header, instead of decoding a value that SQLite either refuses or reads differently
  • Fixed SQLite jsonb encoding writing a string with a quote or backslash as TEXT, which sqlite's own JSON functions then reject
  • Fixed decoding SQLite jsonb INT payloads above i64::MAX, which failed to deserialize even when SQLite itself wrote them
  • Fixed decoding a SQLite jsonb INT payload of -0, which failed to deserialize and now reads as the integer 0
  • Negative MySQL and MariaDB TIME values now load into MysqlTime instead of being rejected while decoding. chrono::NaiveTime and time::Time cannot represent them, so those targets report that instead
  • Fixed a failed top-level COMMIT, such as a deferred foreign key violation on SQLite, leaving the transaction open
  • Fixed embed_migrations! making the crate hash depend on the directory the crate is built in, which broke reproducible builds
  • Reject subselects that reference an ungrouped column of an aggregating outer query
  • Fixed a out of bounds memory access while trying to reuse prepared statements with a different number of bind elements on the postgres backend
  • Fixed reusing the wrong prepared statement with batch inserts with static arrays containing BoxableExpression values
  • Fix a potential out of bounds memory access while executing sql_query statements with less binds supplied than expected on the mysql backend
  • Fixed the SQLite diesel_manage_updated_at function to return the SQL error when creating its trigger fails, for example on a missing table or an authorizer denial, instead of panicking
  • diesel print-schema now generates valid Rust names for custom types whose name starts with a digit or converts to Self, such as the PostgreSQL types 2fa_method and self (now Type2faMethod and Self_) or the MySQL/MariaDB enum type of a table named 24h_orders, now prefixed with Type
  • Fix copy_to().load() to correctly close the copy stream at the end of the statement to bring back the connection into a usable state
  • Fix parsing consecutive null values in the binary copy_to stream
  • Fix the copy iterator to only return a single error and stop afterwards
  • Fix potential panics while deserializing binary copy_to responses
  • Fixed an issue with a panic during copy_from statements could render the connection unusable
  • Fixed an issue with using COPY FROM/TO via sql_query and batch_execute which could render the connection unusable
  • Fixed a Segmentationfault when issuing an empty query while using libmariadb
  • Fixed SQL injection through the SQLite diesel_manage_updated_at function, which now quotes its argument as a table name and runs a single statement. Table names containing ", spaces or keywords now work
  • Fix a potential use-after-free issues for SQLite database deserialized in during register_auto_extension
  • Fix that the iterator returned by SqliteConnection::load_iter is correctly fused and doesn't return values after the first None or statement related Some(Err(_)) by reexecuting the statement
  • Fix a potential use-after-free memory bug while holding rows in the Mysql backend longer than the connection/result iterator exists
  • Provide a BorrowedSqliteConnection passed to various hooks to prevent users calling std::mem::replace or similar methods
  • Fixed diesel_tests::migration::test_rust_migrations to allow consecutive runs without failing
  • Fixed a double free when a SQLite auto-extension leaked a cursor whose last step failed, and the matching abort in WAL hooks
Changed
  • The minimal supported Rust version is now 1.88.0
  • Add support for no-std environments using the SQLite backend
  • If you use the provided StatementCache and compile diesel without default features make sure to opt in a more performant implementation by using the std or the hashbrown feature
  • Improved documentation and added examples for filter_target on IncompleteOnConflict
  • A MySQL or MariaDB read whose requested signedness disagrees with the column's now errors instead of reinterpreting the bits, which affects a signed value read through Unsigned<T> and an UNSIGNED BIGINT above i64::MAX read as BigInt
  • Custom expression types used in the WHERE clause of a subselect need a ValidGrouping<GB> impl that is generic over GB, as derived impls already are, because an impl of only ValidGrouping<()> no longer compiles there
  • SqliteConnection::establish turns off the two-argument fts3_tokenizer(), which SQLite builds compiled with SQLITE_ENABLE_FTS3_TOKENIZER, such as Ubuntu's system library, enable by default and which lets SQL text make SQLite call through an arbitrary pointer. SqliteConnection::set_fts3_tokenizer_enabled is now an unsafe fn.
  • Extended libsqlite3-sys support to include 0.40
  • diesel print-schema now prefixes a table or column name that starts with a digit with table_ or column_ instead of _, so 24h_orders gives table_24h_orders instead of _24h_orders

v2.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

v2.3.1

  • Add support for sqlite-wasm-rs 0.6
  • Fixed a failed top-level COMMIT, such as a deferred foreign key violation on SQLite, leaving the transaction open
  • Fixed embed_migrations! making the crate hash depend on the directory the crate is built in, which broke reproducible builds
  • Correctly implement Error::source for our error types
  • Workaround a potential future breaking change in rust

v2.3.0

Compare Source

Added
  • Added limit() and offset() DSL to combination clauses such as UNION
  • Fixed #[derive(Identifiable)] ignoring attribute #[diesel(serialize_as)] on primary keys
  • Added embedded struct support for AsChangeset via #[diesel(embed)]
  • Added a #[diesel(skip_update)] attribute for the AsChangeset derive 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 their diesel::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 Json and Jsonb support for the SQLite backend.
  • Added a #[diesel::declare_sql_function] attribute macro to easily define support for
    multiple sql functions at once via an extern "SQL" block
  • Support [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)
  • Added wasm32-unknown-unknown target support for sqlite backend.
  • Add support for the CAST operator
  • Support [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)
  • Add [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)
  • 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 if a and b were nullable.
  • Generate InstrumentationEvent::BeginTransaction for 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 ipnetwork to allow version 0.21.
Changed
  • Use distinct DIESEL_LOG logging filter env variable instead of the default RUST_LOG one (#​4575)
  • The minimal supported Rust version is now 1.86.0

v2.2.0

Compare Source

Added
  • Support [print_schema] except_custom_type_definitions = ["Vector"]. If a custom type matches one element on the list it's skipped.
  • Added automatic usage of all sqlite rowid aliases when no explicit primary key is defined for print-schema
  • Added a #[dsl::auto_type] attribute macro, allowing to infer type of query fragment functions
  • Added the same type inference on Selectable 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.
  • Added an optional #[diesel(skip_insertion)] field attribute to the Insertable derive 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-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).
  • Support for multiple print_schema entry in diesel.toml (e.g. [print_schema.user1]), which allows generating multiple schema.rs files
  • Add support for COPY TO and COPY FROM statements
  • Add support for mapping chrono::Duration to postgresql's INTERVAL sql type
  • Added serialize_database_to_buffer and deserialize_readonly_database_from_buffer methods in SqliteConnection to support serialization/deserialization of SQLite databases to and from byte buffers.
  • Added 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.
Changed
  • The minimal officially supported rustc version is now 1.78.0
  • Deprecated sql_function! in favour of define_sql_function! which provides compatibility with #[dsl::auto_type]
  • Deserialization error messages now contain information about the field that failed to deserialize

v2.1.0

Compare Source

Changed
  • The minimal officially supported rustc version is now 1.65.0
Added
  • Added the custom_type_derives config option to customize the derives for SQL
    type definitions automatically generated by Diesel CLI.
  • Add a #[derive(MultiConnection)] proc-macro that lets you easily implement diesel::Connection
    for an enum of connections to different database backends.
  • Added a --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 file
  • Add a ON CONFLICT (...) DO UPDATE ... [WHERE ...] conditional clause support for PostgreSQL.
  • Add support for MySQL's ON DUPLICATE KEY DO UPDATE syntax through the existing upsert functions.
  • Add ability to define multiple columns in a single distinct_on for PostgreSQL,
    like: .distinct_on((column_a, column_b)).
  • Added column size restrictions to the generated schema.rs file

v2.0.0

Compare Source

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 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.

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.

  • 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()


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch 5 times, most recently from 6b29ad0 to cff5924 Compare October 19, 2022 19:42
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from cff5924 to e2f19a3 Compare February 3, 2023 19:40
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from e2f19a3 to 1a390e0 Compare March 15, 2023 16:47
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from 1a390e0 to 3cd3ed5 Compare May 28, 2023 09:10
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch 2 times, most recently from f855c09 to c275807 Compare May 5, 2024 10:18
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from c275807 to aef7af6 Compare August 10, 2025 13:36
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from aef7af6 to 8fdc5db Compare September 13, 2025 05:08
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from 8fdc5db to dfe16c9 Compare September 25, 2025 20:55
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from dfe16c9 to 2724e12 Compare November 26, 2025 17:37
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from 2724e12 to b7c3037 Compare December 10, 2025 10:51
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from b7c3037 to 820c06e Compare December 31, 2025 16:59
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from 820c06e to 06ba9b2 Compare February 2, 2026 19:56
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from 06ba9b2 to 5ee7546 Compare February 12, 2026 12:03
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from 5ee7546 to c9f0505 Compare February 25, 2026 14:17
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from c9f0505 to 98db5c5 Compare March 13, 2026 13:45
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from 98db5c5 to 7dfffa0 Compare April 24, 2026 10:05
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from 7dfffa0 to 4f2469f Compare May 18, 2026 09:54
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from 4f2469f to dafe575 Compare July 21, 2026 02:56
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from dafe575 to 835f5ed Compare August 11, 2026 21:13
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from 835f5ed to 4372f8c Compare August 26, 2026 11:34
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from 4372f8c to bc936e3 Compare September 7, 2026 21:17
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from bc936e3 to 1552bbb Compare September 25, 2026 03:50
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from 1552bbb to dd823b5 Compare October 13, 2026 12:14
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from dd823b5 to 980154f Compare November 5, 2026 20:12
@renovate
renovate Bot force-pushed the renovate/diesel_migrations-2.x branch from 980154f to ed91e1b Compare November 13, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants