Giter VIP home page Giter VIP logo

Comments (12)

AbhilashGade avatar AbhilashGade commented on May 19, 2024 1

@kaplanelad yeah on it

from loco.

AbhilashGade avatar AbhilashGade commented on May 19, 2024

Can I pick this issue?

from loco.

kaplanelad avatar kaplanelad commented on May 19, 2024

@jondot maybe we can fix the seaorm cli crate and make the generator entry to use via the crate instead of the cli installation?

what do you think?

from loco.

jondot avatar jondot commented on May 19, 2024

the crate is a bit heavy, and at this stage it would require efforts to maintain -- because we would need to duplicate their code into our project manually every time right? i don't remember if this is still the case.

regardless -- we may also need to pin to a specific sea-orm-cli version, because I suspect different versions produce different results

from loco.

kaplanelad avatar kaplanelad commented on May 19, 2024

The problem is that the sea-orm is needed only on specific templates (saas).
We could do something smarter and check in the lib that:
Check if the user uses the DB feature and the migration commands in the configuration are enabled (migration, truncate, reset..) and then check if seaorm-cli is installed. and if not, stop the service and prompt a pretty message.

What do you think?

from loco.

jondot avatar jondot commented on May 19, 2024

yes sounds good!

from loco.

kaplanelad avatar kaplanelad commented on May 19, 2024

@AbhilashGade you can feel free and take it.
you can implement it in the lib instead of the CLI.
see that the validation should be only when with-db feature is enable

let me know if your needs some help. i would like to assists if you needs

from loco.

kaplanelad avatar kaplanelad commented on May 19, 2024

@kaplanelad yeah on it

just make sure that you not installing automatically sea-orm. i think it is better to return an pretty error with explanation

from loco.

AbhilashGade avatar AbhilashGade commented on May 19, 2024

Okay how do I test this

from loco.

kaplanelad avatar kaplanelad commented on May 19, 2024

@AbhilashGade you can use (check_seaorm_cli)[https://github.com/loco-rs/loco/blob/master/src/doctor.rs#L132] which doing the checks that you needs

from loco.

AbhilashGade avatar AbhilashGade commented on May 19, 2024

So do I do something like this

fn check_sea_orm() {
    println!("πŸ™ 🌊SeaORM is not installed. SeaORM is a powerful ORM for Rust that provides convenient database abstractions. It is required for this feature. Would you like to install it? (y/n)");

    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    let input = input.trim().to_lowercase();

    if input == "y" || input == "yes" {
        println!("Installing SeaORM... 🌊 πŸ™");
        std::process::Command::new("cargo")
            .arg("install")
            .arg("sea-orm")
            .output()
            .expect("Failed to install SeaORM");
    } else {
        println!("SeaORM is required for this feature. Please install it to continue.");
    }
}

from loco.

kaplanelad avatar kaplanelad commented on May 19, 2024

@kaplanelad yeah on it

just make sure that you not installing automatically sea-orm. i think it is better to return an pretty error with explanation

Did you see my previous message? I believe there's no need to install the sea-orm-cli. Handling the installation process might be unnecessary and open to potential problems.
Prompting the user with the necessary details should suffice.

You can take a look at this PR: #212. if you think we can to it better or prettier you are more then welcome to advise

from loco.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.