Changelog History
Page 3
-
v1.1.1 Changes
January 16, 2018➕ Added
- ➕ Added
diesel::r2d2::PoolError
as an alias forr2d2::Error
. Previously this type was inaccessible due todiesel::r2d2::Error
.
- ➕ Added
-
v1.1.0 Changes
January 15, 2018➕ Added
🔀
r2d2-diesel
has been merged into Diesel proper. You should no longer rely directly onr2d2-diesel
orr2d2
. The functionality of both is exposed fromdiesel::r2d2
.r2d2::PooledConnection
now implementsConnection
. This means that you should no longer need to write&*connection
when usingr2d2
.👍 The
BINARY
column type name is now supported for SQLite.The
QueryId
trait can now be derived.FromSqlRow
can now be derived for types which implementFromSql
.AsExpression
can now be derived for types which implementToSql
.HasSqlType
,NotNull
, andSingleValue
can now be derived with#[derive(SqlType)]
. See the docs for those traits for more information.The return type of
FromSql
,FromSqlRow
, andQueryableByName
can now be written asdeserialize::Result<Self>
.The return type of
ToSql
can now be written asserialize::Result
.➕ Added support for SQLite's
INSERT OR IGNORE
and MySQL'sINSERT IGNORE
via theinsert_or_ignore
function.min
andmax
can now be used with array expressions.➕ Added
diesel::dsl::array
, which corresponds to a PGARRAY[]
literal.➕ Added the
not_none!
macro, used by implementations ofFromSql
which do not expectNULL
.➕ Added
result::UnexpectedNullError
, anError
type indicating that an unexpectedNULL
was received during deserialization.➕ Added
.or_filter
, which behaves identically to.filter
, but usingOR
instead ofAND
.helper_types
now contains a type for every method defined inexpression_methods
, and every function indsl
.Added
FromSql
impls for*const str
and*const [u8]
everywhere thatString
andVec
are supported. These impls do not allocate, and are intended for use by other impls which need to parse a string or bytes, and don't want to allocate. These impls should never be used outside of anotherFromSql
impl.
🗄 Deprecated
- IMPORTANT NOTE Due to [several][rust-deprecation-bug-1]
[bugs][rust-deprecation-bug-2] in Rust, many of the deprecations in this
release may not show a warning. If you want to ensure you are not using any
deprecated items, we recommend attempting to compile your code without the
with-deprecated
feature by addingdefault-features = false
toCargo.toml
.
🗄 [rust-deprecation-bug-1]: https://github.com/rust-lang/rust/issues/47236 🗄 [rust-deprecation-bug-2]: https://github.com/rust-lang/rust/issues/47237
Deprecated
impl_query_id!
in favor of#[derive(QueryId)]
Deprecated specifying a column name as
#[column_name(foo)]
.#[column_name = "foo"]
should be used instead.🗄 The
types
module has been deprecated. It has been split intosql_types
,serialize
, anddeserialize
.query_source::Queryable
andquery_source::QueryableByName
have been deprecated. These traits have been moved todeserialize
.📇
backend::TypeMetadata
has been deprecated. It has been moved tosql_types
.🗄
types::ToSqlOutput
has been deprecated. It has been renamed toserialize::Output
.helper_types::Not
is nowhelper_types::not
🛠 Fixed
infer_schema!
generates valid code when run against a database with no tables.
-
v1.0.0 Changes
January 02, 2018➕ Added
#[derive(QueryableByName)]
can now handle structs that have no associated table. If the#[table_name]
annotation is left off, you must annotate each field with#[sql_type = "Integer"]
#[derive(QueryableByName)]
can now handle embedding other structs. To have a field whose type is a struct which implementsQueryableByName
, rather than a single column in the query, add the annotation#[diesel(embed)]
The
QueryDsl
trait encompasses the majority of the traits that were previously in thequery_dsl
module.
🛠 Fixed
Executing select statements on SQLite will no longer panic when the database returns
SQLITE_BUSY
table!
s which use theDatetime
type with MySQL will now compile correctly, even without thechrono
feature enabled.#[derive(QueryableByName)]
will now compile correctly when there is a shadowedResult
type in scope.BoxableExpression
can now be used with types that are not'static
🔄 Changed
✅
Connection::test_transaction
now requires that the error returned implementDebug
.🏗
query_builder::insert_statement::InsertStatement
is now accessed asquery_builder::InsertStatement
🏗
query_builder::insert_statement::UndecoratedInsertRecord
is now accessed asquery_builder::UndecoratedInsertRecord
#[derive(QueryableByName)]
now requires that the table name be explicitly stated.🚚 Most of the traits in
query_dsl
have been moved toquery_dsl::methods
. These traits are no longer exported inprelude
. This should not affect most apps, as the behavior of these traits is provided byQueryDsl
. However, if you were using these traits inwhere
clauses for generic code, you will need to explicitly douse diesel::query_dsl::methods::WhateverDsl
. You may also need to use UFCS in these cases.If you have a type which implemented
QueryFragment
orQuery
, which you intended to be able to callexecute
orload
on, you will need to manually implementRunQueryDsl
for that type. The trait should be unconditionally implemented (no where clause beyond what your type requires), and the body should be empty.
✂ Removed
🚚 All deprecated items have been removed.
🚚
LoadDsl
andFirstDsl
have been removed. Their functionality now lives inLoadQuery
.
-
v0.99.1 Changes
December 01, 2017🔄 Changed
- Diesel CLI now properly restricts its
clap
dependency. 0.99.0 mistakenly had no upper bound on the version.
- Diesel CLI now properly restricts its
-
v0.99.0 Changes
November 28, 2017➕ 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'
.
-
v0.16.1
May 27, 2018 -
v0.16.0 Changes
August 24, 2017➕ Added
➕ Added helper types for inner join and left outer join
diesel::debug_query
has been added as a replacement fordebug_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 implementDisplay
andDebug
to show the query in different waysdiesel::pg::PgConnection
,diesel::mysql::MysqlConnection
, anddiesel::sqlite::SqliteConnection
are now exported fromdiesel::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
andSub
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 calledtype
will be referenced astype_
in Rust.
🔄 Changed
🖨 The deprecated
debug_sql!
andprint_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 invokejoinable!
instead, unless you are usinginfer_schema!
🔄 Changed the migration directory name format to
%Y-%m-%d-%H%M%S
.between
andnot_between
now take two arguments, rather than a range.
✂ Removed
🗄
debug_sql!
has been deprecated in favor ofdiesel::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 onlyparent.join(child.join(grandchild))
would compile.When encoding a
BigDecimal
on PG,1.0
is no longer encoded as if it were1
.
📄 [range-0.16.0]: https://docs.diesel.rs/diesel/pg/types/sql_types/struct.Range.html
-
v0.15.2 Changes
July 28, 2017🛠 Fixed
BigDecimal
now properly encodes numbers starting with10000
on postgres. See issue #1044 for details.
-
v0.15.1 Changes
July 24, 2017- No changes to public API
-
v0.15.0 Changes
July 23, 2017➕ Added
➕ Added support for the PG
IS DISTINCT FROM
operator👀 The
ON
clause of a join can now be manually specified. See [the docs][join-on-dsl-0.15.0] for details.
📄 [join-on-dsl-0.15.0]: https://docs.diesel.rs/diesel/prelude/trait.JoinOnDsl.html#method.on
🔄 Changed
Diesel will now automatically invoke
numeric_expr!
for your columns in the common cases. You will likely need to delete any manual invocations of this macro.Insertable
no longer treats all fields as nullable for type checking. What this means for you is that if you had an impl likeimpl AsExpression<Nullable<SqlType>, DB> for CustomType
in your code base, you can remove theNullable
portion (Unless you are using it with fields that are actually nullable)Connections will now explicitly set the session time zone to UTC when the connection is established