Not using ` mod.rs` as the entry point of the generated entities
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/2559
Originally posted by nyc4m April 12, 2025
Hey there 👋
When generating entities, I noticed that the output code is using the "old" convention for modules, which is to output the source files as the following:
sea-orm-cli generate entity --database-url <DB_URL> --output-dir ./src/entities
# Resulting module structure
./src/entities
/entities
mod.rs
foo.rs
bar.rs
prelude.rs
I'd rather use the "new" convention as described here. This would result in the following file structure:
sea-orm-cli generate entity --database-url <DB_URL> --output-dir ./src/entities
# Resulting module structure
./src/entities/
entities.rs
entities/
foo.rs
bar.rs
prelude.rs
Is there anyway I can achieve this with the current CLI ?
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 command and trace how --output-dir determines the generated module structure. Compare the current mod.rs layout with Rust's newer module-source convention; done means generation produces the requested entities.rs entry point and nested entity files, with relevant coverage added if the command has tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100