SeaQL / SeaQL/sea-orm

Allow Custom Filename for Generated Active Enums via CLI Argument

Open
#2,728 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
9.9k
Forks
734
Avg merge
6h 36m
Merged PRs (30d)
8

Description

Feature Request: Allow Custom Filename for Generated Active Enums via CLI Argument

Motivation

Currently, the generated file for active enums is always named sea_orm_active_enums.rs.
This makes it harder to integrate with projects that have custom naming conventions or when multiple enum files need to be generated separately.
Allowing the filename to be set dynamically via a CLI argument would give developers more flexibility and better project structure control.

Proposed Solutions

Introduce a new CLI argument (for example --active-enum-file <FILENAME>) to specify the output filename of the active enums.

  • Default behavior (no argument provided): still generate sea_orm_active_enums.rs to maintain backward compatibility.
  • If the argument is set, use the provided name instead of the hardcoded "sea_orm_active_enums.rs" string inside EntityWriter::write_sea_orm_active_enums.

This approach preserves existing workflows while enabling customization for advanced use cases.

Additional Information

  • Example usage:
sea-orm-cli generate entity --active-enum-file enums.rs

This would result in enums.rs being generated instead of sea_orm_active_enums.rs.

  • The implementation would mainly involve replacing the hardcoded string in writer.rs with a configurable parameter passed down from the CLI layer.

  • Backward compatibility is maintained since the argument would be optional.

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 at the CLI layer for generate entity and trace how arguments reach writer.rs, especially EntityWriter::write_sea_orm_active_enums. Add the optional filename while preserving the default, then verify that the example command generates the requested filename and that the no-argument behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, database
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.