SeaQL / SeaQL/sea-orm

Not using ` mod.rs` as the entry point of the generated entities

Open
#2,690 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area:cli
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.