diesel v0.16.0 Release Notes

Release Date: 2017-08-24 // over 6 years ago
  • ➕ Added

    • ➕ Added helper types for inner join and left outer join

    • diesel::debug_query has been added as a replacement for debug_sql!. This function differs from the macro by allowing you to specify the backend, and will generate the actual query which will be run. The returned value will implement Display and Debug to show the query in different ways

    • diesel::pg::PgConnection, diesel::mysql::MysqlConnection, and diesel::sqlite::SqliteConnection are now exported from diesel::prelude. You should no longer need to import these types explicitly.

    • ➕ Added support for the Decimal datatype on MySQL, using the BigDecimal crate.

    • ➕ Added support for the [Range][range-0.16.0] type on postgreSQL.

    • ➕ Added support for the Datetime type on MySQL.

    • ➕ Added support for the Blob type on MySQL.

    • infer_schema! will now automatically detect which tables can be joined based on the presence of foreign key constraints.

    • ➕ Added support for Add and Sub to timestamp types.

    • Added a way to rename columns in the table macro with #[sql_name="the_column_name"]

    • 📚 Schema inference now also generates documentation comments for tables and columns. For infer_schema!, this is enabled by default. If you are using Diesel's CLI tool, pass the new --with-docs parameter: diesel print-schema --with-docs.

    • infer_schema! now automatically renames columns that conflict with a Rust keyword by placing a _ at the end of the name. For example, a column called type will be referenced as type_ in Rust.

    🔄 Changed

    • 🖨 The deprecated debug_sql! and print_sql! functions will now generate backend specific SQL. (The specific backend they will generate for will be arbitrarily chosen based on the backends enabled).

    • #[belongs_to] will no longer generate the code required to join between two tables. You will need to explicitly invoke joinable! instead, unless you are using infer_schema!

    • 🔄 Changed the migration directory name format to %Y-%m-%d-%H%M%S.

    • between and not_between now take two arguments, rather than a range.

    ✂ Removed

    • 🗄 debug_sql! has been deprecated in favor of diesel::debug_query.

    • 🗄 print_sql! has been deprecated without replacement.

    • 🚚 diesel::backend::Debug has been removed.

    🛠 Fixed

    • 👍 Diesel now properly supports joins in the form: grandchild.join(child.join(parent)). Previously only parent.join(child.join(grandchild)) would compile.

    • When encoding a BigDecimal on PG, 1.0 is no longer encoded as if it were 1.

    📄 [range-0.16.0]: https://docs.diesel.rs/diesel/pg/types/sql_types/struct.Range.html