Skip to content

Releases: LHolten/rust-query

v0.6.8

27 Dec 13:49

Choose a tag to compare

  • Allow mutating columns that are used in an index.
  • Implement IntoExpr for Lazy.
  • Add some more documentation.

v0.6.7

22 Dec 20:09

Choose a tag to compare

  • Fix to allow implicit reference to primary key in sqlite schema.
  • Switch to sqlite3-parser for lexing the sqlite schema.
  • Fix to allow unquoted column names in the schema.
  • Recreate full table on index change.
    This is required when a unique index is defined in a table.
  • Added cargo-mutants support.
  • Fixed bug that would make a unique constraint violation in a migration into a panic.
  • Allow changing indices on individual fields without new table.

v0.6.5

16 Dec 22:15

Choose a tag to compare

  • Fix DatabaseAsync to work when the waker changes.

v0.6.4

10 Dec 19:25

Choose a tag to compare

  • Added Transaction::mutable and Transaction::mutable_vec.
  • Deprecated Transaction::update_ok.
  • Fix, only allow Transaction::lazy on table valued expressions.
  • Added Expr::div, Expr::modulo, Expr::concat, Expr::max, Expr::min,
    Expr::truncate, Expr::lower, Expr::upper, Expr::sign, Expr::between,
    Expr::abs, Expr::zero_blob, Expr::unix_epoch, Expr::char_len and
    Expr::byte_len.
  • Deprecated UnixEpoch.
  • Relaxed trait bound on Aggregate::max and Aggregate::min to allow table typed
    expressions.

Example usage of the new Transaction::mutable API:

// old
txn.update_ok(
    &order.customer,
    Customer {
        balance: Update::add(total_amount),
        delivery_cnt: Update::add(1),
        ..Default::default()
    },
);
// new
let mut customer = txn.mutable(&order.customer);
customer.balance += total_amount;
customer.delivery_cnt += 1;
drop(customer);

v0.6.3

30 Nov 12:11

Choose a tag to compare

  • Added DatabaseAsync to run transaction asynchronously on any runtime.
  • Added some reuse of connections between transactions.
  • Added Database::new, to create database without migrations.

v0.6.2

17 Nov 15:47

Choose a tag to compare

  • Added diagnostics for differences between rust code and database schema.
    The new diagnostics use the annotate-snippets crate to annotate the rust code.
    An example error looks like this:
    error: Unique constraint mismatch for `#[version(0)]`
       ╭▸ src/schema/test.rs:146:15
       │
    LL │             #[unique(baz, field2)]
       │               ━━━━━━ database does not have this unique constraint
    LL │             pub struct Foo {
       ╰╴                       ━━━ database has `#[unique(baz, field1)]`
    
  • Improved schema reading code to be more flexible.

v0.6.1

16 Nov 12:22

Choose a tag to compare

  • Added automatic addition and removal of column indices without a new schema version.

v0.6.0

09 Nov 15:50

Choose a tag to compare

Breaking changes

  • Unique constraints are now unnamed.
    Using a unique constraint can be done by using the column names in order e.g.
    Stock.warehouse(w).item(i) instead of Stock::unique(w, i).
  • Support for only filtering on some columns with unique constraint syntax e.g.
    you can do rows.join(Stock.warehouse(w)), which will join all rows from the Stock
    table that match the warehouse.
  • To create an empty row you now have to use txn.insert_ok(v0::Empty {}) instead or
    txn.insert_ok(v0::Empty).
  • Optional::then is renamed to Optional::then_select.
  • Optional::then_expr is renamed to Optional::then.
  • Migrations now use the Lazy type instead of a generic type T: FromExpr.

Added

  • Transaction::lazy and Transaction::lazy_iter are added, these methods
    return rows of type Lazy<'t, Table>, which lazily queries values when they
    are accessed.
  • Transaction::lazy_iter accepts the same kind of argument as Rows::join.
    So any table, optionally filtered by an index can be queried. For example:
    txn.lazy_iter(Post.author(my_user)) would iterate over all posts by my_user.
  • Query::into_iter now returns an iterator that can be moved outside the
    Transaction::query. This makes it possible to return the iterator as a function result.
  • Optional::and_then was added as a convenient way to combine Optional::and
    with Optional::then.
  • Support for extra indices with the #[index] attribute. This works exactly
    like the #[unique] attribute, but it doesn't have a unique constraint.
    Defining an index will also add extra methods to filter on the indexed columns.

Removed

  • The generated macros for querying specific columns from tables were removed.
    This also means the removal of MacroRoot, which was only used by these macros.
    Lazy should be used instead.

v0.5.2

27 Sep 12:58

Choose a tag to compare

  • Add option to configure foreign_keys.
  • Simplify generated query without joins.
  • Preserve column definition order when creating unique constraint.
    This lets the user choose the ordering, allowing the unique constraint to be used as a covering index.
  • Add lock for mutable transactions to fix transaction timeout under load.
    The lock is dropped before committing to allow the next mutable transaction to start.
  • Optimize LEFT JOIN to JOIN when the joined row is guaranteed to exist.
    This allows sqlite to reorder more joins for faster execution plans.

v0.5.1

08 Sep 18:31

Choose a tag to compare

  • Changed default synchronous to FULL.
  • Added the option to configure synchronous to NORMAL.
  • Fixed panic propagation from transaction closures.
  • Pinned sea-query release candidate version.