Repository navigation
chore(deps): update rust crate diesel_migrations to v2.4.0 - #374
Open
renovate[bot] wants to merge 1 commit into
Open
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
Contributor
Author
|
|
This was referenced Nov 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



This PR contains the following updates:
=2.3.2→=2.4.0Release Notes
diesel-rs/diesel (diesel_migrations)
v2.4.0Compare Source
Added
InsertStatement::execute_returning_idfor MySQL and MariaDB, returning theAUTO_INCREMENTvalue that a single-row insert sets (Noneif it sets none) without the extraSELECT LAST_INSERT_ID()round trip. It is available for tables whosetable!definition marks a column with the new#[auto_increment]attribute, whichdiesel print-schemanow emits for those backends.SqliteConnection::with_raw_connectionto provide safe, callback-based access to the raw*mut sqlite3handle for advanced SQLite C APIs (session extension, hooks, etc.)SqliteConnection::on_commitandSqliteConnection::remove_commit_hookto register a callback invoked when a transaction is about to be committed, wrappingsqlite3_commit_hookSqliteConnection::on_authorizeandSqliteConnection::remove_authorizerto register an authorizer callback that allows, denies, or ignores SQL actions during statement compilation, wrappingsqlite3_set_authorizer, along with theAuthorizerContextandAuthorizerDecisiontypesSqliteConnection::on_traceandSqliteConnection::remove_traceto register a callback for SQL execution tracing (statement, profile, and row events), wrappingsqlite3_trace_v2, along with theSqliteTraceEventandSqliteTraceFlagstypesSqliteConnection::on_updateandSqliteConnection::remove_update_hookto register row-change callbacks (insert, update, or delete) through aSqliteUpdateRouter, wrappingsqlite3_update_hook, together with theSqliteUpdateRouter,SqliteChangeEvent,SqliteChangeOp,SqliteChangeOps, andDynamicChangeTabletypes.SqliteUpdateRouter::onaccepts atable!table (including a schema-qualified one), andSqliteUpdateRouter::on_dynamicaccepts a runtimediesel_dynamic_schematableSqliteConnection::on_collation_neededandSqliteConnection::remove_collation_needed_hookto register a callback invoked when SQLite encounters an unknown collation sequence, wrappingsqlite3_collation_needed, along with theCollationNeededContextandSqliteTextReptypesjson_extractandjsonb_extractSQL function support for the SQLite backendjson_insertandjsonb_insertSQL function support for the SQLite backendjson_replace,jsonb_replace,json_set, andjsonb_setSQL function support for the SQLite backendSqliteConnection::get_read_only_blobmethod to stream blob's from a SQLite database to Rust viastd::io::ReadREALin SQLite.ToSql,FromSql,Queryable, andAsExpressionimpls forRc<T>,Arc<T>, andBox<T>(includingRc/Arc<dyn BoxableExpression>for cloneable dynamic query fragments and the<str>/<[u8]>unsized variants).diesel::pg::returning::oldto refer to a column's pre-update value using theRETURNING old.colsyntax in a PostgreSQLUPDATEorINSERT ... ON CONFLICT ... DO UPDATEstatement (requires PostgreSQL >=18).custom-count-column-tablesfeature that allows you to configure the maximal number of supported columns per table via theDIESEL_MAX_COLUMN_COUNTenvironment variableregister_auto_extension,cancel_auto_extension, andreset_auto_extensionfor the SQLite backend to register statically linked extensions that run for every new connection.SqliteConnection::set_limit,SqliteConnection::get_limit, andSqliteConnection::set_recommended_security_limitsto configure SQLite's per-connection runtime limits (sqlite3_limit) via the newSqliteLimitenum.#[cfg(...)]attributes on individual columns inside thetable!macro, so a schema whose columns vary by enabled crate features can live in a singletable!block instead of duplicated feature gated modules.SqliteConnectionmethods to configure SQLite's per-connectionsqlite3_db_configoptions: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, andset_double_quoted_strings_dml/are_double_quoted_strings_dml_enabled(plus the_ddlvariants).SqliteConnection::attach_databaseandSqliteConnection::detach_databasehelpers that runATTACH DATABASE/DETACH DATABASEwith the file path and schema name passed as bound parameters, avoiding hand-assembled statements and path escaping. They pair with theset_attach_create_enabledandset_attach_write_enabledhardening knobs.SqliteFunctionBehaviorand aregister_impl_with_behaviorfunction (generated next toregister_impl/register_nondeterministic_implby#[declare_sql_function]) to register custom SQLite functions with explicit behavior flags (DETERMINISTIC,INNOCUOUS,DIRECTONLY,SUBTYPE).RunQueryDslSupporttrait to indicate types that should implementRunQueryDslin a sync/async agnostic way#[derive(diesel::Enum)]proc-macro to easily map Rust enums to database enums.#[diesel_async]attribute to#[derive(MultiConnection)]to support async MultiConnections.i-implement-a-third-party-backend-and-opt-into-breaking-changesfeature, via publicSqliteBindCollectorandSqliteBindCollectorData, each with abinds()iterator over the live values and the owned snapshot respectively, plus theSqliteBindValueRefandOwnedSqliteBindValueenums.GroupByClauseandNoGroupByClauseunder thei-implement-a-third-party-backend-and-opt-into-breaking-changesfeature so third-party crates can distinguish grouped and ungroupedSelectStatementtypes.--no-schemaCLI flag to themigration runsubcommandSqliteConnection::vacuumandSqliteConnection::vacuum_intoto 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.BoxedCloneQuerytype. This is a boxed query that usesArcto allow the query to be cloned.SqliteConnection::wal_checkpointto checkpoint the write-ahead log through the typedWalCheckpointModeenum, returning aWalCheckpointOutcomewith the busy flag and frame counts, and accepting an optional schema name whereNonecheckpoints every attached database.diesel::sqlite::pragmamodule 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-inPageCountandFreelistCountpragmas for a database's total and reclaimable page counts, theAutoVacuumpragma for itsauto_vacuummode as anAutoVacuumMode, and theIncrementalVacuumpragma to release freelist pages in incremental mode.RETURNINGclauses to the MariaDB backendVALUES(column)in Upsert for Mysql and MariadbUnsignedTiny,UnsignedSmall,UnsignedMediumandUnsignedBigvariants toNumericRepresentationfor the MySQL and MariaDB backendsdiesel print-schemanow uses theCOMMENT ON TYPEof a PostgreSQL enum as the doc comment of its generated Rust enum. The doc comments of the generated Rust enums and of theirrust_typesmodule now followwith_docslike those of tables and columns, which they did not before: none withno-doc-comments, only the type comment withonly-database-comments, and the type comment or else the generated doc comment withdatabase-comments-fallback-to-auto-generated-doc-comment.AsExpressioncoercions ofnowandtoday(toTimestamptz,Nullable<Timestamp>,Nullable<Date>, …) to&now,&&now,&todayand&&today, so a#[derive(AsChangeset)]struct with anow,&now,todayor&todayfield can be used by reference, for instance in a batch updatediesel::connection::DatabaseVersion, a database version that orders by major, minor and patch including support to read the database version from any provided connectionUuidto MariadbDatabaseErrorInformation::sqlstate, returning the SQLSTATE of a database error as aSqlState, whose class is aSqlStateClassincluding exposing the SQLSTATE for error from database connections that support itsqlstatecrate holdingSqlState,SqlStateClass,InvalidSqlStateand the SQLSTATE constants, which diesel re-exportsnamed_parametersattribute to thedeclare_sql_functionmacro to allow passing function parameters using named notation on backends that support itview!macroFixed
view!query sources missing theToInnerJoinandCombineDslimpls thattable!ones get, so a.nullable()selection through a join that contains a view, and aUNION/INTERSECT/EXCEPTon a view or on an alias of one, now compile.IpNetworkwritten as a PostgreSQLCidrto clear the host bits, asIpNetalready does, instead of sending a value the server rejects withinvalid external "cidr" value.SqliteReadOnlyBlob::closeclosing the underlying SQLite handle twice.SqliteReadOnlyBlobseeks before byte zero to returnInvalidInputwithout changing the cursor, instead of overflowing or clamping to zero.NULL. PostgreSQL ignored the missing flag, but Diesel could not deserialize such arrays.SqliteValueof the same field had returned. Such a read now works on a copy of the value.Bpcharis now a distinct PostgreSQL SQL type (previously a hidden alias forVarchar). Binds onCHAR(N)/BPCHARcolumns are now sent with OID 1042, allowing PostgreSQL to use the column's index instead of casting it to text.ORDER BYand assuming insertion orderdiesel_derivesdoes now correctly handle feature flag unification in mixed build/target dependency situationsSqliteConnection::deserialize_readonly_databaseto closely match the upstream requirementsdiesel print-schemanow generatesjoinable!andallow_tables_to_appear_in_same_query!for PostgreSQL foreign keys across multiple configured schemasIntervalinto achrono::Duration, which panicked with debug assertions enabled and silently produced a wrong, sometimes negative, duration without themdiesel print-schemaanddiesel migration generate --diff-schemano longer dropjoinable!definitions on MariaDB when two tables reuse one foreign key constraint name, which MariaDB permits from 12.1 onwardsnull,trueorfalseelement that declares a payload or uses a multi byte header, instead of decoding a value that SQLite either refuses or reads differentlyTEXT, which sqlite's own JSON functions then rejectjsonbINTpayloads abovei64::MAX, which failed to deserialize even when SQLite itself wrote themjsonbINTpayload of-0, which failed to deserialize and now reads as the integer0TIMEvalues now load intoMysqlTimeinstead of being rejected while decoding.chrono::NaiveTimeandtime::Timecannot represent them, so those targets report that insteadCOMMIT, such as a deferred foreign key violation on SQLite, leaving the transaction openembed_migrations!making the crate hash depend on the directory the crate is built in, which broke reproducible buildssql_querystatements with less binds supplied than expected on the mysql backenddiesel_manage_updated_atfunction to return the SQL error when creating its trigger fails, for example on a missing table or an authorizer denial, instead of panickingdiesel print-schemanow generates valid Rust names for custom types whose name starts with a digit or converts toSelf, such as the PostgreSQL types2fa_methodandself(nowType2faMethodandSelf_) or the MySQL/MariaDB enum type of a table named24h_orders, now prefixed withTypecopy_to().load()to correctly close the copy stream at the end of the statement to bring back the connection into a usable statecopy_fromstatements could render the connection unusableCOPY FROM/TOviasql_queryandbatch_executewhich could render the connection unusablediesel_manage_updated_atfunction, which now quotes its argument as a table name and runs a single statement. Table names containing", spaces or keywords now workSqliteConnection::load_iteris correctly fused and doesn't return values after the firstNoneor statement relatedSome(Err(_))by reexecuting the statementstd::mem::replaceor similar methodsdiesel_tests::migration::test_rust_migrationsto allow consecutive runs without failingChanged
StatementCacheand compile diesel without default features make sure to opt in a more performant implementation by using thestdor thehashbrownfeaturefilter_targetonIncompleteOnConflictUnsigned<T>and anUNSIGNED BIGINTabovei64::MAXread asBigIntWHEREclause of a subselect need aValidGrouping<GB>impl that is generic overGB, as derived impls already are, because an impl of onlyValidGrouping<()>no longer compiles thereSqliteConnection::establishturns off the two-argumentfts3_tokenizer(), which SQLite builds compiled withSQLITE_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_enabledis now anunsafe fn.diesel print-schemanow prefixes a table or column name that starts with a digit withtable_orcolumn_instead of_, so24h_ordersgivestable_24h_ordersinstead of_24h_ordersConfiguration
📅 Schedule: (in timezone America/New_York)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Never, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.