Files
Notes/notes-service/vendor/sea-query/CHANGELOG.md
T
2026-08-01 16:11:49 +03:00

76 KiB

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

1.0.1 - 2026-05-30

  • 1.0.1 - Borrowed scalar primitive conversions for Value

sea-query-sqlx 0.9.0 - 2026-05-29

1.0.0 - 2026-05-28

  • 1.0.0 - Stable SeaQuery 1.0 release notes

Release Candidates

  • 1.0.0-rc.34 — Table partitioning, Jiff binder support, JSON_TABLE refactor
  • 1.0.0-rc.33Value::Enum, Postgres advisory locks, SelectExprTrait
  • 1.0.0-rc.32EXPLAIN, FILTER on aggregates, ALTER TABLE DROP CONSTRAINT
  • 1.0.0-rc.31SELECT INTO, eq_any/ne_all, Value::array_type
  • 1.0.0-rc.30 — Tokenizer comment parsing, dependency reductions
  • 1.0.0-rc.29 — Legacy serial option for Postgres
  • 1.0.0-rc.28 — Restore Value system
  • 1.0.0-rc.27 — Revert impl Iden for String
  • 1.0.0-rc.26From<Vec<Value>> for Array, FromIterator<T> for Array
  • 1.0.0-rc.24 — Array API redesign
  • 1.0.0-rc.23Value::Enum, ON CONFLICT ON CONSTRAINT, CTE VALUES clause
  • 1.0.0-rc.22 — Index operator class, DROP COLUMN IF EXISTS, nullable values
  • 1.0.0-rc.20ValueTupleIter, SQLite decimal fix

New features

pub type SimpleExpr = Expr; // !
impl From<Expr> for SimpleExpr { .. } // now removed
  • New Iden type system. Previously, DynIden is an alias to SeaRc<dyn Iden>, and is lazily rendered. Now, it's an Cow<'static, str>, and is eagerly rendered. SeaRc is no longer an alias to Rc / Arc, now is only a unit struct. As such, Send / Sync is no longer needed. It's still possible to dynamically serialize a String as identifier, see example usage. https://github.com/SeaQL/sea-query/pull/909
pub type DynIden = SeaRc<dyn Iden>;               // old
pub struct DynIden(pub(crate) Cow<'static, str>); // new

pub struct SeaRc<I>(pub(crate) RcOrArc<I>);       // old
pub struct SeaRc;                                 // new
// the following variants are collapsed into one:
enum TableRef {
    Table(DynIden),
    SchemaTable(DynIden, DynIden),
    DatabaseSchemaTable(DynIden, DynIden, DynIden),
    TableAlias(DynIden, DynIden),
    SchemaTableAlias(DynIden, DynIden, DynIden),
    DatabaseSchemaTableAlias(DynIden, DynIden, DynIden, DynIden),
    ..
}
// now it's just:
enum TableRef {
    Table(TableName, Option<DynIden>), // optional Alias
    ..
}

pub struct DatabaseName(pub DynIden);
pub struct SchemaName(pub Option<DatabaseName>, pub DynIden);
/// A table name, potentially qualified as [database.][schema.]table
pub struct TableName(pub Option<SchemaName>, pub DynIden);
// before
enum ColumnRef {
    Column(DynIden),
    TableColumn(DynIden, DynIden),
    SchemaTableColumn(DynIden, DynIden, DynIden),
    Asterisk,
    TableAsterisk(DynIden),
}
// now
enum ColumnRef {
    /// A column name, potentially qualified as [database.][schema.][table.]column
    Column(ColumnName),
    /// An `*` expression, potentially qualified as [database.][schema.][table.]*
    Asterisk(Option<TableName>),
}

pub struct ColumnName(pub Option<TableName>, pub DynIden);

Enhancements

let query = Query::select()
    .expr(Func::cast_as_quoted("hello", ("MySchema", "MyType")))
    .to_owned();

assert_eq!(
    query.to_string(PostgresQueryBuilder),
    r#"SELECT CAST('hello' AS "MySchema"."MyType")"#
);
assert_eq!(std::mem::size_of::<Value>(), 32);
// old
condition.add(Func::lower(Expr::col(column)).eq(SimpleExpr::FunctionCall(Func::lower(value))))
// new
condition.add(Func::lower(Expr::col(*column)).eq(Func::lower(value)));
Cond::all().add(ConditionExpression::Expr(Expr::new(..))) // old
Cond::all().add(Expr::new(..))                            // new
let table = Table::create()
    .table(Char::Table)
    .col(ColumnDef::new(Char::Id).integer().not_null().auto_increment().primary_key())
    .to_owned();

assert_eq!(
    table.to_string(PostgresQueryBuilder),
    [
        r#"CREATE TABLE "character" ("#,
            r#""id" integer GENERATED BY DEFAULT AS IDENTITY NOT NULL PRIMARY KEY,"#,
        r#")"#,
    ].join(" ")
);

// if you needed to support legacy system you can still do:
let table = Table::create()
    .table(Char::Table)
    .col(ColumnDef::new(Char::Id).custom("serial").not_null().primary_key())
    .to_owned();

assert_eq!(
    table.to_string(PostgresQueryBuilder),
    [
        r#"CREATE TABLE "character" ("#,
            r#""id" serial NOT NULL PRIMARY KEY"#,
        r#")"#,
    ].join(" ")
);

Breaking Changes

error[E0599]: no method named `like` found for enum `sea_query::Expr` in the current scope
    |
    |         Expr::col((self.entity_name(), *self)).like(s)
    |
    |     fn like<L>(self, like: L) -> Expr
    |        ---- the method is available for `sea_query::Expr` here
    |
    = help: items from traits can only be used if the trait is in scope
help: trait `ExprTrait` which provides `like` is implemented but not in scope; perhaps you want to import it
    |
 -> + use sea_query::ExprTrait;
error[E0308]: mismatched types
  --> src/sqlite/discovery.rs:27:57
   |
   |             .and_where(Expr::col(Alias::new("type")).eq("table"))
   |                                                      -- ^^^^^^^ expected `&Expr`, found `&str`
   |                                                      |
   |                                                      arguments to this method are incorrect
   |
   = note: expected reference `&sea_query::Expr`
              found reference `&'static str`
  • Added non_exhaustive to AST enums. It allows us to add new features and extend the AST without breaking the API. If you encounter the following error, please add a wildcard match _ => {..} https://github.com/SeaQL/sea-query/pull/891
error[E0004]: non-exhaustive patterns: `&_` not covered
    |
    |     match table_ref {
    |           ^^^^^^^^^ pattern `&_` not covered
    |
note: `TableRef` defined here
    |
    | pub enum TableRef {
    | ^^^^^^^^^^^^^^^^^
    = note: the matched value is of type `&TableRef`
    = note: `TableRef` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustively
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
    | TableRef::FunctionCall(_, tbl) => SeaRc::clone(tbl),
 -> | &_ => todo!(),
error[E0308]: mismatched types
    |
    |     fn eq(&self, other: &Self) -> bool {
    |                                   ---- expected `bool` because of return type
    |         format!("{:?}", self.0).eq(&format!("{:?}", other.0))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `Expr`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `seaography` (lib) due to 1 previous error
error[E0050]: method `unquoted` has 2 parameters but the declaration in trait `types::Iden::unquoted` has 1
  --> src/tests_cfg.rs:31:17
   |
   |     fn unquoted(&self, s: &mut dyn std::fmt::Write) {
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 parameter, found 2
   |
  ::: src/types.rs:63:17
   |
   |     fn unquoted(&self) -> &str;
   |                 ----- trait requires 1 parameter
impl Iden for Glyph {
  - fn unquoted(&self, s: &mut dyn fmt::Write) {
  + fn unquoted(&self) -> &str {
  -     write!(
  -         s,
  -         "{}",
            match self {
                Self::Table => "glyph",
                Self::Id => "id",
                Self::Tokens => "tokens",
            }
  -     )
  -     .unwrap();
    }
}
error[E0603]: enum `ConditionExpression` is private
   --> tests/mysql/query.rs:734:20
    |
 >  |     use sea_query::ConditionExpression;
    |                    ^^^^^^^^^^^^^^^^^^^ private enum
 >  |     Cond::all().add(ConditionExpression::Expr(Expr::new(
    |                     ^^^^^^^^^^^^^^^^^^^ use of undeclared type `ConditionExpression`

Simply do the following:

Cond::all().add(Expr::new(..))
  • Reworked ColumnRef variants may cause compile error.
error[E0277]: the trait bound `fn(std::option::Option<TableName>) -> sea_query::ColumnRef {sea_query::ColumnRef::Asterisk}: IntoColumnRef` is not satisfied
    --> src/executor/query.rs:1599:21
    |
 >  |             .column(ColumnRef::Asterisk)
    |              ------ ^^^^^^^^^^^^^^^^^^^ the trait `sea_query::Iden` is not implemented for fn item `fn(std::option::Option<TableName>) -> sea_query::ColumnRef {sea_query::ColumnRef::Asterisk}`
    |              |
    |              required by a bound introduced by this call

error[E0308]: mismatched types
    --> src/executor/query.rs:1607:54
    |
 >  |                 SimpleExpr::Column(ColumnRef::Column("id".into_iden()))
    |                                    ----------------- ^^^^^^^^^^^^^^^^ expected `ColumnName`, found `DynIden`
    |                                    |
    |                                    arguments to this enum variant are incorrect

In the former case Asterisk has an additional inner Option<TableName>, you can simply put None.

.column(ColumnRef::Asterisk(None))

In the latter case, &'static str can now be used in most methods that accepts ColumnRef.

Expr::column("id")
  • Reworked TableRef variants may cause compile error.
error[E0061]: this enum variant takes 2 arguments but 1 argument was supplied
   --> src/entity/relation.rs:526:15
    |
 >  |     from_tbl: TableRef::Table("foo".into_iden()),
    |               ^^^^^^^^^^^^^^^-------------------
    |                              ||
    |                              |expected `TableName`, found `DynIden`
    |                              argument #2 of type `Option<DynIden>` is missing

It's recommended to use the IntoTableRef trait to convert types instead of constructing AST manually.

use sea_orm::sea_query::IntoTableRef;

from_tbl: "foo".into_table_ref(),

Minor breaking changes

error[E0308]: mismatched types
   --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sea-schema-0.17.0-rc.3/src/sqlite/def/table.rs:248:59
    |
 >  | Value::String(Some(Box::new(string_value.to_string()))));
    |               ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `String`, found `Box<String>`
    |               |
    |               arguments to this enum variant are incorrect
enum Expr {
  - Custom(String),
  + Custom(Cow<'static, str>),
}

fn cust<T>(s: T) -> Self
where
  - T: Into<String>,
  + T: Into<Cow<'static, str>>,
{
    Self::Custom(s.into())
}

You many encounter the following error:

    |         let sql = self.sql.trim();
    |                   ^^^^^^^^ borrowed value does not live long enough
...
    |             Expr::cust_with_values(sql, values.0)
    |             ------------------------------------- argument requires that `self.stmt.sql` is borrowed for `'static`

Simply convert the &str to String:

let sql = self.sql.trim().to_owned();

Bug Fixes

Upgrades

Maintainence

  • sea-query-binder has been superseded with sea-query-sqlx

0.32.7 - 2025-08-06

Enhancements

  • Added ValueType::is_option

Bug Fixes

SELECT .. OVER "w" FROM "character" WINDOW "w" AS (PARTITION BY "ww")
ALTER TYPE "font" RENAME TO "typeface"
'2025-01-01 00:00:00.000000'
                    ^^^^^^^

0.32.6 - 2025-05-27

Enhancements

0.32.5 - 2025-05-07

New features

Enhancements

0.32.4 - 2025-04-17

New Features

let statement = Table::create()
    .table(Font::Table)
    .temporary()
    .col(
        ColumnDef::new(Font::Id)
            .integer()
            .not_null()
            .primary_key()
            .auto_increment()
    )
    .col(ColumnDef::new(Font::Name).string().not_null())
    .take();

assert_eq!(
    statement.to_string(MysqlQueryBuilder),
    [
        "CREATE TEMPORARY TABLE `font` (",
        "`id` int NOT NULL PRIMARY KEY AUTO_INCREMENT,",
        "`name` varchar(255) NOT NULL",
        ")",
    ]
    .join(" ")
);
  • Added Value::dummy_value
use sea_query::Value;
let v = Value::Int(None);
let n = v.dummy_value();
assert_eq!(n, Value::Int(Some(0)));

Bug Fixes

let query = Query::select()
    .expr(Expr::col(Char::FontSize).as_enum(TextArray))
    .from(Char::Table)
    .to_owned();

assert_eq!(
    query.to_string(PostgresQueryBuilder),
    r#"SELECT CAST("font_size" AS "text"[]) FROM "character""#
);

0.32.3 - 2025-03-16

New Features

let query = Query::update()
    .table(Glyph::Table)
    .value(Glyph::Tokens, Expr::column((Char::Table, Char::Character)))
    .from(Char::Table)
    .cond_where(
        Expr::col((Glyph::Table, Glyph::Image))
            .eq(Expr::col((Char::Table, Char::UserData))),
    )
    .to_owned();

assert_eq!(
    query.to_string(PostgresQueryBuilder),
    r#"UPDATE "glyph" SET "tokens" = "character"."character" FROM "character" WHERE "glyph"."image" = "character"."user_data""#
);
assert_eq!(
    query.to_string(SqliteQueryBuilder),
    r#"UPDATE "glyph" SET "tokens" = "character"."character" FROM "character" WHERE "glyph"."image" = "character"."user_data""#
);
use sea_query::extension::postgres::PostgresSelectStatementExt;

let query = Query::select()
    .columns([Glyph::Image])
    .from(Glyph::Table)
    .table_sample(SampleMethod::SYSTEM, 50.0, None)
    .to_owned();

assert_eq!(
    query.to_string(PostgresQueryBuilder),
    r#"SELECT "image" FROM "glyph" TABLESAMPLE SYSTEM (50)"#
);
let table = Table::alter()
    .table(Char::Table)
    .modify_column(
        ColumnDef::new(Char::Id)
            .integer()
            .using(Expr::col(Char::Id).cast_as(Alias::new("integer"))),
    )
    .to_owned();

assert_eq!(
    table.to_string(PostgresQueryBuilder),
    [
        r#"ALTER TABLE "character""#,
        r#"ALTER COLUMN "id" TYPE integer USING CAST("id" AS integer)"#,
    ]
    .join(" ")
);

House Keeping

  • Updated ordered-float to 4
  • Updated thiserror to 2

0.32.2 - 2025-02-18

New Features

let select = SelectStatement::new()
    .columns([Glyph::Id, Glyph::Image, Glyph::Aspect])
    .from(Glyph::Table)
    .to_owned();
let cte = CommonTableExpression::new()
    .query(select)
    .table_name(Alias::new("cte"))
    .to_owned();
let select = SelectStatement::new()
    .columns([Glyph::Id, Glyph::Image, Glyph::Aspect])
    .from(Alias::new("cte"))
    .with_cte(cte)
    .to_owned();
assert_eq!(
    select.to_string(PostgresQueryBuilder),
    [
        r#"WITH "cte" AS"#,
        r#"(SELECT "id", "image", "aspect""#,
        r#"FROM "glyph")"#,
        r#"SELECT "id", "image", "aspect" FROM "cte""#,
    ]
    .join(" ")
);

Enhancements

Bug Fixes

0.32.1 - 2024-12-01

New Features

  • Added Value::as_null
let v = Value::Int(Some(2));
let n = v.as_null();

assert_eq!(n, Value::Int(None));
let query = Query::select()
    .expr(1.bit_and(2).eq(3))
    .to_owned();

assert_eq!(
    query.to_string(PostgresQueryBuilder),
    r#"SELECT (1 & 2) = 3"#
);

Enhancements

House keeping

0.32.0 - 2024-10-17

Releases

2024-08-09

  • sea-query/0.32.0-rc.1
  • sea-query-binder/0.7.0-rc.1
  • sea-query-binder/0.7.0-rc.2
  • sea-query-rusqlite/0.7.0-rc.1
  • sea-query-postgres/0.5.0-rc.1

2024-10-05

  • sea-query/0.32.0-rc.2
  • sea-query-attr/0.1.3
  • sea-query-derive/0.4.2
  • sea-query-rusqlite/0.7.0-rc.2

New Features

  • Construct Postgres query with vector extension https://github.com/SeaQL/sea-query/pull/774
    • Added postgres-vector feature flag
    • Added Value::Vector, ColumnType::Vector, ColumnDef::vector(), PgBinOper::EuclideanDistance, PgBinOper::NegativeInnerProduct and PgBinOper::CosineDistance
    assert_eq!(
        Query::select()
            .columns([Char::Character])
            .from(Char::Table)
            .and_where(
                Expr::col(Char::Character).eq(Expr::val(pgvector::Vector::from(vec![1.0, 2.0])))
            )
            .to_string(PostgresQueryBuilder),
        r#"SELECT "character" FROM "character" WHERE "character" = '[1,2]'"#
    );
    
  • Added ExprTrait to unify Expr and SimpleExpr methods https://github.com/SeaQL/sea-query/pull/791
  • Support partial index CREATE INDEX .. WHERE .. https://github.com/SeaQL/sea-query/pull/478

Enhancements

sea-query-derive

sea-query-attr

  • Updated syn, heck and darling
  • sea-query-attr is now deprecated

Upgrades

0.31.1 - 2024-10-05

Enhancements

0.31.0 - 2024-08-02

Versions

  • sea-query/0.31.0-rc.1: 2024-01-31
  • sea-query/0.31.0-rc.4: 2024-02-02
  • sea-query/0.31.0-rc.5: 2024-04-14
  • sea-query/0.31.0-rc.6: 2024-05-03
  • sea-query/0.31.0-rc.7: 2024-06-02
  • sea-query/0.31.0-rc.8: 2024-06-19
  • sea-query-binder/0.6.0-rc.1: 2024-01-31
  • sea-query-binder/0.6.0-rc.2: 2024-04-14
  • sea-query-binder/0.6.0-rc.3: 2024-06-19
  • sea-query-binder/0.6.0-rc.4: 2024-06-25
  • sea-query-binder/0.6.0: 2024-08-02
  • sea-query-rusqlite/0.6.0-rc.1: 2024-02-19
  • sea-query-rusqlite/0.6.0: 2024-08-02
  • sea-query-attr/0.1.2: 2024-04-14
  • sea-query-diesel/0.2.0: 2024-08-02

New Features

Breaking Changes

assert_eq!(
    Table::create()
        .table(Alias::new("strange"))
        .col(ColumnDef::new(Alias::new("id")).integer().not_null().auto_increment().primary_key())
        .col(ColumnDef::new(Alias::new("int1")).integer())
        .col(ColumnDef::new(Alias::new("int2")).tiny_integer())
        .col(ColumnDef::new(Alias::new("int3")).small_integer())
        .col(ColumnDef::new(Alias::new("int4")).big_integer())
        .col(ColumnDef::new(Alias::new("string1")).string())
        .col(ColumnDef::new(Alias::new("string2")).string_len(24))
        .col(ColumnDef::new(Alias::new("char1")).char())
        .col(ColumnDef::new(Alias::new("char2")).char_len(24))
        .col(ColumnDef::new(Alias::new("text_col")).text())
        .col(ColumnDef::new(Alias::new("json_col")).json())
        .col(ColumnDef::new(Alias::new("uuid_col")).uuid())
        .col(ColumnDef::new(Alias::new("decimal1")).decimal())
        .col(ColumnDef::new(Alias::new("decimal2")).decimal_len(12, 4))
        .col(ColumnDef::new(Alias::new("money1")).money())
        .col(ColumnDef::new(Alias::new("money2")).money_len(12, 4))
        .col(ColumnDef::new(Alias::new("float_col")).float())
        .col(ColumnDef::new(Alias::new("double_col")).double())
        .col(ColumnDef::new(Alias::new("date_col")).date())
        .col(ColumnDef::new(Alias::new("time_col")).time())
        .col(ColumnDef::new(Alias::new("datetime_col")).date_time())
        .col(ColumnDef::new(Alias::new("boolean_col")).boolean())
        .col(ColumnDef::new(Alias::new("binary2")).binary_len(1024))
        .col(ColumnDef::new(Alias::new("binary3")).var_binary(1024))
        .col(ColumnDef::new(Alias::new("binary4")).blob())
        .to_string(SqliteQueryBuilder),
    [
        r#"CREATE TABLE "strange" ( "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,"#,
            r#""int1" integer,"#,
            r#""int2" tinyint,"#,
            r#""int3" smallint,"#,
            r#""int4" bigint,"#,
            r#""string1" varchar,"#,
            r#""string2" varchar(24),"#,
            r#""char1" char,"#,
            r#""char2" char(24),"#,
            r#""text_col" text,"#,
            r#""json_col" json_text,"#,
            r#""uuid_col" uuid_text,"#,
            r#""decimal1" real,"#,
            r#""decimal2" real(12, 4),"#,
            r#""money1" real_money,"#,
            r#""money2" real_money(12, 4),"#,
            r#""float_col" float,"#,
            r#""double_col" double,"#,
            r#""date_col" date_text,"#,
            r#""time_col" time_text,"#,
            r#""datetime_col" datetime_text,"#,
            r#""boolean_col" boolean,"#,
            r#""binary2" blob(1024),"#,
            r#""binary3" varbinary_blob(1024),"#,
            r#""binary4" blob"#,
        r#")"#,
    ]
    .join(" ")
);
  • MySQL money type maps to decimal
  • MySQL blob types moved to sea_query::extension::mysql::MySqlType; ColumnDef::blob() now takes no parameters
assert_eq!(
    Table::create()
        .table(BinaryType::Table)
        .col(ColumnDef::new(BinaryType::BinaryLen).binary_len(32))
        .col(ColumnDef::new(BinaryType::Binary).binary())
        .col(ColumnDef::new(BinaryType::Blob).blob())
        .col(ColumnDef::new(BinaryType::TinyBlob).custom(MySqlType::TinyBlob))
        .col(ColumnDef::new(BinaryType::MediumBlob).custom(MySqlType::MediumBlob))
        .col(ColumnDef::new(BinaryType::LongBlob).custom(MySqlType::LongBlob))
        .to_string(MysqlQueryBuilder),
    [
        "CREATE TABLE `binary_type` (",
            "`binlen` binary(32),",
            "`bin` binary(1),",
            "`b` blob,",
            "`tb` tinyblob,",
            "`mb` mediumblob,",
            "`lb` longblob",
        ")",
    ]
    .join(" ")
);
  • ColumnDef::binary() set column type as binary with default length of 1
  • Removed BlobSize enum
  • Added StringLen to represent length of var-char/binary
/// Length for var-char/binary; default to 255
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub enum StringLen {
    /// String size
    N(u32),
    Max,
    #[default]
    None,
}
  • ValueType::columntype() of Vec<u8> maps to VarBinary(StringLen::None)
  • ValueType::columntype() of String maps to String(StringLen::None)
  • ColumnType::Bit maps to bit for Postgres
  • ColumnType::Binary and ColumnType::VarBinary map to bytea for Postgres
  • Value::Decimal and Value::BigDecimal bind as real for SQLite
  • ColumnType::Year(Option<MySqlYear>) changed to ColumnType::Year

Enhancements

House keeping

Upgrades

0.30.8 - Pending

Enhancements

0.30.7 - 2024-01-12

Enhancements

House keeping

  • Slight refactors and documentation update

0.30.6 - 2024-01-01

House keeping

sea-query-rusqlite 0.5.0 - 2023-12-29

0.30.5 - 2023-12-14

New Features

Enhancements

Breaking Changes

  • Caution: do not use the --all-features param in Cargo. If you want to enable all features, use the all-features feature flag instead.

0.30.4 - 2023-12-01

Enhancements

  • Impl QueryStatementWriter as inherent methods for WithQuery

0.30.3 - 2023-11-22

New Features

Bug Fixes

Upgrades

  • Upgrade chrono to 0.4.27

Breaking changes

sea-query-derive 0.4.1 - 2023-10-19

  • Upgrade syn to 2

0.30.2 - 2023-09-23

Bug Fixes

Enhancements

  • Make ValueTuple hashable

0.30.1 - 2023-08-25

Versions

New Features

Enhancements

Bug Fixes

Breaking changes

0.30.0 - 2023-07-20

This is a small (but major) upgrade, the only changes are:

Versions

Notes

sea-query 0.29 has a number of breaking changes, so it might be easier for you to first upgrade to 0.29, then upgrade sqlx by bumping to 0.30.

0.29.1 - 2023-07-12

Versions

New Features

Enhancements

Breaking changes

// new definition
struct SeaRc<I>(RcOrArc<I>);
// remains unchanged
type DynIden = SeaRc<dyn Iden>;

// if you did:
let _: DynIden = Rc::new(Alias::new("char"));
// replace with:
let _: DynIden = SeaRc::new(Alias::new("char"));
  • Added new type Quote and changed the Iden trait:
struct Quote(pub(crate) u8, pub(crate) u8);

trait Iden {
    // then:
    fn prepare(&self, s: &mut dyn fmt::Write, q: char);
    // now:
    fn prepare(&self, s: &mut dyn fmt::Write, q: Quote);

    // then:
    fn quoted(&self, q: char) -> String;
    // now:
    fn quoted(&self, q: Quote) -> String;
}

House keeping

Bug fixes

0.28.5 - 2023-05-11

0.28.4 - 2023-04-11

Bug fixes

0.28.3 - 2023-01-18

Enhancements

0.28.2 - 2023-01-04

Enhancements

0.28.1 - 2022-12-29

Bug fixes

0.28.0 - 2022-12-09

New Features

API Additions

Enhancements

Bug fixes


// given
let (statement, values) = sea_query::Query::select()
    .column(Glyph::Id)
    .from(Glyph::Table)
    .cond_where(Cond::any()
        .add(Cond::all()) // empty all() => TRUE
        .add(Cond::any()) // empty any() => FALSE
    )
    .build(sea_query::MysqlQueryBuilder);

// old behavior
assert_eq!(statement, r#"SELECT `id` FROM `glyph`"#);

// new behavior
assert_eq!(
    statement,
    r#"SELECT `id` FROM `glyph` WHERE (TRUE) OR (FALSE)"#
);

Breaking changes

Deprecations

House keeping

0.27.2 - 2022-11-14

sea-query-binder 0.2.2

0.27.1 - 2022-10-18

0.27.0 - 2022-10-16

New Features

Enhancements

Bug Fixes

Breaking changes

// Before: will extend current Condition
assert_eq!(
    Query::select()
        .cond_where(any![Expr::col(Glyph::Id).eq(1), Expr::col(Glyph::Id).eq(2)])
        .cond_where(Expr::col(Glyph::Id).eq(3))
        .to_owned()
        .to_string(PostgresQueryBuilder),
    r#"SELECT WHERE "id" = 1 OR "id" = 2 OR "id" = 3"#
);
// Before: confusing, since it depends on the order of invocation:
assert_eq!(
    Query::select()
        .cond_where(Expr::col(Glyph::Id).eq(3))
        .cond_where(any![Expr::col(Glyph::Id).eq(1), Expr::col(Glyph::Id).eq(2)])
        .to_owned()
        .to_string(PostgresQueryBuilder),
    r#"SELECT WHERE "id" = 3 AND ("id" = 1 OR "id" = 2)"#
);
// Now: will always conjoin with `AND`
assert_eq!(
    Query::select()
        .cond_where(Expr::col(Glyph::Id).eq(1))
        .cond_where(any![Expr::col(Glyph::Id).eq(2), Expr::col(Glyph::Id).eq(3)])
        .to_owned()
        .to_string(PostgresQueryBuilder),
    r#"SELECT WHERE "id" = 1 AND ("id" = 2 OR "id" = 3)"#
);
// Now: so they are now equivalent
assert_eq!(
    Query::select()
        .cond_where(any![Expr::col(Glyph::Id).eq(2), Expr::col(Glyph::Id).eq(3)])
        .cond_where(Expr::col(Glyph::Id).eq(1))
        .to_owned()
        .to_string(PostgresQueryBuilder),
    r#"SELECT WHERE ("id" = 2 OR "id" = 3) AND "id" = 1"#
);
Enum {
    name: DynIden,
    variants: Vec<DynIden>,
}

House keeping

Upgrades

  • Upgrade sqlx driver to 0.6.1

0.26.4 - 2022-10-13

New Features

Bug Fixes

0.26.3 - 2022-08-18

Bug Fixes

House keeping

0.26.2 - 2022-07-21

Bug Fixes

0.26.0 - 2022-07-02

New Features

Enhancements

Upgrades

  • Upgrade uuid to 1.0
  • Upgrade time to 0.3
  • Upgrade ipnetwork to 0.19
  • Upgrade bigdecimal to 0.3
  • Upgrade sqlx driver to 0.6

Breaking changes

  • As part of #306, the standalone functions escape_string and unescape_string are removed, and becomes backend specific. So now, you have to:
use sea_query::EscapeBuilder;

let string: String = MySqlQueryBuilder.escape_string(r#" "abc" "#);
let string: String = MysqlQueryBuilder.unescape_string(r#" \"abc\" "#);
  • Replace Value::Ipv4Network and Value::Ipv6Network to Value::IpNetwork https://github.com/SeaQL/sea-query/pull/364

  • Remove some redundant feature flags postgres-chrono, postgres-json, postgres-uuid, postgres-time. Use the with-* equivalence

Full Changelog: https://github.com/SeaQL/sea-query/compare/0.25.0...0.26.0

0.25.2 - 2022-07-01

New features

Enhancements

0.25.1 - 2022-06-26

Enhancements

  • clear_order_by for OrderedStatement

0.25.0 - 2022-05-28

New Features

Enhancements

Bug fixes

Breaking Changes

.returning(Query::select().column(Glyph::Id).take()) // before
.returning(Query::returning().columns([Glyph::Id])) // now
  • In #333, the custom expression API changed for Postgres, users should change their placeholder from ? to Postgres's $N
let query = Query::select()
    .columns([Char::Character, Char::SizeW, Char::SizeH])
    .from(Char::Table)
    .and_where(Expr::col(Char::Id).eq(1))
    .and_where(Expr::cust_with_values("6 = $2 * $1", vec![3, 2]).into())
    .to_owned();

assert_eq!(
    query.to_string(PostgresQueryBuilder),
    r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE "id" = 1 AND 6 = 2 * 3"#
);

As a side effect, ?? is no longer needed for escaping ?

let query = Query::select()
    .expr(Expr::cust_with_values(
        "data @? ($1::JSONPATH)",
        vec!["hello"],
    ))
    .to_owned();

assert_eq!(
    query.to_string(PostgresQueryBuilder),
    r#"SELECT data @? ('hello'::JSONPATH)"#
);
  • In #314, ColumnType's Binary(Option<u32>) changed to Binary(BlobSize), so if you used Binary(None) before, you should change to Binary(BlobSize::Blob(None))

Full Changelog: https://github.com/SeaQL/sea-query/compare/0.24.0...0.25.0

0.24.6 - 2022-05-12

0.24.5 - 2022-05-09

0.24.4 - 2022-04-26

  • update sea-query-driver

0.24.3 - 2022-04-26

Bug fixes

Enhancements

0.24.2 - 2022-04-18

Bug fixes

Notes: 0.24.0 & 0.24.1 were yanked

0.24.1 - 2022-04-15

Enhancements

Bug fixes

0.24.0 - 2022-04-05

New Features

Enhancements

Bug fixes

Breaking changes

  • The enum variants for LockType were renamed: Exclusive -> Update and Shared -> Share
  • As part of #283, the drivers are split to the sea-query-driver crate
    1. Remove methods Value::is_json and Value::as_ref_json when feature: with-json is disabled
    2. Remove methods Value::is_time_* and Value::as_ref_time_* when feature: with-time is disabled
    3. Remove methods Value::is_chrono_* and Value::as_ref_chrono* when feature: with-chrono is disabled
    4. Remove methods Value::is_decimal, Value::as_ref_decimal and Value::decimal_to_f64 when feature: with-rust_decimal is disabled
    5. Remove methods Value::is_big_decimal, Value::as_ref_big_decimal and Value::big_decimal_to_f64 when feature: with-bigdecimal is disabled
    6. Remove methods Value::is_uuid and Value::as_ref_uuid when feature: with-uuid is disabled
    7. Remove methods Value::is_array and Value::as_ref_array when feature: postgres-array is disabled

Full Changelog: https://github.com/SeaQL/sea-query/compare/0.23.0...0.24.0

0.23.0 - 2022-03-15

New Features

Enhancements

Bug fixes

Breaking changes

In order to co-exist with the time crate, Date, Time, DateTime etc are renamed to ChronoDate, ChronoTime, ChronoDateTime. In addition, new variants TimeDate, TimeTime, TimeDateTime and so on are introduced to Value.

0.22.0 - 2022-02-26

New Features

Full Changelog: https://github.com/SeaQL/sea-query/compare/0.21.0...0.22.0

0.21.0 - 2022-02-01

Breaking Changes

New Features

Enhancements

Bug Fixes

Full Changelog: https://github.com/SeaQL/sea-query/compare/0.20.0...0.21.0

0.20.0 - 2021-12-11

Merged PRs

Full Changelog: https://github.com/SeaQL/sea-query/compare/0.19.4...0.20.0

0.19.4 - 2021-12-11

Merged PRs

Full Changelog: https://github.com/SeaQL/sea-query/compare/0.19.2...0.19.4

0.19.2 - 2021-12-04

Merged PRs

Full Changelog: https://github.com/SeaQL/sea-query/compare/0.19.1...0.19.2

0.19.1 - 2021-11-25

Merged PRs

Full Changelog: https://github.com/SeaQL/sea-query/compare/0.19.0...0.19.1

0.19.0 - 2021-11-19

Merged PRs

Full Changelog: https://github.com/SeaQL/sea-query/compare/0.18.2...0.19.0

0.18.2 - 2021-11-04

Merged PRs

Full Changelog: https://github.com/SeaQL/sea-query/compare/0.18.1...0.18.2

0.18.1 - 2021-10-26

  • [#169] Add support for Postgres interval type
  • [#171] Fix bug in Condition::add where Condition negation is ignored

0.18.0 - 2021-10-15

  • [#159] Add ValueType::column_type
  • [#160] Add FromValueTuple trait

0.17.3 - 2021-10-26

  • [#171] Fix bug in Condition::add where Condition negation is ignored

0.17.2 - 2021-10-15

  • [#164] Revert "Fix SQLite chrono::NaiveTime binding"

0.17.1 - 2021-10-12 (yanked)

0.17.0 - 2021-10-06

  • [#157] Fix binding nullable custom types on db drivers

The as_ref_* methods on Value are changed:

pub fn as_ref_json(&self) -> &Json;

Is now

pub fn as_ref_json(&self) -> Option<&Json>;

0.16.6 - 2021-10-26

  • [#171] Fix bug in Condition::add where Condition negation is ignored

0.16.5 - 2021-09-30

  • [#145] Add Condition::not
  • [#149] Fix SQLite chrono::NaiveTime binding

0.16.4 - 2021-09-26

  • Fix table drop options for SQLite
  • Add IndexCreateStatement::is_unique_key()

0.16.3 - 2021-09-17

  • [#131] CAST AS expression
  • [#131] InsertStatement accepts SimpleExpr
  • [#137] SQLx Postgres driver bind DateTime<FixedOffset>

0.16.2 - 2021-09-15

  • [#120] Support RETURNING for DeleteStatement
  • [#128] Support UNION clause for SelectStatement

0.16.1 - 2021-09-10

  • [#129] MySql ColumnType::Binary(None) maps to "blob"

0.16.0 - 2021-09-02

  • [#112] Introduce Nullable trait to permit custom Option<T>

  • [#113] ValueType trait should have a non-panic-ing method

  • [#114] ValueType revamp

    1. Remove ValueTypeDefault
    2. Change type_name to return String
  • [#115] Postgres concatenate operator (||)

  • [#117] Lock support (FOR SHARE, FOR UPDATE) for SELECT statement

0.15.0 - 2021-08-21

  • [#107] Revamp Value to typed null value
  • Added BigDecimal support

The Value::Null variant is removed. You have to use a specific variant with a None.

Before:

Query::insert()
    .values_panic(vec![
        Value::Null,
        2.1345.into(),
    ])

After:

Query::insert()
    .values_panic(vec![
        Value::String(None),
        2.1345.into(),
    ])

Since we cannot handle the generic Null value on JSON, we removed the json method on InsertStatement and UpdateStatement. The following NO LONGER WORKS:

let query = Query::insert()
    .into_table(Glyph::Table)
    .json(json!({
        "aspect": 2.1345,
        "image": "24B",
    }));
let query = Query::update()
    .table(Glyph::Table)
    .json(json!({
        "aspect": 2.1345,
        "image": "235m",
    }));

In addition, if you constructed Value manually before (instead of using into() which is unaffected), you have to wrap them in an Option:

Before:

let (sql, values) = query.build(PostgresQueryBuilder);
assert_eq!(
	values,
	Values(vec![Value::String(Box::new("A".to_owned())), Value::Int(1), Value::Int(2), Value::Int(3)]))
);

After:

let (sql, values) = query.build(PostgresQueryBuilder);
assert_eq!(
	values,
	Values(vec![Value::String(Some(Box::new("A".to_owned()))), Value::Int(Some(1)), Value::Int(Some(2)), Value::Int(Some(3))]))
);

0.14.1 - 2021-08-15

  • [#87] Fix inconsistent Ownership of self in Builder APIs
  • [#105] Use Arc for SeaRc with feature flag thread-safe

0.12.12 - 2021-08-14

  • [#98] Support Postgres full text search

0.12.11 - 2021-08-13

  • Support SeaORM

0.12.10 - 2021-08-11

  • [#89] flattening iden enums in derive macro

0.12.9 - 2021-08-08

  • [#77] Postgres binary type
  • [#81] example for CockroachDB
  • [#84] Fix Postgres constraint keywords
  • [#75] DateTimeWithTimeZone value type and TimestampWithTimeZone column type

0.12.8 - 2021-07-24

  • Fix Postgres datetime column type mapping
  • Uuid in schema builder

0.12.7 - 2021-07-13

  • cust_with_values allow escape ? using ??

0.12.6 - 2021-07-07

  • Fixed build error for sqlx-sqlite

0.12.5 - 2021-07-07

  • Support Decimal from rust_decimal

0.12.4 - 2021-06-23

  • Added returning for update statement

0.12.3 - 2021-06-19

  • Added type_name for ValueType
  • Values derive Clone
  • Added Update::col_expr
  • Type def Rc as SeaRc
  • getters for schema statements

0.12.2 - 2021-06-04

  • Fixed and_where_option
  • Added Condition::add_option

0.12.1 - 2021-06-03

  • Added not_in_subquery

0.12.0 - 2021-05-31

  • Unify cond_where and and_where. Note: will panic if calling or_where after and_where.

0.11.1 - 2021-05-22

  • Updated Readme

0.11.0 - 2021-05-19

  • Added APIs to support ORM
  • Backend and internal refactoring
  • Introduced QueryStatementBuilder and SchemaStatementBuilder traits
  • Introduced ConditionalStatement and OrderedStatement traits
  • Introduced any/all style conditions for cond_where and cond_having

0.10.6 - 2021-05-04

  • Postgres ALTER TYPE statements for ENUM

0.10.5 - 2021-05-02

  • Updated documentation

0.10.4 - 2021-05-02

  • returning() expression for Postgres insert statements
  • Remove redundant index name in foreign key expression of MySQL

0.10.3 - 2021-04-30

  • custom Error type
  • Empty value list for IN
  • Index prefix and IndexOrder

0.10.2 - 2021-04-27

  • Foreign key API from and to
  • Fix foreign key bug in ON UPDATE

0.10.1 - 2021-04-25

  • Added index_type() (FullText and Hash)
  • Added unique() to Index
  • Support composite primary key

0.10.0 - 2021-04-23

  • Use IntoIterator trait instead of Vec on most APIs
  • UUID support in Value
  • Rusqlite support

0.9.6 - 2021-04-18

  • Rename create_if_not_exists to if_not_exists
  • Remove partition_option from TableAlterStatement
  • Added ColumnDef::extra()

0.9.5 - 2021-04-17

  • Added SchemaStatement

0.9.4 - 2021-04-13

  • Fixed DateTime quoting bugs

0.9.3 - 2021-04-08

  • Update sea-query-derive to 0.1.2

0.9.2 - 2021-04-05

  • derive supporting enum tuple variant and custom method

0.9.1 - 2021-03-30

  • updated docs

0.9.0 - 2021-03-29

  • Introduced IntoColumnRef trait to consolidate column and table.column
  • Introduced IntoTableRef trait to consolidate table and schema.table
  • Introduced IntoIden trait to remove *_dyn methods

0.8.5 - 2021-03-29

  • added into_simple_expr()

0.8.4 - 2021-03-24

  • Fixing IS NULL

0.8.3 - 2021-03-23

  • derive Debug on most structs

0.8.2 - 2021-03-23

  • Added unescape_string

0.8.1 - 2021-03-23

  • Improve documentation

0.8.0 - 2021-03-14

  • json support behind features
  • backend as features (backend-mysql, backend-postgres, backend-sqlite)
  • added from_schema(), from_schema_as()

0.7.0 - 2021-03-06

  • Revamp Value
  • build() API change
  • postgres driver support
  • json and chrono support

0.6.1 - 2021-03-05

  • Added join_as
  • Deprecated expr_alias, from_alias

0.6.0 - 2021-02-20

  • Custom expression with parameters Expr::cust_with_values()
  • Custom function call Func::cust()
  • Postgres enum Type::create().as_enum()

0.5.0 - 2021-02-09

  • derive macro #[derive(Iden)]

0.4.0 - 2021-02-02

  • Added JSON binary column type ColumnDef::json_binary()
  • Custom column type ColumnDef::custom()

0.3.0 - 2020-12-29

0.2.0 - 2020-12-26

0.1.0 - 2020-12-16

Publish to crate.io