Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sea-orm-cli] generate entity prints columns info with respect to --date-time-crate option #869

Closed
billy1624 opened this issue Jul 13, 2022 · 4 comments · Fixed by #910
Closed
Assignees
Labels
good first issue Good for newcomers

Comments

@billy1624
Copy link
Member

Motivation

Generating entity will prints the progress and column info. However, it does not respect the --date-time-crate option introduce in PR:

sea-orm-cli generate entity -u mysql://root:root@localhost/active_enum_tests --date-time-crate time
Generating satellite.rs
    > Column `id`: i32, auto_increment, not_null
    > Column `satellite_name`: String, not_null
    > Column `launch_date`: DateTimeUtc, not_null
    > Column `deployment_date`: DateTimeUtc, not_null
sea-orm-cli generate entity -u mysql://root:root@localhost/active_enum_tests --date-time-crate chrono
Generating satellite.rs
    > Column `id`: i32, auto_increment, not_null
    > Column `satellite_name`: String, not_null
    > Column `launch_date`: DateTimeUtc, not_null
    > Column `deployment_date`: DateTimeUtc, not_null

Proposed Solutions

get_info method takes DateTimeCrate enum and pass it onto get_rs_type method (now hard coded as DateTimeCrate::Chrono.

  • pub fn get_info(&self) -> String {
    let mut info = String::new();
    let type_info = self
    .get_rs_type(&DateTimeCrate::Chrono)
    .to_string()
    .replace(' ', "");
    let col_info = self.col_info();
    write!(
    &mut info,
    "Column `{}`: {}{}",
    self.name, type_info, col_info
    )
    .unwrap();
    info
    }
@billy1624 billy1624 added the good first issue Good for newcomers label Jul 13, 2022
@billy1624 billy1624 changed the title Generate entity prints columns info with respect to --date-time-crate option [sea-orm-cli] generate entity prints columns info with respect to --date-time-crate option Jul 13, 2022
@anshulxyz
Copy link
Contributor

Hi @billy1624 I would like to work on this.

@billy1624
Copy link
Member Author

Hi @anshulxyz, welcome! Please go ahead! Feel free to ping me if you need any help :)
Just open a draft PR and ask for help. Thanks!!

@billy1624 billy1624 moved this to Open for Contributions in SeaQL Dev Tracker Jul 15, 2022
@nahuakang
Copy link
Contributor

I'm so sorry about this bug 🙈 It was in the back of my mind but I think I forgot about it.

@billy1624
Copy link
Member Author

Hey @nahuakang, it's not your fault! I should have catch that during the review phase loll

anshulxyz added a commit to anshulxyz/sea-orm that referenced this issue Jul 25, 2022
@billy1624 billy1624 moved this from Open for Contributions to In Progress in SeaQL Dev Tracker Jul 26, 2022
@billy1624 billy1624 moved this from In Progress to Done in SeaQL Dev Tracker Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants