Skip to content

Update Rust crate diesel_migrations to 2.4.0 - #645

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

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

Conversation

@oxide-renovate

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Type Update Change
diesel_migrations (source) workspace.dependencies minor 2.3.2 → 2.4.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

Configuration

📅 Schedule: (in timezone America/Los_Angeles)

  • Branch creation
    • "after 8pm,before 6am"
  • Automerge
    • "after 8pm,before 6am"

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

♻ Rebasing: Whenever PR becomes conflicted, 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 has been generated by Mend Renovate CLI.

@oxide-renovate oxide-renovate Bot added the dependencies Pull requests that update a dependency file label Nov 14, 2026
@notpeter

Copy link
Copy Markdown
Contributor

Closed in favor of:

@notpeter notpeter closed this Nov 14, 2026
@oxide-renovate

Copy link
Copy Markdown
Contributor Author

Renovate Ignore Notification

Because you closed this PR without merging, Renovate will ignore this update (2.4.0). You will get a PR once a newer version is released. To ignore this dependency forever, add it to the ignoreDeps array of your Renovate config.

If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR.

@oxide-renovate
oxide-renovate Bot deleted the renovate/diesel_migrations-2.x branch November 14, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant