Skip to content

Allow Custom Filename for Generated Active Enums via CLI Argument #2728

@AndriBaal

Description

@AndriBaal

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions