Generate doesn't handle columns starting with numbers
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 9.9k
- Forks
- 734
- Avg merge
- 6h 36m
- Merged PRs (30d)
- 8
Description
Description
Heya, trying to start a project with seaorm using sea-orm-cli generate entity but unfortunately the db I'm inheriting has columns that start with numbers and it panics on them.
First brought up on Discord and was recommended to make a github issue https://discord.com/channels/873880840487206962/1402911922025795624.
Steps to Reproduce
Run sea-orm-cli generate entity on a database with a table column starting with a number.
Expected Behavior
Handles columns that aren't valid rust idents.
Actual Behavior
> Column `2xl_16`: Option<Decimal>
thread 'main' panicked at /Users/choc/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/quote-1.0.40/src/runtime.rs:444:9:
"2xl_16" is not a valid Ident
Versions
sea-orm-cli 1.1.14
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 with the sea-orm-cli generate entity entry point and reproduce the panic using a database column named 2xl_16. Trace how generated Rust identifiers are handled for invalid column names; done means entity generation completes without panicking and supports columns that are not valid Rust identifiers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100