2015-11-30 00:59:46 +03:00
|
|
|
# Change Log
|
|
|
|
All user visible changes to this project will be documented in this file.
|
|
|
|
This project adheres to [Semantic Versioning](http://semver.org/), as described
|
|
|
|
for Rust libraries in [RFC #1105](https://github.com/rust-lang/rfcs/blob/master/text/1105-api-evolution.md)
|
|
|
|
|
2015-12-06 21:20:51 +03:00
|
|
|
## Unreleased
|
|
|
|
|
|
|
|
### Added
|
|
|
|
|
2016-01-07 18:35:05 +03:00
|
|
|
* Add the ability for diesel to maintain your schema for you automatically. See
|
|
|
|
the [migrations](http://sgrif.github.io/diesel/diesel/migrations/index.html)
|
|
|
|
module for individual methods.
|
|
|
|
|
2015-12-06 21:20:51 +03:00
|
|
|
* Add DebugQueryBuilder to build sql without requiring a connection.
|
|
|
|
|
|
|
|
* Add print_sql! and debug_sql! macros to print out and return sql strings from
|
|
|
|
QueryFragments.
|
|
|
|
|
2015-12-20 21:42:17 +03:00
|
|
|
### Fixed
|
|
|
|
|
|
|
|
* `#[changeset_for]` can now be used with structs containing a `Vec`. Fixes
|
|
|
|
[#63](https://github.com/sgrif/diesel/issues/63).
|
|
|
|
|
2015-12-24 00:13:06 +03:00
|
|
|
* No longer generate invalid SQL when an optional update field is not the first
|
|
|
|
field on a changeset. Fixes [#68](https://github.com/sgrif/diesel/issues/68).
|
|
|
|
|
2016-01-07 19:02:02 +03:00
|
|
|
* `#[changeset_for]` can now be used with structs containing only a single field
|
|
|
|
other than `id`. Fixes [#66](https://github.com/sgrif/diesel/issues/66).
|
|
|
|
|
2016-01-07 19:46:03 +03:00
|
|
|
* `infer_schema!` properly works with array columns. Fixes
|
|
|
|
[#65](https://github.com/sgrif/diesel/issues/65).
|
|
|
|
|
2015-12-05 06:05:18 +03:00
|
|
|
## [0.3.0] 2015-12-04
|
2015-12-01 01:32:42 +03:00
|
|
|
|
2015-12-04 20:13:56 +03:00
|
|
|
### Changed
|
|
|
|
|
|
|
|
* `#[changeset_for(table)]` now treats `Option` fields as an optional update.
|
|
|
|
Previously a field with `None` for the value would insert `NULL` into the
|
|
|
|
database field. It now does not update the field if the value is `None`.
|
|
|
|
|
2015-12-05 02:11:11 +03:00
|
|
|
* `.save_changes` (generated by `#[changeset_for]`) now returns a new struct,
|
|
|
|
rather than mutating `self`. The returned struct can be any type that
|
|
|
|
implements `Queriable` for the right SQL type
|
|
|
|
|
2015-12-01 01:32:42 +03:00
|
|
|
### Fixed
|
|
|
|
|
|
|
|
* `#[derive(Queriable)]` now allows generic parameters on the struct.
|
2015-11-30 00:59:46 +03:00
|
|
|
|
2015-12-14 20:13:07 +03:00
|
|
|
* Table definitions can now support up to 26 columns. Because this increases our
|
|
|
|
compile time by 3x, `features = ["large-tables"]` is needed to support table
|
|
|
|
definitions above 16 columns.
|
|
|
|
|
2015-12-01 23:09:29 +03:00
|
|
|
### Added
|
|
|
|
|
|
|
|
* Quickcheck is now an optional dependency. When `features = ["quickcheck"]` is
|
|
|
|
added to `Cargo.toml`, you'll gain `Arbitrary` implementations for everything
|
|
|
|
in `diesel::data_types`.
|
|
|
|
|
2015-12-02 18:33:36 +03:00
|
|
|
* Added support for the SQL `MIN` function.
|
2015-12-01 22:51:22 +03:00
|
|
|
|
2015-12-02 18:31:28 +03:00
|
|
|
* Added support for the `Numeric` data type. Since there is no Big Decimal type
|
|
|
|
in the standard library, a dumb struct has been provided which mirrors what
|
|
|
|
Postgres provides, which can be converted into whatever crate you are using.
|
|
|
|
|
2015-12-02 22:13:12 +03:00
|
|
|
* Timestamp columns can now be used with `std::time::SystemTime` when compiled
|
|
|
|
with `--features unstable`
|
|
|
|
|
2015-12-03 02:45:47 +03:00
|
|
|
* Implemented `Send` on `Connection` (required for R2D2 support)
|
2015-12-03 02:45:03 +03:00
|
|
|
|
2015-12-05 03:23:05 +03:00
|
|
|
* Added `infer_schema!` and `infer_table_from_schema!`. Both macros take a
|
|
|
|
database URL, and will invoke `table!` for you automatically based on the
|
|
|
|
schema. `infer_schema!` queries for the table names, while
|
|
|
|
`infer_table_from_schema!` takes a table name as the second argument.
|
|
|
|
|
2015-11-30 20:29:37 +03:00
|
|
|
## [0.2.0] - 2015-11-30
|
2015-11-30 00:59:46 +03:00
|
|
|
|
2015-11-30 16:53:32 +03:00
|
|
|
### Added
|
|
|
|
|
|
|
|
* Added an `execute` method to `QueryFragment`, which is intended to replace
|
|
|
|
`Connection#execute_returning_count`. The old method still exists for use
|
|
|
|
under the hood, but has been hidden from docs and is not considered public
|
|
|
|
API.
|
|
|
|
|
2015-11-30 19:22:04 +03:00
|
|
|
* Added `get_result` and `get_results`, which work similarly to `load` and
|
|
|
|
`first`, but are intended to make code read better when working with commands
|
|
|
|
like `create` and `update`. In the future, `get_result` may also check that
|
|
|
|
only a single row was affected.
|
|
|
|
|
2015-11-30 20:26:37 +03:00
|
|
|
* Added [`insert`][insert], which mirrors the pattern of `update` and `delete`.
|
|
|
|
|
2015-11-30 00:59:46 +03:00
|
|
|
### Changed
|
|
|
|
|
|
|
|
* Added a hidden `__Nonexhaustive` variant to `result::Error`. This is not
|
|
|
|
intended to be something you can exhaustively match on, but I do want people
|
|
|
|
to be able to check for specific cases, so `Box<std::error::Error>` is
|
|
|
|
not an option.
|
|
|
|
|
For `query_one` and friends, not returning records is an error condition
Through usage, it has become clear that in the overwhelming majority of
cases, you either expect N records, or exactly 1. Expecting either 0 or
1 is uncommon.
However, it's a completely valid use case, and having to match against
`Err(NotFound)` is a pain, especially if you intend to use `try!`.
Keeping that in mind, `QueryResult` now has the `optional` method, which
converts `QueryResult<T>` to `QueryResult<Option<T>>`, treating
`NotFound` as `None`. Since [`result::Error` is not exhaustively
matchable](https://github.com/sgrif/diesel/commit/5435e30f1dc28008a8bef34c889998a0b009f0c4),
I do not think we need to change the error type in this method.
Since checking for and handling `NotFound` seems like a common case,
particularly for returning a 404 response in a web server, it has been
re-exported in the root namespace.
I was going to open a PR to get feedback on this change first, but after
making it, I feel the code quality improvement in our tests (especially
the doctests, where we've removed most `.unwrap()` calls) was enough to
convince me this is the right change.
2015-11-30 03:35:46 +03:00
|
|
|
* `query_one`, `find`, and `first` now assume a single row is returned. For
|
|
|
|
cases where you actually expect 0 or 1 rows to be returned, the `optional`
|
|
|
|
method has been added to the result, in case having a `Result<Option<T>>` is
|
|
|
|
more ideomatic than checking for `Err(NotFound)`.
|
|
|
|
|
2015-11-30 20:26:37 +03:00
|
|
|
### Deprecated
|
|
|
|
|
|
|
|
* `Connection#insert` and `Connection#insert_returning_count` have been
|
|
|
|
deprecated in favor of [`insert`][insert]
|
|
|
|
|
|
|
|
[insert]: http://sgrif.github.io/diesel/diesel/query_builder/fn.insert.html
|
|
|
|
|
2015-11-30 00:59:46 +03:00
|
|
|
## [0.1.0] - 2015-11-29
|
|
|
|
|
|
|
|
* Initial release
|