Skip to content

Commit

Permalink
feat: Support --column-extra-derives
Browse files Browse the repository at this point in the history
  • Loading branch information
karolgorecki committed May 1, 2024
1 parent e664998 commit 6551ebb
Show file tree
Hide file tree
Showing 7 changed files with 325 additions and 3 deletions.
7 changes: 7 additions & 0 deletions sea-orm-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,13 @@ pub enum GenerateSubcommands {
)]
enum_extra_attributes: Vec<String>,

#[arg(
long,
value_delimiter = ',',
help = "Add extra derive macros to generated column enum (comma separated), e.g. `--column-extra-derives 'async_graphql::Enum','CustomDerive'`"
)]
column_extra_derives: Vec<String>,

#[arg(
long,
default_value = "false",
Expand Down
2 changes: 2 additions & 0 deletions sea-orm-cli/src/commands/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub async fn run_generate_command(
model_extra_attributes,
enum_extra_derives,
enum_extra_attributes,
column_extra_derives,
seaography,
} => {
if verbose {
Expand Down Expand Up @@ -187,6 +188,7 @@ pub async fn run_generate_command(
model_extra_attributes,
enum_extra_derives,
enum_extra_attributes,
column_extra_derives,
seaography,
);
let output = EntityTransformer::transform(table_stmts)?.generate(&writer_context);
Expand Down
1 change: 1 addition & 0 deletions sea-orm-codegen/src/entity/transformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ mod tests {
false,
&Default::default(),
&Default::default(),
&Default::default(),
false,
)
.into_iter()
Expand Down

0 comments on commit 6551ebb

Please sign in to comment.