100 lines
2.5 KiB
Markdown
100 lines
2.5 KiB
Markdown
## Release Notes: sea-query 1.0.0-rc.32
|
|
|
|
*(since 1.0.0-rc.31)*
|
|
|
|
### New Features
|
|
|
|
* Support `EXPLAIN` statements https://github.com/SeaQL/sea-query/pull/1044
|
|
|
|
```rust
|
|
// Postgres
|
|
assert_eq!(
|
|
ExplainStatement::new()
|
|
.analyze()
|
|
.format(ExplainFormat::Json)
|
|
.statement(
|
|
Query::select()
|
|
.column(Char::Character)
|
|
.from(Char::Table)
|
|
.to_owned(),
|
|
)
|
|
.to_string(PostgresQueryBuilder),
|
|
r#"EXPLAIN (ANALYZE, FORMAT JSON) SELECT "character" FROM "character""#
|
|
);
|
|
|
|
// MySQL
|
|
assert_eq!(
|
|
ExplainStatement::new()
|
|
.format(ExplainFormat::Json)
|
|
.statement(
|
|
Query::select()
|
|
.column(Char::Character)
|
|
.from(Char::Table)
|
|
.to_owned(),
|
|
)
|
|
.to_string(MysqlQueryBuilder),
|
|
"EXPLAIN FORMAT = JSON SELECT `character` FROM `character`"
|
|
);
|
|
|
|
// SQLite
|
|
assert_eq!(
|
|
ExplainStatement::new()
|
|
.query_plan()
|
|
.statement(
|
|
Query::select()
|
|
.column(Char::Character)
|
|
.from(Char::Table)
|
|
.to_owned(),
|
|
)
|
|
.to_string(SqliteQueryBuilder),
|
|
r#"EXPLAIN QUERY PLAN SELECT "character" FROM "character""#
|
|
);
|
|
```
|
|
|
|
* Support for `FILTER` clause on aggregate functions https://github.com/SeaQL/sea-query/pull/1043
|
|
|
|
```rust
|
|
let query = Query::select()
|
|
.expr_as(
|
|
Func::count(Expr::val(1))
|
|
.filter(
|
|
Cond::all()
|
|
.add(Expr::col(Char::Character).eq("foo"))
|
|
.add(Expr::col(Char::SizeW).eq(1))
|
|
),
|
|
Alias::new("filtered_total")
|
|
)
|
|
.expr_as(Func::count(Expr::val(1)), Alias::new("total"))
|
|
.from(Char::Table)
|
|
.to_owned();
|
|
|
|
assert_eq!(
|
|
query.to_string(PostgresQueryBuilder),
|
|
r#"SELECT COUNT(1) FILTER (WHERE "character" = 'foo' AND "size_w" = 1) AS "filtered_total", COUNT(1) AS "total" FROM "character""#
|
|
);
|
|
```
|
|
|
|
* Add `ALTER TABLE DROP CONSTRAINT`
|
|
|
|
```rust
|
|
let table = Table::alter()
|
|
.table(Font::Table)
|
|
.drop_constraint("font_name_key")
|
|
.to_owned();
|
|
|
|
assert_eq!(
|
|
table.to_string(MysqlQueryBuilder),
|
|
r#"ALTER TABLE `font` DROP CONSTRAINT `font_name_key`"#
|
|
);
|
|
assert_eq!(
|
|
table.to_string(PostgresQueryBuilder),
|
|
r#"ALTER TABLE "font" DROP CONSTRAINT "font_name_key""#
|
|
);
|
|
```
|
|
|
|
### House Keeping
|
|
|
|
* Bump Rust version to 1.88
|
|
* Bump `rusqlite` to 0.38.0 https://github.com/SeaQL/sea-query/pull/1059
|
|
* Update `time` to 0.3.47 https://github.com/SeaQL/sea-query/pull/1057
|