diesel v0.9.0 Release Notes

Release Date: 2016-12-08 // over 7 years ago
  • โž• Added

    • โž• Added support for SQL NOT IN using the ne_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 than public will be wrapped in a module with the same name as the schema. For example, schema_1.table_1 would be referenced as schema_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 than id, 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 to impl_Queryable! or similar.

    ๐Ÿ›  Fixed

    • #[derive(Identifiable)] now works on structs with lifetimes

    • Attempting 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 or ne_any with an empty array no longer panics. eq_any(vec![]) will return no rows. ne_any(vec![]) will return all rows.