diesel v0.99.0 Release Notes
Release Date: 2017-11-28 // over 6 years ago-
➕ Added
⚡️ The
.for_update()
method has been added to select statements, allowing construction ofSELECT ... FOR UPDATE
.0️⃣ Added
insert_into(table).default_values()
as a replacement forinsert_default_values()
➕ Added
insert_into(table).values(values)
as a replacement forinsert(values).into(table)
.➕ Added support for MySQL's
REPLACE INTO
asreplace_into(table)
.➕ Added
replace_into(table).values(values)
as a replacement forinsert_or_replace(values).into(table)
.Added
on_conflict_do_nothing
onInsertStatement
as a replacement foron_conflict_do_nothing
onInsertable
structs.➕ Added
on_conflict
onInsertStatement
as a replacement foron_conflict
onInsertable
structs.⚡️
filter
can now be called on update and delete statements. This means that instead ofupdate(users.filter(...))
you can writeupdate(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 typeNullable<Text>
as well asText
.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 thansql
for complete queries. The main difference fromsql
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
🔄 Changed
The signatures of
QueryId
,Column
, andFromSqlRow
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 ajoinable!
invocation for those tables.diesel_codegen
should no longer explicitly be used as a dependency. Unless you are usinginfer_schema!
orembed_migrations!
, you can simply remove it from yourCargo.toml
. All other functionality is now provided bydiesel
itself.Code using
infer_schema!
orinfer_table_from_schema!
must now adddiesel_infer_schema
toCargo.toml
, and#[macro_use] extern crate diesel_infer_schema
tosrc/lib.rs
Code using
embed_migrations!
must now adddiesel_migrations
toCargo.toml
, and#[macro_use] extern crate diesel_migrations
tosrc/lib.rs
🚚 The
migrations
module has been moved out ofdiesel
and intodiesel_migrations
🗄 Deprecated
0️⃣ Deprecated
insert_default_values()
in favor ofinsert_into(table).default_values()
🗄 Deprecated
insert(values).into(table)
in favor ofinsert_into(table).values(values)
.Deprecated
insert_or_replace(values).into(table)
in favor ofreplace_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 ofallow_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. Usesql_query
if you need raw SQL with bind parameters.
✂ Removed
🚚
IntoInsertStatement
andBatchInsertStatement
have been removed. It's unlikely that your application is using these types, butInsertStatement
is now the only "insert statement" type.🚚
Citext
as a type alias forText
has been removed. Writingcitext_column.eq("foo")
would perform a case-sensitive comparison. More fleshed out support will be required.
🛠 Fixed
When using MySQL and SQLite, dates which cannot be represented by
chrono
(such as0000-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 deriveInsertable
orAsChangeset
.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'
.