Skip to content

183#190

Merged
RAprogramm merged 1 commit into
mainfrom
183
Jul 4, 2026
Merged

183#190
RAprogramm merged 1 commit into
mainfrom
183

Conversation

@RAprogramm

Copy link
Copy Markdown
Owner

Closes #183.

Real schemas carry constraints the macro cannot infer — foreign keys over natural keys, custom-named CHECK constraints, indexes from hand-written migrations. Found while validating typed_constraints against a real backend, where FK violations still required hand-written constraint-name matching.

constraint(name, kind, field?)

  • Repeatable inside #[entity(...)]; kinds: unique, foreign_key, check; field optional
  • Entries merge into the generated registry and take precedence over auto-derived entries with the same name (single match arm, custom field wins)
  • Validation: requires typed_constraints; missing name/kind and unknown kinds/options rejected with clear errors

Testing

  • 4 registry/parse unit tests (merge, precedence/dedupe, gating, kind validation) — 672 total green
  • Extra gating test pinning that sql::generate emits nothing without the postgres feature (covers the branch that slipped Codecov in 184 #188)
  • trybuild pass case extended with a custom FK declaration
  • clippy -D warnings clean, all-features suite green, deny ok — checklist run before commit

Docs

  • README typed-constraints section extended; wiki (Attributes ×5) updated in this PR via wiki/

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.19355% with 1 line in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ity-derive-impl/src/entity/parse/entity/helpers.rs 98.11% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@RAprogramm RAprogramm merged commit e53ebb4 into main Jul 4, 2026
15 checks passed
@RAprogramm RAprogramm deleted the 183 branch July 4, 2026 08:37
@RAprogramm RAprogramm mentioned this pull request Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(errors): declare custom constraint mappings for the typed_constraints registry

1 participant