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.
#![forbid(unsafe_code)]in all workspace crates SeaQL#930- Unify
ExprandSimpleExpras one type.SimpleExpris kept as an alias ofExpr, but they can now be used interchangably. There may be a few compile errors and some clippy warnings, basically just remove the redundant.into()SeaQL#889
pub type SimpleExpr = Expr; // !
impl From<Expr> for SimpleExpr { .. } // now removed- New
Identype system. Previously,DynIdenis an alias toSeaRc<dyn Iden>, and is lazily rendered. Now, it's anCow<'static, str>, and is eagerly rendered.SeaRcis no longer an alias toRc/Arc, now is only a unit struct. As such,Send/Syncis no longer needed. It's still possible to dynamically serialize a String as identifier, see example usage. SeaQL#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- Reworked
TableRefandColumnRefvariants SeaQL#927
// 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);- Add
Expr::not_existsSeaQL#983 - Add
serdefeature. Currently, enabling it allowsValueto be serializable SeaQL#966 - Add
Keyword::DefaultSeaQL#965 - Enable
clippy::nurserySeaQL#938 - Removed unnecessary
'staticbounds from type signatures SeaQL#921 cast_as_quotednow allows you to qualify the type name. SeaQL#922
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")"#
);- Most
Valuevariants are now unboxed (exceptBigDecimalandArray). Previously the size is 24 bytes. SeaQL#925
assert_eq!(std::mem::size_of::<Value>(), 32);- Merged
Func/FunctionandPgFunc/PgFunction. Now the latter is just an alias of the former SeaQL#944
// 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)));impl From<Expr> for Condition. Now you can useExprinstead ofConditionExpression, which has been removed from the public API SeaQL#915
Cond::all().add(ConditionExpression::Expr(Expr::new(..))) // old
Cond::all().add(Expr::new(..)) // new- Replaced
serialwithGENERATED BY DEFAULT AS IDENTITY(Postgres) SeaQL#918
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(" ")
);- Removed inherent
SimpleExprmethods that duplicateExprTrait. If you encounter the following error, please adduse sea_query::ExprTraitin scope SeaQL#890
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_exhaustiveto 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_ => {..}SeaQL#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!(),ExprTrait::eqcollided withstd::cmp::Eq. If you encounter the following error, please usestd::cmp::PartialEq::eq(a, b)orsea_query::ExprTrait::eq(a, b)explicitly SeaQL#890
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- The method signature of
Iden::unquotedis changed. If you're implementingIdenmanually, you can modify it like below SeaQL#909
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 parameterimpl 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();
}
}- Removed
ConditionExpressionfrom the public API. Instead, just convert betweenConditionandExprusingFrom/IntoSeaQL#915
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
ColumnRefvariants 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 incorrectIn 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
TableRefvariants 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 missingIt'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(),- Replace
dyn <Trait>withimpl <Trait>SeaQL#982 This gained us up to 10% performance, however it does meandyn QueryBuilderis no longer possible.
-
Changed
Into*traits (likeIntoCondition) to be defined astrait IntoCondition: Into<Condition>and implemented for allT: Into<Condition>. NowIntoConditionandInto<Condition>are completely interchangable. But you can still use.into_condition()for readability.If you have manually implemented
Into*traits, it may cause conflicts. You should rewrite your impls as asimpl From<..> for Condition.Full list of changed traits:
-
Unboxed
Valuevariants may cause compile error. Simply remove theBoxin these cases SeaQL#925
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-
Blanket-implemented
SqliteExprandPgExprforT where T: ExprTraitSeaQL#914Now you can use database-specific operators with all expression types. If you had custom implementations in your own code, some may no longer compile and may need to be deleted.
-
Replaced
ColumnSpec::Check(Expr)withColumnSpec::Check(Check)to support named check constraints SeaQL#920 -
SelectStatement::cross_joinno longer accepts a condition SeaQL#956 -
Turned
TypeReffrom an enum into a struct that reusesTableName. SeaQL#969 -
Changed
Expr::TypeName(DynIden)toExpr::TypeName(TypeRef), which can be qualified.If you manually construct this variant and it no longer compiles, just add
.into(). -
Renamed
QueryBuilder::prepare_simple_exprtoprepare_exprSeaQL#988 -
Changed signature of
Expr::CustomSeaQL#940
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();- Removed invalid condition requirement on
SelectStatement::cross_joinSeaQL#956
- Upgraded to Rust Edition 2024 SeaQL#885
sea-query-binderhas been superseded withsea-query-sqlx
- Added
ValueType::is_option
- Fix incorrect casting of
ChronoDateTimeWithTimeZoneinValue::ArraySeaQL#933 - Add missing parenthesis to
WINDOWclause SeaQL#919
SELECT .. OVER "w" FROM "character" WINDOW "w" AS (PARTITION BY "ww")- Fix serializing iden as a value in
ALTER TYPE ... RENAME TO ...statements SeaQL#924
ALTER TYPE "font" RENAME TO "typeface"- Fixed the issue where milliseconds were truncated when formatting
Value::ConstantSeaQL#929
'2025-01-01 00:00:00.000000'
^^^^^^^- impl
From<Condition>andFrom<ConditionExpression>forSimpleExprSeaQL#886
- Support for creating functional indexes in Postgres and MySQL SeaQL#869
- Make
RcOrArca documented type alias instead of a direct reexport SeaQL#875 - Impl
Idenfor&'static str(don't wrap strings inAlias::new) SeaQL#882
- Added support for temporary tables SeaQL#878
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)));- Quote type properly in
AsEnumcasting SeaQL#880
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""#
);- Support
Update FROM ..SeaQL#861
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""#
);- Support
TABLESAMPLE(Postgres) SeaQL#865
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)"#
);- Support
ALTER COLUMN USING ..(Postgres) SeaQL#848
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(" ")
);- Updated
ordered-floatto4 - Updated
thiserrorto2
- Added
with_cteto useWITHclauses in all statements SeaQL#859
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(" ")
);- Added
Expr::columnSeaQL#852 - Added Postgres function
DATE_TRUNCSeaQL#825 - Added
INCLUDEclause for Postgres BTree index SeaQL#826
- Write empty Postgres array as '{}' SeaQL#854
- Added
Value::as_null
let v = Value::Int(Some(2));
let n = v.as_null();
assert_eq!(n, Value::Int(None));- Added bitwise and/or operators (
bit_and,bit_or) SeaQL#841
let query = Query::select()
.expr(1.bit_and(2).eq(3))
.to_owned();
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT (1 & 2) = 3"#
);- Added
GREATEST&LEASTfunction SeaQL#844 - Added
ValueType::enum_type_name()SeaQL#836 - Removed "one common table" restriction on recursive CTE SeaQL#835
- Remove unnecessary string hashes SeaQL#815
sea-query/0.32.0-rc.1sea-query-binder/0.7.0-rc.1sea-query-binder/0.7.0-rc.2sea-query-rusqlite/0.7.0-rc.1sea-query-postgres/0.5.0-rc.1
sea-query/0.32.0-rc.2sea-query-attr/0.1.3sea-query-derive/0.4.2sea-query-rusqlite/0.7.0-rc.2
- Construct Postgres query with vector extension SeaQL#774
- Added
postgres-vectorfeature flag - Added
Value::Vector,ColumnType::Vector,ColumnDef::vector(),PgBinOper::EuclideanDistance,PgBinOper::NegativeInnerProductandPgBinOper::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
- Added
ExprTraitto unifyExprandSimpleExprmethods SeaQL#791 - Support partial index
CREATE INDEX .. WHERE ..SeaQL#478
- Replace
Educewith manual implementations SeaQL#817
- Merged
#[enum_def]intosea-query-derive #[enum_def]now impl additionalIdenStaticandAsRef<str>SeaQL#769
- Updated
syn,heckanddarling sea-query-attris now deprecated
- Upgrade
sqlxto0.8SeaQL#798 - Upgrade
bigdecimalto0.4SeaQL#798 - Upgrade
rusqliteto0.32SeaQL#802
- Derive
Eq,Ord,HashforAliasSeaQL#818 - Added
Func::md5function SeaQL#786 - Added Postgres Json functions
JSON_BUILD_OBJECTandJSON_AGGSeaQL#787 - Added Postgres function
ARRAY_AGGSeaQL#846 - Added
Func::cast_as_quotedSeaQL#789 - Added
IF NOT EXISTStoALTER TYPE ADD VALUESeaQL#803
sea-query/0.31.0-rc.1: 2024-01-31sea-query/0.31.0-rc.4: 2024-02-02sea-query/0.31.0-rc.5: 2024-04-14sea-query/0.31.0-rc.6: 2024-05-03sea-query/0.31.0-rc.7: 2024-06-02sea-query/0.31.0-rc.8: 2024-06-19sea-query-binder/0.6.0-rc.1: 2024-01-31sea-query-binder/0.6.0-rc.2: 2024-04-14sea-query-binder/0.6.0-rc.3: 2024-06-19sea-query-binder/0.6.0-rc.4: 2024-06-25sea-query-binder/0.6.0: 2024-08-02sea-query-rusqlite/0.6.0-rc.1: 2024-02-19sea-query-rusqlite/0.6.0: 2024-08-02sea-query-attr/0.1.2: 2024-04-14sea-query-diesel/0.2.0: 2024-08-02
- Rework SQLite type mapping SeaQL#735
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
BlobSizeenum - Added
StringLento 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()ofVec<u8>maps toVarBinary(StringLen::None)ValueType::columntype()ofStringmaps toString(StringLen::None)ColumnType::Bitmaps tobitfor PostgresColumnType::BinaryandColumnType::VarBinarymap tobyteafor PostgresValue::DecimalandValue::BigDecimalbind asrealfor SQLiteColumnType::Year(Option<MySqlYear>)changed toColumnType::Year
- Added
IntoColumnDeftrait, allowing&mut ColumnDef/ColumnDefas argument - Added
ColumnType::string()andColumnType::var_binary()as shim for old API - Added
ON DUPLICATE KEY DO NOTHINGpolyfill for MySQL SeaQL#765 - Added non-TLS runtime SeaQL#783
- Added
ColumnTypemapping documentation - Replace
derivativewitheduceSeaQL#763
- Added
InsertStatement::values_from_panicSeaQL#739
- Added
SelectStatement::applySeaQL#730
- Slight refactors and documentation update
- Fix clippy warnings on Rust 1.75 SeaQL#729
- Upgrade
rusqliteto0.30SeaQL#728
- Added feature flag
option-more-parenthesesto have more parentheses in expressions SeaQL#723 - Added feature flag
option-sqlite-exact-column-typeto only useintegerfor SQLite - Support
COUNT(DISTINCT "column")SeaQL#700 - Support index hints for MySQL (via
extension::mysql::MySqlSelectStatementExt) SeaQL#636 - Support expressions for
ON CONFLICTtargets SeaQL#692
- Add
from_clearto allow emptying current from tables in select statement SeaQL#716
- Caution: do not use the
--all-featuresparam in Cargo. If you want to enable all features, use theall-featuresfeature flag instead.
- Impl
QueryStatementWriteras inherent methods forWithQuery
- Fixed
BIGINT PRIMARY KEY AUTOINCREMENTfor SQLite SeaQL#689
- Upgrade
chronoto0.4.27
- Removed
ToTokensforPgIntervalSeaQL#710
- Upgrade
synto2
- Fixed incorrect behavior when adding an autoincrement column for Postgres SeaQL#697
- Make
ValueTuplehashable
- Added
Func::roundandFunc::round_with_precisionSeaQL#671
- Added some getters to
FunctionCallSeaQL#677
- Fixed bytea literal syntax for Postgres SeaQL#666
- Fixed issues with semantics of parenthesis removal SeaQL#675
- Fixed behaviour in
FunctionCallwhen callingargmultiple times SeaQL#687
- As part of SeaQL#687, calling
FunctionCall::argmultiple times will append the arguments instead of replacing old values
This is a small (but major) upgrade, the only changes are:
- Upgrade SQLx to
0.7SeaQL#652 - Upgrade ipnetwork to
0.20
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.
sea-query/0.29.0-rc.1: 2023-03-22sea-query/0.29.0(Yanked)sea-query/0.29.1: 2023-07-12sea-query-binder/0.4.0sea-query-postgres/0.3.0sea-query-rusqlite/0.3.0
- Added
ValueTuple::Manyfor tuple with length up to 12 SeaQL#564 - Added
CREATE TABLE CHECKconstraints SeaQL#567 - Added support generated column spec SeaQL#581
- Added
BIT_AND,BIT_ORfunctions SeaQL#582 - Added implementation
SqlxBinder,RusqliteBinderandPostgresBinderforWithQuerySeaQL#580 - Added new type
AsteriksSeaQL#596 - Added
IF NOT EXISTSforDROP INDEXin Postgres and Sqlite SeaQL#610 - Added
->and->>operators for Postgres SeaQL#617 - Added
TableCreateStatement::set_extraandTableCreateStatement::get_extraSeaQL#611 - Added
TableCreateStatement::commentandColumnDef::commentfor MySQL comments SeaQL#622 - Added
PgExpr::get_json_fieldandPgExpr::cast_json_fieldmethods for constructing Postgres JSON expressions SeaQL#630 - Added
PgBinOper::RegexandPgBinOper::RegexCaseInsensitivefor Postgres Regex operators - Added
BinOper::Customfor defining custom binary operators - Added
GLOBoperator for Sqlite SeaQL#651 - Added
CREATE or DROP EXTENSIONstatements for Postgres SeaQL#616 - Added a feature flag
hashable-value, which willimpl Hash for Value; when enabled,Value::Float(NaN) == Value::Float(NaN)would be true SeaQL#598 - Added
PgBinOper::Overlapfor Postgres operators SeaQL#653
- Implemented
PartialEqforDynIden,SimpleExprand related types SeaQL#620
- Removed variants
Four, Five, Sixfromenum ValueTupleas part of SeaQL#564 - Removed
Expr::tbl,Expr::greater_than,Expr::greater_or_equal,Expr::less_than,Expr::less_or_equal,Expr::into_simple_exprSeaQL#551 - Removed
SimpleExpr::equalsandSimpleExpr::not_equalsSeaQL#551 - Removed
InsertStatement::exprs,InsertStatement::exprs_panicSeaQL#551 - Removed
OnConflict::update_value,OnConflict::update_values,OnConflict::update_expr,OnConflict::update_exprsSeaQL#551 - Removed
UpdateStatement::exprs,UpdateStatement::col_expr,UpdateStatement::value_exprSeaQL#551 BigIntegernow maps tobigintinstead ofintegeron SQLite SeaQL#556Table::truncatenow panic for Sqlite SeaQL#590- Deprecated
Expr::asteriksandExpr::table_asteriksSeaQL#596 Expr::cust,Expr::cust_with_values,Expr::cust_with_expr,Expr::cust_with_exprs,TableForeignKey::name,ForeignKeyCreateStatement::name,ForeignKeyDropStatement::name,TableIndex::name,IndexCreateStatement::name,IndexDropStatement::name,SqlWriterValues::new,ColumnType::custom,TableCreateStatement::engine,TableCreateStatement::collate,TableCreateStatement::character_set,TableRef::new,LikeExpr::strnow acceptT: Into<String>SeaQL#594OnConflict::valuesandOnConflict::update_columnswill append the new values keeping the old values intact instead of erasing them SeaQL#609- As part of SeaQL#620,
SeaRcnow becomes a wrapper type. If you usedSeaRcfor something other thandyn Iden, you now have to useRcOrArc. However be reminded that it is not an intended use of the API anyway.
// 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
Quoteand changed theIdentrait:
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;
}- Elided unnecessary lifetimes SeaQL#552
- Changed all
version = "^x.y.z"intoversion = "x.y.z"in all Cargo.toml SeaQL#547 - Disabled default features and enable only the needed ones SeaQL#547
tests_cfgmodule is available only if you enabledtests-cfgfeature SeaQL#584- Removed hard coded quotes SeaQL#613
- Enabled required
synv1 features SeaQL#624 - Fix macro hygiene (
any!/all!) SeaQL#639 SeaQL#640
ALTER TABLEnow panic if has multiple column for Sqlite SeaQL#595- Fixed alter primary key column statements for Postgres SeaQL#646
- Added implementation
SqlxBinder,RusqliteBinderandPostgresBinderforWithQuerySeaQL#580sea-query-binder0.3.1sea-query-postgres0.2.1sea-query-rusqlite0.2.1
- Fix quoted string bug while inserting array of strings to Postgres SeaQL#576
- Added comma if multiple names are passed to
TypeDropStatementSeaQL#623
- Added getter for the
UpdateStatement::valuesfield SeaQL#578 - Implements
PartialEqforColumnTypeSeaQL#579 - Added helper function to construct
ColumnType::CustomSeaQL#579
- Added
Cow<str>conversion toValueSeaQL#550 - Added convert various
UUIDdefined inuuid::fmtmodule intosea_query::Value::UuidSeaQL#563
- Fixes Postgres
GEN_RANDOM_UUIDSeaQL#568
- New struct
FunctionCallwhich hold function and arguments SeaQL#475 - New trait
IdenStaticwith methodfn as_str(&self) -> &'static strSeaQL#508 - New traits
PgExprandSqliteExprfor custom expressions SeaQL#519 - Support
BigDecimal,IpNetworkandMacAddressforsea-query-postgresSeaQL#503
- Added
SelectStatement::from_functionSeaQL#475 - Added binary operators from the Postgres
pg_trgmextension SeaQL#486 - Added
ILIKEandNOT ILIKEoperators SeaQL#473 - Added the
mulanddivmethods forSimpleExprSeaQL#510 - Added the
MATCH,->and->>operators for SQLite SeaQL#513 - Added the
FULL OUTER JOINSeaQL#497 - Added
PgFunc::get_random_uuidSeaQL#530 - Added
SimpleExpr::eq,SimpleExpr::ne,Expr::not_equalsSeaQL#528 - Added
PgFunc::starts_withSeaQL#529 - Added
Expr::custom_keywordandSimpleExpr::notSeaQL#535 - Added
SimpleExpr::like,SimpleExpr::not_likeandExpr::cast_asSeaQL#539 - Added support for
NULLS NOT DISTINCTclause for Postgres SeaQL#532 - Added
Expr::cust_with_exprandExpr::cust_with_exprsSeaQL#531 - Added support for converting
&Stringto Value SeaQL#537
- Made
value::with_arraymodule public and therefore makingNotU8trait public SeaQL#511 - Drop the
Sizedrequirement on implementers ofSchemaBuildersSeaQL#524
// 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)"#
);- MSRV is up to 1.62 SeaQL#535
ColumnType::Arraydefinition changed fromArray(SeaRc<Box<ColumnType>>)toArray(SeaRc<ColumnType>)SeaQL#492Func::*now returnsFunctionCallinstead ofSimpleExprSeaQL#475Func::coalescenow acceptsIntoIterator<Item = SimpleExpr>instead ofIntoIterator<Item = Into<SimpleExpr>SeaQL#475- Removed
Expr::argandExpr::args- these functions are no longer needed SeaQL#475 - Moved all Postgres specific operators to
PgBinOperSeaQL#507 Expr::value,Expr::gt,Expr::gte,Expr::lt,Expr::lte,Expr::add,Expr::div,Expr::sub,Expr::modulo,Expr::left_shift,Expr::right_shift,Expr::between,Expr::not_between,Expr::is,Expr::is_not,Expr::if_nullnow acceptsInto<SimpleExpr>instead ofInto<Value>SeaQL#476Expr::is_in,Expr::is_not_innow acceptsInto<SimpleExpr>instead ofInto<Value>and convert it toSimpleExpr::Tupleinstead ofSimpleExpr::ValuesSeaQL#476Expr::exprnow acceptsInto<SimpleExpr>instead ofSimpleExprSeaQL#475- Moved
Expr::ilike,Expr::not_ilike,Expr::matches,Expr::contains,Expr::contained,Expr::concatenate,Expr::concat,SimpleExpr::concatenateandSimpleExpr::concatto new traitPgExprSeaQL#519 Expr::equalsnow acceptsC: IntoColumnRefinstead ofT: IntoIden, C: IntoIdenSeaQL#528- Removed integer and date time column types' display length / precision option SeaQL#525
- Deprecated
Expr::greater_than,Expr::greater_or_equal,Expr::less_thanandExpr::less_or_equalSeaQL#476 - Deprecated
SimpleExpr::equals,SimpleExpr::not_equalsSeaQL#528 - Deprecated
Expr::tbl, please useExpr::colwith a tuple SeaQL#540
- Replace
impl Defaultwith#[derive(Default)]SeaQL#535 - Exclude
sqlxdefault features SeaQL#543 - Use
dtolnay/rust-toolchaininstead ofactions-rs/toolchaininCISeaQL#544
- Made
value::with_arraymodule public and therefore makingNotU8trait public SeaQL#511
- Enable SQLx features only if SQLx optional dependency is enabled SeaQL#517
- Fix consecutive spacing on schema statements SeaQL#481
- SQLite bind
rust_decimal&bigdecimalas f64 SeaQL#480
- Support
CROSS JOINSeaQL#376 - We are going through series of changes to how database drivers work
(SeaQL#416, SeaQL#423):
sea-query-binderis now the recommended way (trait based) of working with SQLx, replacingsea-query-driver(macro based) SeaQL#434sea-query-binderis now a separate dependency, instead of integrated withsea-querySeaQL#432rusqlitesupport is moved tosea-query-rusqliteSeaQL#422postgressupport is moved tosea-query-postgresSeaQL#433
- Added sub-query operators:
EXISTS,ALL,ANY,SOMESeaQL#379 - Added support to
ON CONFLICT WHERESeaQL#447 - Added support
DROP COLUMNfor SQLite SeaQL#455 - Added
YEAR,BITandVARBITtypes SeaQL#466 - Added support one dimension Postgres array for SQLx SeaQL#467
- Handle Postgres schema name for schema statements SeaQL#385
- Added
%,<<and>>binary operators SeaQL#419 - Added
RANDfunction SeaQL#430 - Implements
DisplayforValueSeaQL#425 - Added
INTERSECTandEXCEPTtoUnionTypeSeaQL#438 - Added
OnConflict::valueandOnConflict::valuesSeaQL#451 ColumnDef::defaultnow accepts bothValueandSimpleExprSeaQL#436OrderedStatement::order_by_customs,OrderedStatement::order_by_columns,OverStatement::partition_by_customs,OverStatement::partition_by_columnsnow acceptsIntoIterator<Item = T>instead ofVec<T>SeaQL#448Expr::case,CaseStatement::caseandCaseStatement::finallynow acceptsInto<SimpleExpr>instead ofInto<Expr>SeaQL#460UpdateStatement::valuenow acceptInto<SimpleExpr>instead ofInto<Value>SeaQL#460TableAlterStatement::rename_column,TableAlterStatement::drop_column,ColumnDef::new,ColumnDef::new_with_typenow acceptsIntoIdeninstead ofIdenSeaQL#472
distinct_onproperly handlesColumnRefSeaQL#450- Removed
ONforDROP INDEXfor SQLite SeaQL#462 - Change datetime string format to include microseconds SeaQL#468
ALTER TABLEfor PosgreSQL withUNIQUEconstraint SeaQL#472
- Changed
in_tuplesinterface to acceptIntoValueTupleSeaQL#386 - Removed deprecated methods (
or_where,or_having,table_columnetc) SeaQL#380 - Changed
cond_wherechaining semantics SeaQL#417
// 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"#
);CURRENT_TIMESTAMPchanged from being a function to keyword SeaQL#441- Update SQLite
booleantype fromintegertobooleanSeaQL#400 - Changed type of
ColumnType::Enumfrom(String, Vec<String>)to: SeaQL#435
Enum {
name: DynIden,
variants: Vec<DynIden>,
}- Deprecated
InsertStatement::exprs,InsertStatement::exprs_panic,OnConflict::update_value,OnConflict::update_values,OnConflict::update_expr,OnConflict::update_exprs,UpdateStatement::col_expr,UpdateStatement::value_expr,UpdateStatement::exprsSeaQL#460 InsertStatement::values,UpdateStatement::valuesnow acceptsIntoIterator<Item = SimpleExpr>instead ofIntoIterator<Item = Value>SeaQL#460- Use native api from SQLx for SQLite to work with
timeSeaQL#412
- Cleanup
IndexBuildertrait methods SeaQL#426 - Introduce
SqlWritertrait SeaQL#436 - Remove unneeded
vec!from examples SeaQL#448
- Upgrade
sqlxdriver to 0.6.1
- Added support
DROP COLUMNfor SQLite SeaQL#455
- Removed
ONforDROP INDEXfor SQLite SeaQL#462 - Changed datetime display format to include microseconds SeaQL#468
DROP NOT NULLfor PostgresALTER COLUMNSeaQL#394
- Rename
postgres-*features towith-*onpostgresdriver SeaQL#377
- Add support for
VALUESlists SeaQL#351 - Introduce
sea-query-binderSeaQL#275 - Convert from
IpNetworkandMacAddresstoValueSeaQL#364
- Move
escapeandunescapestring to backend SeaQL#306 LIKE ESCAPEsupport SeaQL#352 #353)clear_order_byforOrderedStatement- Add method to make a column nullable SeaQL#365
- Add
is&is_notto Expr SeaQL#348 - Add
CURRENT_TIMESTAMPfunction SeaQL#349 - Add
in_tuplesmethod to Expr SeaQL#345
- Upgrade
uuidto 1.0 - Upgrade
timeto 0.3 - Upgrade
ipnetworkto 0.19 - Upgrade
bigdecimalto 0.3 - Upgrade
sqlxdriver to 0.6
- As part of #306, the standalone functions
escape_stringandunescape_stringare 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::Ipv4NetworkandValue::Ipv6NetworktoValue::IpNetworkSeaQL#364 -
Remove some redundant feature flags
postgres-chrono,postgres-json,postgres-uuid,postgres-time. Use thewith-*equivalence
Full Changelog: https://github.com/SeaQL/sea-query/compare/0.25.0...0.26.0
- Introduce
sea-query-binderSeaQL#275
- Add method to make a column nullable SeaQL#365
- Add
is&is_notto Expr SeaQL#348 - Add
CURRENT_TIMESTAMPfunction SeaQL#349
clear_order_byforOrderedStatement
- CASE WHEN statement support SeaQL#304
- Add support for Ip(4,6)Network and MacAddress SeaQL#309
- [sea-query-attr] macro for deriving
Idenenum from struct SeaQL#300 - Add ability to alter foreign keys SeaQL#299
- Select
DISTINCT ONSeaQL#313
- Insert Default SeaQL#266
- Make
sea-query-driveran optional dependency SeaQL#324 - Add
ABSfunction SeaQL#334 - Support
IF NOT EXISTSwhen create index SeaQL#332 - Support different
blobtypes in MySQL SeaQL#314 - Add
VarBinarycolumn type SeaQL#331 - Returning expression supporting
SimpleExprSeaQL#335
- Fix arguments when nesting custom expressions SeaQL#333
- Fix clippy warnings for manual map SeaQL#337
- Introducing a dedicated
ReturningClauseinstead of reusingSelectonreturning: SeaQL#317
.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'sBinary(Option<u32>)changed toBinary(BlobSize), so if you usedBinary(None)before, you should change toBinary(BlobSize::Blob(None))
Full Changelog: https://github.com/SeaQL/sea-query/compare/0.24.0...0.25.0
- Make
sea-query-driveran optional dependency SeaQL#324
- Insert
or_default_valuesSeaQL#266
- update sea-query-driver
- Fix MySQL index create statement SeaQL#308
- Add length check on condition array SeaQL#307
- Fixed SeaQL#303 driver breakage in 0.24.0
Notes: 0.24.0 & 0.24.1 were yanked
- #295 Add parameter for SQLx path to proc-macro SeaQL#297
- CTE optional columns SeaQL#301
- Add
LOWERandUPPERfunc SeaQL#276 - Insert
ON CONFLICTsupport SeaQL#279 - #174 Add support for
WINDOWSstatement SeaQL#271 - #142 full support lock in select SeaQL#289
- #269 add support for postgres
ANY,SOME,ALLSeaQL#283
- Add support for multiple
ALTERoperations SeaQL#277 - #229 add column if not exists SeaQL#278
- #255 Add support to CommonTableExpression columns method SeaQL#284
- #280 Rewrite drivers using proc-macro SeaQL#292
- #285 Fix timestamp_with_time_zone_len SeaQL#286
- The enum variants for
LockTypewere renamed:Exclusive->UpdateandShared->Share - As part of #283, the drivers are split to the
sea-query-drivercrate- Remove methods
Value::is_jsonandValue::as_ref_jsonwhen feature: with-json is disabled - Remove methods
Value::is_time_*andValue::as_ref_time_*when feature: with-time is disabled - Remove methods
Value::is_chrono_*andValue::as_ref_chrono*when feature: with-chrono is disabled - Remove methods
Value::is_decimal,Value::as_ref_decimalandValue::decimal_to_f64when feature: with-rust_decimal is disabled - Remove methods
Value::is_big_decimal,Value::as_ref_big_decimalandValue::big_decimal_to_f64when feature: with-bigdecimal is disabled - Remove methods
Value::is_uuidandValue::as_ref_uuidwhen feature: with-uuid is disabled - Remove methods
Value::is_arrayandValue::as_ref_arraywhen feature: postgres-array is disabled
- Remove methods
Full Changelog: https://github.com/SeaQL/sea-query/compare/0.23.0...0.24.0
- Supports
timein addition tochronoSeaQL#267
- Allow for trailing commas in any and all macros SeaQL#270
- Fix UNIQUE table index expression syntax for sqlite SeaQL#227
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.
- Support multiple tables in the select from by @Sytten in SeaQL#261
- Add support for replace insert by @Sytten in SeaQL#262
- Add
ColumnTypeunsigned integer types by @billy1624 in SeaQL#211
Full Changelog: https://github.com/SeaQL/sea-query/compare/0.21.0...0.22.0
- Use double quotes for quoting identifiers for SQLite by @SpyrosRoum in SeaQL#221
- Implement
RETURNINGfor SQLite by @SpyrosRoum in SeaQL#194 - Support 'NULLS LAST' and 'NULLS FIRST' by @qyihua in SeaQL#210
- [join-lateral] by @rex-remind101 in SeaQL#224
- Insert from select by @05storm26 in SeaQL#238
- Add Expr::asterisk() and Expr::tbl_asterisk(table: DynIden) methods - Fix #217 by @RomainMazB in SeaQL#219
- Implement ToTokens for IntervalField by @autarch in SeaQL#195
- Implemented 'Array' type for Postgres. by @kev0960 in SeaQL#205
- Add
Value::DateTimeLocalby @billy1624 in SeaQL#249 - Add
ColumnRef::SchemaTableColumnby @billy1624 in SeaQL#206 - Datetime utc by @tyt2y3 in SeaQL#241
- Support the use of chrono::DateTime using the type alias DateTim… by @charleschege in SeaQL#222
- Fix Postgres
ColumnType::TinyIntegermapping by @billy1624 in SeaQL#207 - PR without clippy warmings in file changed tab by @billy1624 in SeaQL#212
Full Changelog: https://github.com/SeaQL/sea-query/compare/0.20.0...0.21.0
- Add
TableRef::DatabaseSchemaTableby @billy1624 in SeaQL#193
Full Changelog: https://github.com/SeaQL/sea-query/compare/0.19.4...0.20.0
- Binding
DateTime<FixedOffset>for SQLx MySQL & SQLite by @billy1624 in SeaQL#197
Full Changelog: https://github.com/SeaQL/sea-query/compare/0.19.2...0.19.4
Full Changelog: https://github.com/SeaQL/sea-query/compare/0.19.1...0.19.2
driver/postgreshandle non-exhaustiveValueby @billy1624 in SeaQL#191
Full Changelog: https://github.com/SeaQL/sea-query/compare/0.19.0...0.19.1
TableCreateStatementandTableDropStatementtakes anyIntoTableReftable name. by @josh-codes in SeaQL#186- Add
ColumnType::Enumby @billy1624 in SeaQL#188 - Update to Rust Edition 2021 by @billy1624 in SeaQL#189
Full Changelog: https://github.com/SeaQL/sea-query/compare/0.18.2...0.19.0
- Rename "where" keywords in
SelectStatementto suppress IDEA warnings by @baoyachi in SeaQL#166 - Add binary method to expr by @Progdrasil in SeaQL#173
- Cast expression as custom type by @billy1624 in SeaQL#170
- Support tuple expression by @shuoli84 in SeaQL#178
Full Changelog: https://github.com/SeaQL/sea-query/compare/0.18.1...0.18.2
- [#169] Add support for Postgres interval type
- [#171] Fix bug in
Condition::addwhere Condition negation is ignored
- [#171] Fix bug in
Condition::addwhere Condition negation is ignored
- [#164] Revert "Fix SQLite
chrono::NaiveTimebinding"
- [#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>;- [#171] Fix bug in
Condition::addwhere Condition negation is ignored
- Fix table drop options for SQLite
- Add
IndexCreateStatement::is_unique_key()
- [#131]
CAST ASexpression - [#131]
InsertStatementacceptsSimpleExpr - [#137] SQLx Postgres driver bind
DateTime<FixedOffset>
- [#129] MySql
ColumnType::Binary(None)maps to "blob"
-
[#112] Introduce
Nullabletrait to permit customOption<T> -
[#113]
ValueTypetrait should have a non-panic-ing method -
[#114]
ValueTyperevamp- Remove
ValueTypeDefault - Change
type_nameto returnString
- Remove
-
[#115] Postgres concatenate operator (
||) -
[#117] Lock support (
FOR SHARE,FOR UPDATE) for SELECT statement
- [#107] Revamp
Valueto typed null value - Added
BigDecimalsupport
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))]))
);- [#87] Fix inconsistent Ownership of self in Builder APIs
- [#105] Use Arc for SeaRc with feature flag thread-safe
- [#98] Support Postgres full text search
- Support SeaORM
- [#89] flattening iden enums in derive macro
- [#77] Postgres
binarytype - [#81] example for CockroachDB
- [#84] Fix Postgres constraint keywords
- [#75]
DateTimeWithTimeZonevalue type andTimestampWithTimeZonecolumn type
- Fix Postgres
datetimecolumn type mapping Uuidin schema builder
cust_with_valuesallow escape?using??
- Fixed build error for
sqlx-sqlite
- Support
Decimalfrom rust_decimal
- Added
returningfor update statement
- Added
type_namefor ValueType ValuesderiveClone- Added
Update::col_expr - Type def Rc as
SeaRc - getters for schema statements
- Fixed
and_where_option - Added
Condition::add_option
- Added
not_in_subquery
- Unify
cond_whereandand_where. Note: will panic if callingor_whereafterand_where.
- Updated Readme
- Added APIs to support ORM
- Backend and internal refactoring
- Introduced
QueryStatementBuilderandSchemaStatementBuildertraits - Introduced
ConditionalStatementandOrderedStatementtraits - Introduced any/all style conditions for
cond_whereandcond_having
- Postgres
ALTER TYPEstatements forENUM
- Updated documentation
returning()expression for Postgres insert statements- Remove redundant index name in foreign key expression of MySQL
- custom
Errortype - Empty value list for IN
- Index prefix and
IndexOrder
- Foreign key API
fromandto - Fix foreign key bug in
ON UPDATE
- Added
index_type()(FullTextandHash) - Added
unique()toIndex - Support composite primary key
- Use
IntoIteratortrait instead ofVecon most APIs - UUID support in
Value - Rusqlite support
- Rename
create_if_not_existstoif_not_exists - Remove
partition_optionfromTableAlterStatement - Added
ColumnDef::extra()
- Added
SchemaStatement
- Fixed
DateTimequoting bugs
- Update sea-query-derive to 0.1.2
- derive supporting enum tuple variant and custom method
- updated docs
- Introduced
IntoColumnReftrait to consolidatecolumnandtable.column - Introduced
IntoTableReftrait to consolidatetableandschema.table - Introduced
IntoIdentrait to remove*_dynmethods
- added
into_simple_expr()
- Fixing
IS NULL
- derive
Debugon most structs
- Added
unescape_string
- Improve documentation
jsonsupport behind features- backend as features (
backend-mysql,backend-postgres,backend-sqlite) - added
from_schema(),from_schema_as()
- Revamp
Value build()API changepostgresdriver supportjsonandchronosupport
- Added
join_as - Deprecated
expr_alias,from_alias
- Custom expression with parameters
Expr::cust_with_values() - Custom function call
Func::cust() - Postgres enum
Type::create().as_enum()
- derive macro
#[derive(Iden)]
- Added JSON binary column type
ColumnDef::json_binary() - Custom column type
ColumnDef::custom()
Publish to crate.io