Skip to content

Commit

Permalink
sea-orm-cli: allow skipping impl ActiveModelBehavior for generated en…
Browse files Browse the repository at this point in the history
…tities
  • Loading branch information
waynr committed Jul 10, 2024
1 parent 9fd5523 commit c512541
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 8 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 @@ -304,6 +304,13 @@ pub enum GenerateSubcommands {
long_help = "Generate helper Enumerations that are used by Seaography."
)]
seaography: bool,

#[arg(
long,
default_value = "true",
long_help = "Generate empty ActiveModelBehavior impls."
)]
gen_impl_active_model_behavior: bool,
},
}

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 @@ -34,6 +34,7 @@ pub async fn run_generate_command(
enum_extra_derives,
enum_extra_attributes,
seaography,
gen_impl_active_model_behavior,
} => {
if verbose {
let _ = tracing_subscriber::fmt()
Expand Down Expand Up @@ -191,6 +192,7 @@ pub async fn run_generate_command(
enum_extra_derives,
enum_extra_attributes,
seaography,
gen_impl_active_model_behavior,
);
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 @@ -398,6 +398,7 @@ mod tests {
&Default::default(),
&Default::default(),
false,
true,
)
.into_iter()
.skip(1)
Expand Down
Loading

0 comments on commit c512541

Please sign in to comment.