5.8 KiB
Release Notes: sea-query 1.0.0-rc.34
(since 1.0.0-rc.33)
Highlights
- Added
CREATE TABLEpartitioning support for PostgreSQL and MySQL. - Added SQLx and rusqlite binder support for Jiff values.
- Fixed PostgreSQL unsigned integer column mappings to avoid overflow-prone type choices.
- Fixed MySQL
IndexCreateStatement::cond_wherebehavior so partial index filters are no longer silently dropped. - Refactored the PostgreSQL
JSON_TABLEbuilder API.
Breaking Changes
- Changed PostgreSQL type mapping for unsigned integer columns to use wider signed integer types https://github.com/SeaQL/sea-query/pull/1028
PostgreSQL does not have unsigned integer types. SeaQuery now maps unsigned column types to signed types that can represent a wider range:
| ColumnType | 0.32.x PostgreSQL type | 1.0.0-rc.34 PostgreSQL type |
|---|---|---|
TinyUnsigned |
smallint |
smallint |
SmallUnsigned |
smallint |
integer |
Unsigned |
integer |
bigint |
BigUnsigned |
bigint |
bigint |
This affects generated PostgreSQL schema SQL. Existing migrations remain unchanged, but newly generated migrations may produce different column types for SmallUnsigned and Unsigned.
- MySQL index creation now emits
cond_wherefilters instead of silently dropping them https://github.com/SeaQL/sea-query/pull/1067
MySQL does not support partial indexes. SeaQuery now keeps the WHERE clause when IndexCreateStatement::cond_where is used with MysqlQueryBuilder, causing the database to reject the statement instead of silently creating an index with different semantics.
- Removed
jiff::Zonedsupport from thewith-jiffvalue API https://github.com/SeaQL/sea-query/pull/1061
The Jiff value mapping now excludes jiff::Zoned, because the SQLx Jiff binder does not support lossless Zoned values. Code using Value::jiff_zoned, Value::JiffZoned, ArrayType::JiffZoned, is_jiff_zoned, or as_ref_jiff_zoned should migrate to a supported Jiff type or store zoned datetimes as an application-defined text value.
- Changed Jiff datetime type mappings https://github.com/SeaQL/sea-query/pull/1061
Jiff datetime mappings now align with SQLx binder support:
| Rust type | Previous SeaQuery column type | 1.0.0-rc.34 column type |
|---|---|---|
jiff::civil::DateTime |
DateTime |
Timestamp |
jiff::Timestamp |
Timestamp |
TimestampWithTimeZone |
- Refactored
PgFunc::json_tablebuilder APIs https://github.com/SeaQL/sea-query/pull/1029
The PostgreSQL JSON_TABLE API now uses value objects for columns and nested paths instead of chained sub-builders:
| Previous API | New API |
|---|---|
json_path_name(...) |
path_name(...) |
ordinality_column(...) |
for_ordinality(...) |
column(name, ty).path(...).build_column() |
column(json_table::Column::new(name, ty).path(...)) |
exists_column(name, ty).path(...).build_column() |
exists(json_table::ExistsColumn::new(name, ty).path(...)) |
nested(path).column(...).build_nested() |
nested(json_table::NestedPath::new(path).column(...)) |
explicit_path was removed. Nested paths now render as NESTED PATH ....
New Features
- Added table partitioning support for
CREATE TABLEhttps://github.com/SeaQL/sea-query/pull/1039
PostgreSQL support includes:
PARTITION BY RANGEPARTITION BY LISTPARTITION BY HASHPARTITION OFFOR VALUES INFOR VALUES FROM ... TOFOR VALUES WITH
MySQL support includes:
PARTITION BY RANGEPARTITION BY LISTPARTITION BY HASHPARTITION BY KEY- Partition definitions with
VALUES INandVALUES LESS THAN
PartitionDefinition is kept crate-private; users create partition definitions through TableCreateStatement::add_partition.
- Added SQLx and rusqlite binder support for Jiff values, except
jiff::Zonedhttps://github.com/SeaQL/sea-query/pull/1061
Supported Jiff values:
| Rust type | SeaQuery value variant |
|---|---|
jiff::civil::Date |
Value::JiffDate |
jiff::civil::Time |
Value::JiffTime |
jiff::civil::DateTime |
Value::JiffDateTime |
jiff::Timestamp |
Value::JiffTimestamp |
sea-query-sqlx intentionally rejects with-jiff together with sqlx-mysql or sqlx-any unless the unimplemented-jiff-sqlx-mysql feature is enabled to acknowledge the limitation.
Fixes
- Wrapped PostgreSQL
ON CONFLICTindex expressions in parentheses where required by PostgreSQL syntax https://github.com/SeaQL/sea-query/pull/1055
For example, SeaQuery now renders:
ON CONFLICT ("name", ("variant" IS NULL)) DO NOTHING
instead of:
ON CONFLICT ("name", "variant" IS NULL) DO NOTHING
This matches PostgreSQL's conflict_target grammar for index expressions.
- Fixed MySQL partial index filters being silently ignored https://github.com/SeaQL/sea-query/pull/1067
IndexCreateStatement::cond_where now renders the filter for both standalone MySQL CREATE INDEX statements and inline indexes inside CREATE TABLE.
Documentation And Tests
- Added documentation for the unsigned integer PostgreSQL type mapping changes.
- Added table partitioning doctests and backend-specific coverage for PostgreSQL and MySQL.
- Added focused PostgreSQL
JSON_TABLEtests for the refactored API. - Added documentation and regression tests for MySQL
cond_wherebehavior on indexes.
Migration Notes
- Review newly generated PostgreSQL migrations for
SmallUnsignedandUnsignedcolumn type changes. - Replace old
PgFunc::json_tablechained sub-builder calls withjson_table::Column,json_table::ExistsColumn, andjson_table::NestedPath. - Replace any
jiff::ZonedValueusage with supported Jiff types or application-level text storage. - Treat MySQL partial indexes as unsupported. SeaQuery now emits invalid MySQL SQL intentionally when
cond_whereis used, so applications should branch by backend when they need a partial index on PostgreSQL or SQLite only.