Replies: 2 comments
-
|
Maybe you would enjoy EntityFirst approach more (once it fully comes out)? Allowing per field attributes would be very inconvenient CLI experience as the codebase grows and amount of per field attributes grows |
Beta Was this translation helpful? Give feedback.
-
|
Hmm, I don't think Entity First is right for my needs. I still want to maintain my migration files and have I can appreciate the complexity of adding many new flags for more specific behavior; maybe the solution is enabling library users to call generate and have custom hooks during generation? Or something like that, which moves the complexity out of the CLI and onto end users who need special behavior. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
sea-orm-clihas a--date-time-crateflag to set which crate to use for date/time types. It also has--with-serdeto be able to generate serialization/deserialization for the structs. And it even has--enum-extra-attributesfor specify additional attributes (say,#[serde(...)]for modifying how serialization is performed.However, there does not seem to be a way to add serde attributes per-field. In particular, I would like to be able to consistently set the format my timestamp fields serialize to.
For instance, say I have this model:
However, the default datetime serialize for
timeis not a format I want to be emitting. I can addwith = "time::serde::rfc3339"to fields, but this has to be done manually. Given the large number of timestamp fields in my database schema, it would be very nice ifsea-orm-clicould generate these attributes for me.Basically, I would like the utility to generate this:
I assume this would require a new feature in
sea-orm-cli, but it's possible that there is a combination of flags that I've missed which would enable this.Beta Was this translation helpful? Give feedback.
All reactions