cargo sea-query 1.0.0-rc.34

latest releases: 1.0.1, 1.0.0
24 days ago

Highlights

  • Added CREATE TABLE partitioning 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_where behavior so partial index filters are no longer silently dropped.
  • Refactored the PostgreSQL JSON_TABLE builder API.

Breaking Changes

  • Changed PostgreSQL type mapping for unsigned integer columns to use wider signed integer types #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_where filters instead of silently dropping them #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::Zoned support from the with-jiff value API #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 #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_table builder APIs #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 TABLE #1039

PostgreSQL support includes:

  • PARTITION BY RANGE
  • PARTITION BY LIST
  • PARTITION BY HASH
  • PARTITION OF
  • FOR VALUES IN
  • FOR VALUES FROM ... TO
  • FOR VALUES WITH

MySQL support includes:

  • PARTITION BY RANGE
  • PARTITION BY LIST
  • PARTITION BY HASH
  • PARTITION BY KEY
  • Partition definitions with VALUES IN and VALUES 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::Zoned #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 CONFLICT index expressions in parentheses where required by PostgreSQL syntax #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 #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_TABLE tests for the refactored API.
  • Added documentation and regression tests for MySQL cond_where behavior on indexes.

Migration Notes

  • Review newly generated PostgreSQL migrations for SmallUnsigned and Unsigned column type changes.
  • Replace old PgFunc::json_table chained sub-builder calls with json_table::Column, json_table::ExistsColumn, and json_table::NestedPath.
  • Replace any jiff::Zoned Value usage with supported Jiff types or application-level text storage.
  • Treat MySQL partial indexes as unsupported. SeaQuery now emits invalid MySQL SQL intentionally when cond_where is used, so applications should branch by backend when they need a partial index on PostgreSQL or SQLite only.

Don't miss a new sea-query release

NewReleases is sending notifications on new releases.