Skip to content

Commit 2ad8d60

Browse files
committed
Changelog
1 parent 5d82f2e commit 2ad8d60

File tree

2 files changed

+46
-15
lines changed

2 files changed

+46
-15
lines changed

CHANGELOG.md

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99

1010
### New features
1111

12+
* `#![forbid(unsafe_code)]` in all workspace crates https://github.com/SeaQL/sea-query/pull/930
1213
* Unify `Expr` and `SimpleExpr` as one type. `SimpleExpr` is kept as an alias of `Expr`, but they can now be used interchangably. There may be a few compile
1314
errors and some clippy warnings, basically just remove the redundant `.into()` https://github.com/SeaQL/sea-query/pull/889
1415
```rust
@@ -23,23 +24,41 @@ pub struct DynIden(pub(crate) Cow<'static, str>); // new
2324
pub struct SeaRc<I>(pub(crate) RcOrArc<I>); // old
2425
pub struct SeaRc; // new
2526
```
26-
* `impl From<Expr> for Condition`. Now you can use that instead of
27-
`ConditionExpression`, which has been removed.
28-
* Addded `DatabaseName`, `SchemaName`, `TableName`, `ColumnName` types.
27+
* Reworked `TableRef` and `ColumnRef` variants. `SchemaTable` is now a type alias of `TableName` https://github.com/SeaQL/sea-query/pull/927
28+
```rust
29+
// the following variants are collapsed into one:
30+
enum TableRef {
31+
Table(DynIden),
32+
SchemaTable(DynIden, DynIden),
33+
DatabaseSchemaTable(DynIden, DynIden, DynIden),
34+
TableAlias(DynIden, DynIden),
35+
SchemaTableAlias(DynIden, DynIden, DynIden),
36+
DatabaseSchemaTableAlias(DynIden, DynIden, DynIden, DynIden),
37+
..
38+
}
39+
// now it's just:
40+
enum TableRef {
41+
Table(TableName, Option<DynIden>), // optional Alias
42+
..
43+
}
44+
// because it's restructured to:
45+
pub struct DatabaseName(pub DynIden);
46+
pub struct SchemaName(pub Option<DatabaseName>, pub DynIden);
47+
pub struct TableName(pub Option<SchemaName>, pub DynIden);
48+
// so TableName can represent [database.][schema.]table
49+
```
2950

3051
### Enhancements
3152

32-
* `#![forbid(unsafe_code)]` in all workspace crates https://github.com/SeaQL/sea-query/pull/930
3353
* Removed unnecessary `'static` bounds from type signatures https://github.com/SeaQL/sea-query/pull/921
3454
* Most `Value` variants are now unboxed (except `BigDecimal` and `Array`). Previously the size is 24 bytes. https://github.com/SeaQL/sea-query/pull/925
3555
```rust
3656
assert_eq!(std::mem::size_of::<Value>(), 32);
3757
```
58+
* `impl From<Expr> for Condition`. Now you can use `Expr` instead of `ConditionExpression`, which has been removed from the public API https://github.com/SeaQL/sea-query/pull/915
3859

3960
### Breaking Changes
4061

41-
* Replace `ColumnSpec::Check(Expr)` with `ColumnSpec::Check(Check)` to support named check constraints
42-
4362
* Removed inherent `SimpleExpr` methods that duplicate `ExprTrait`. If you encounter the following error, please add `use sea_query::ExprTrait` in scope https://github.com/SeaQL/sea-query/pull/890
4463
```rust
4564
error[E0599]: no method named `like` found for enum `sea_query::Expr` in the current scope
@@ -98,7 +117,7 @@ error[E0308]: mismatched types
98117
For more information about this error, try `rustc --explain E0308`.
99118
error: could not compile `seaography` (lib) due to 1 previous error
100119
```
101-
* The method signature of `Iden::unquoted` is changed. If you're implementing `Iden` manually, you can modify it like below.
120+
* The method signature of `Iden::unquoted` is changed. If you're implementing `Iden` manually, you can modify it like below https://github.com/SeaQL/sea-query/pull/909
102121
```rust
103122
error[E0050]: method `unquoted` has 2 parameters but the declaration in trait `types::Iden::unquoted` has 1
104123
--> src/tests_cfg.rs:31:17
@@ -128,17 +147,29 @@ impl Iden for Glyph {
128147
}
129148
}
130149
```
131-
* Reworked `TableRef` and `ColumnRef` variants.
132-
* Turned `SchemaTable` into a type alias of `TableName`. Code that accesses the
133-
fields inside may not compile. Other existing code should still compile.
134-
* Removed `ConditionExpression` from the public API. Instead, just convert
135-
between `Condition` and `Expr` using `From`/`Into`.
136-
* Blanket-implemented `SqliteExpr` and `PgExpr` for `T where T: ExprTrait`.
150+
* Removed `ConditionExpression` from the public API. Instead, just convert between `Condition` and `Expr` using `From`/`Into` https://github.com/SeaQL/sea-query/pull/915
151+
```rust
152+
error[E0603]: enum `ConditionExpression` is private
153+
--> tests/mysql/query.rs:734:20
154+
|
155+
> | use sea_query::ConditionExpression;
156+
| ^^^^^^^^^^^^^^^^^^^ private enum
157+
> | Cond::all().add(ConditionExpression::Expr(Expr::new(
158+
| ^^^^^^^^^^^^^^^^^^^ use of undeclared type `ConditionExpression`
159+
```
160+
```rust
161+
// simply do the following
162+
Cond::all().add(Expr::new(..))
163+
```
137164

138-
Now you can use database-specific operators with all expression types.
165+
### Minor breaking changes
166+
167+
* Blanket-implemented `SqliteExpr` and `PgExpr` for `T where T: ExprTrait` https://github.com/SeaQL/sea-query/pull/914
139168

169+
Now you can use database-specific operators with all expression types.
140170
If you had custom implementations in your own code, some may no longer compile
141171
and may need to be deleted.
172+
* Replaced `ColumnSpec::Check(Expr)` with `ColumnSpec::Check(Check)` to support named check constraints https://github.com/SeaQL/sea-query/pull/920
142173

143174
### Upgrades
144175

src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ pub trait IntoColumnRef {
217217
#[derive(Debug, Clone, PartialEq)]
218218
#[non_exhaustive]
219219
pub enum TableRef {
220-
/// A table identifier. Potentially qualified. Potentially remaned using an alias
220+
/// A table identifier with optional Alias. Potentially qualified.
221221
Table(TableName, Option<DynIden>),
222222
/// Subquery with alias
223223
SubQuery(Box<SelectStatement>, DynIden),

0 commit comments

Comments
 (0)