Allow unique key to be used instead of primary key
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 9.9k
- Forks
- 734
- Avg merge
- 6h 36m
- Merged PRs (30d)
- 8
Description
Motivation
Currently the primary must be specified for many operations like update to work, otherwise it panics.
In reality this is unnecessarily strict since since any unique column or combination of columns would work.
Proposed Solutions
I have not been in the codebase much yet, but I feel this will require a new implementation similar to PrimaryKey, maybe we could call it SecondaryKeys and a changes in all places that currently check for only the primary key.
Current Workarounds
Use more generic methods like update_many, but then you hit the problem #1669
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 SeaORM's PrimaryKey handling and the update operations that currently require a primary key; compare them with the update_many workaround and issue #1669. Define how a unique column or combination of columns would be represented and identify every operation affected. Done means supported unique keys no longer cause those operations to panic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100