diesel v0.9.0 Release Notes
Release Date: 2016-12-08 // over 7 years ago-
โ Added
โ Added support for SQL
NOT IN
using thene_any
method.The
table!
macro now allows custom schemas to be specified. Example:
table! { schema_1.table_1 { id -> Integer, } }
The generated module will still be called
table_1
.- The
infer_table_from_schema!
macro now allows custom schemas to be specified. Example:
infer_table_from_schema!("dotenv:DATABASE_URL", "schema_1.table_1");
The
infer_schema!
optionally allows a schema name as the second argument. Any schemas other thanpublic
will be wrapped in a module with the same name as the schema. For example,schema_1.table_1
would be referenced asschema_1::table_1
.โ Added support for batch insert on SQLite. This means that you can now pass a slice or vector to [
diesel::insert
][insert] on all backends.
๐ [insert]: https://docs.diesel.rs/diesel/fn.insert.html
- โ Added a function for SQL
EXISTS
expressions. See [diesel::expression::dsl::exists
][exists] for details.
๐ [exists]: https://docs.diesel.rs/diesel/expression/dsl/fn.sql.html
#[derive(Identifiable)]
can be used with structs that have primary keys other thanid
, as well as structs with composite primary keys. You can now annotate the struct with#[primary_key(nonstandard)]
or#[primary_key(foo, bar)]
.
๐ Changed
- All macros with the same name as traits we can derive (e.g.
Queryable!
) have been renamed toimpl_Queryable!
or similar.
๐ Fixed
#[derive(Identifiable)]
now works on structs with lifetimesAttempting to insert an empty slice will no longer panic. It does not execute any queries, but the result will indicate that we successfully inserted 0 rows.
โก๏ธ Attempting to update a record with no changes will no longer generate invalid SQL. The result of attempting to execute the query will still be an error, but but it will be a
Error::QueryBuilderError
, rather than a database error. This means that it will not abort the current transaction, and can be handled by applications.Calling
eq_any
orne_any
with an empty array no longer panics.eq_any(vec![])
will return no rows.ne_any(vec![])
will return all rows.