Skip to content

v0.28.0 — One declaration per model

Latest

Choose a tag to compare

@abdulwahed-sweden abdulwahed-sweden released this 08 Jun 17:04
· 62 commits to main since this release
v0.28.0
1d377f6

All four crates ship 0.28.0 (rustio-admin, rustio-admin-macros, rustio-admin-cli, rio-theme).

rustio-admin = "0.28.0"

Changed

  • #[derive(RustioAdmin)] now generates impl Model too. The derive already walked every field to build AdminModel; it now emits the orm::Model impl (TABLE, COLUMNS, INSERT_COLUMNS, id, from_row, insert_values) from the same walk. Models are declared once — the hand-written ORM glue that had to be kept in sync with the struct by hand is gone. Two struct-level escape hatches cover what the field walk can't infer: #[rustio(table = "…")] when the SQL table name differs from the auto slug (e.g. Addressaddresses), and #[rustio(extra_columns = ["…"])] for generated/virtual columns that aren't struct fields (e.g. a Postgres tsvector).
  • Runtime dependencies are re-exported from rustio_admin. chrono, rust_decimal, uuid, and sqlx (plus the Decimal / DateTime / Utc / NaiveDate / NaiveTime / Uuid type aliases) are now re-exported. The derive's generated code routes through these paths, so a model crate can depend on rustio-admin alone; the scaffold's Cargo.toml drops its direct chrono / uuid / rust_decimal / sqlx dependencies. One resolved copy of each, no version skew.

Internal

  • Two drift-guard tests with no machine check before: one asserts the admin.css @import manifest matches the ADMIN_CSS concat!(include_str!(…)) bundle in routes.rs; one asserts rustio_admin_macros::HUMANISE_ACRONYMS is byte-identical to admin::render::HUMANISE_ACRONYMS.

⚠️ Upgrading from 0.27.x (breaking)

  • Delete any hand-written impl Model blocks for types that derive RustioAdmin — they now collide with the generated impl. If a model needs a non-default table name or virtual columns, use the new #[rustio(table = "…")] / #[rustio(extra_columns = ["…"])] attributes instead.
  • You can drop direct chrono / uuid / rust_decimal / sqlx dependencies from a model crate's Cargo.toml and route through rustio_admin's re-exports.

Full changelog: https://github.com/abdulwahed-sweden/rustio-admin/blob/v0.28.0/CHANGELOG.md