You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow inserting Option<T> into columns where the type is not nullable
This is important to allow structs with types like `Option<i32>` for
`id` to be used with `Insertable`, since the column has a default.
Ideally we would only allow this to work with columns that have a
default value. I may make that change in future, but at the moment we do
not have a way of knowing which columns have a default.
I am OK with the additional incorrect queries that this allows, as they
were already possible. There's no reason that `struct NewUser { name:
Option<String>, hair_color: Option<String>, }` shouldn't work if `struct
NewUser { hair_color: Option<String> }` works, as they both generate
incorrect queries (name is not null and has no default in this example).
I've documented the change as only affecting columns with a default, as
we reserve the right to disallow using `Option<T>` with columns that
have no default value in the future. Ideally before 1.0 I'd like to
replace this with a solution that doesn't leak the
`IntoNullable::SqlType` constraint in the public API.
Fixesdiesel-rs#554.
0 commit comments