Brendonovich / prisma-client-rust

Type-safe database access for Rust
https://prisma.brendonovich.dev
Apache License 2.0
1.84k stars 108 forks source link

Line breaking problem #164

Closed tingfeng-key closed 2 years ago

tingfeng-key commented 2 years ago

When cargo Prisma generate is executed, DATAMODEL_ The new line character of STR in unix is n, which is n in Windows. It may be unified or handled?

Brendonovich commented 2 years ago

I'm not really concerned about this unless it actually affects how the generated client operates. Clients aren't meant to be shared across multiple operating systems and should be regenerated often, so I don't know if line endings being different really matters.

tingfeng-key commented 2 years ago

Why do I need to regenerate the client when I change the operating system environment? If the schema is unchanged, it is unnecessary to regenerate the client, because the generated trust code can be shared in other operating system environments

Brendonovich commented 2 years ago

With the upcoming 0.6.2 release I use absolute paths to include the migrations directory and datamodel string, immediately disqualifying the possibility of using them cross platform. Plus if you've ever used Prisma Client JS, you'll know that Prisma expect you to regenerate the client every time you use your project on another machine, so I think it's fine to expect this in PCR too.

tingfeng-key commented 2 years ago

With the upcoming 0.6.2 release I use absolute paths to include the migrations directory and datamodel string

Prisma expect you to regenerate the client every time you use your project on another machine

Why do you do this? Isn't cross platform good?

The schema does not change. I just need to regenerate the code if I change the operating system. I don't understand why

Brendonovich commented 2 years ago

Why do you do this? Isn't cross platform good?

Cross platform would be nice, but I haven't and don't really want to commit to supporting it. Absolute paths on macOS look like /Users/brendan/..., whereas on Windows they're C:\Users\brendan\..., and linux are different again with /home/brendan/... (might have got some details wrong but you get the point). Even if I could get relative paths working I still don't want to advertise the client as being cross-platform.

The schema does not change. I just need to regenerate the code if I change the operating system.

The schema doesn't change, but the environment the client is generated does. The client shouldn't be considered a normal part of source code and shouldn't be checked into source control. This is how Prisma works in every other language (JS, Go) and I don't plan on changing anything for Rust.

tingfeng-key commented 2 years ago

Well, although I like cross platform, I respect your decision. Thank you for your help