Closed bangbaew closed 1 year ago
My guess is that between 'Prisma schema loaded...' and 'Generated Prisma Client...' your CLI crate had to compile, since it gets ran with cargo run
. You're building everything else in release mode, but cargo run
will just use debug mode, so all your dependencies are recompiling in debug mode, the CLI is running, and then the generator is triggered - which only takes 1.00s. If this is the case I'm not quite sure what to recommend yet. I'll think about it.
My guess is that between 'Prisma schema loaded...' and 'Generated Prisma Client...' your CLI crate had to compile, since it gets ran with
cargo run
. You're building everything else in release mode, butcargo run
will just use debug mode, so all your dependencies are recompiling in debug mode, the CLI is running, and then the generator is triggered - which only takes 1.00s. If this is the case I'm not quite sure what to recommend yet. I'll think about it.
Thanks for fast response, if there's no other way, can you make it log? so, I could tell that the build process is not dead as long as I see what's going on inside the cli between 'Prisma schema loaded...' and 'Generated Prisma Client...'.
I'm not sure I can, since that part is out of my control.
One idea is to make the CLI cargo install
-able, but that still has the problem of requiring dependency caching. For your case, adding --release
to the Cargo alias should work, I just wonder if it's a good enough solution.
I'm not sure I can, since that part is out of my control. One idea is to make the CLI
cargo install
-able, but that still has the problem of requiring dependency caching. For your case, adding--release
to the Cargo alias should work, I just wonder if it's a good enough solution.
Works perfectly! thanks a lot.
Now I just have to create an alias prisma-release = "run --release --bin prisma"
and add RUN sed -i 's/cargo prisma/cargo prisma-release/g' prisma/schema.prisma
to my Dockerfile, so it can replace the provider with the release version when deploying and i'll still be able to run debug generate when i'm developing, now it saves me a lot of time, at least 5 minutes on each deploy since okteto cloud isn't caching the layers for me.
When I run Prisma cli generate with --release flag, it's stuck at
Prisma schema loaded from prisma/schema.prisma
for a very long time (5 minutes on okteto cloud), while the debug run just executes immediately (but needs to compile debug dependencies, so if it's on cloud, I would use release dependencies to run it).