Postgres domain types
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 9.9k
- Forks
- 734
- Avg merge
- 6h 36m
- Merged PRs (30d)
- 8
Description
Discussed in https://github.com/SeaQL/sea-orm/discussions/2862
Originally posted by sfried December 19, 2025
In postgres, domains provide a very convenient means of defining a new type, with its own enforcement mechanisms and documentation clarity. A bijection should be created between these two:
- sea-orm-cli's generate entity should create the relevant newtypes, and use those types in the generated models
- sea-orm should recognize newtypes being used in a model, and create the relevant domains (even if the new domain doesn't have the full checking defined in the rust code)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the discussion at https://github.com/SeaQL/sea-orm/discussions/2862, then inspect sea-orm-cli's generate entity flow and how SeaORM handles Rust newtypes in models. Define the required bijection between generated newtypes and PostgreSQL domains, including how domain enforcement maps to Rust definitions. Done means both generation directions are specified and implemented with appropriate coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgres, rust
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100