docs
docs copied to clipboard
Generator: `output` is relative to `./prisma`
If you have a generator in your schema.prisma
like this:
generator testutils {
provider = "./node_modules/prisma-test-utils/dist/generator.js"
output = "./node_modules/@generated/prisma-test-utils"
}
The output is actually generated in ./prisma/node_modules/@generated/prisma-test-utils
:
✔ Generated Prisma Test Utils to .\prisma\node_modules\@generated\prisma-test-utils in 3.95s
That was unexpected to me.
Changing output
to use ../node_modules...
fixes the problem.
(Could potentially also be the fault of the generator I am trying to use.)
Same with url when using local file sqlite db.
# prisma/schema.prisma
datasource db {
provider = "sqlite"
# need to escape prisma dir to have it in "temp/dev.db"
url = "file:../temp/dev.db"
}
I would expect it to be cwd/project root relative - now I need kind of special config field for prisma file relative path.
Imho It's not that big of an issue, but I think it's the right time to fix it since later it would be a very braking change.
Very random btw - wow, github supports your syntax highlighting!! :+1:
@vadistic Can you please open a new github issue about this? I think for sqlite path, this is expected behaviour but we can discuss that in a new issue while not adding irrelevant information to this issue.
@pantharshit00 Sure - I just thought it's the same thing that could be formulated like "relative paths in .prisma file are relative to prisma, not project root ". Both behaviors are ok, but imho should be uniform.
https://github.com/prisma/prisma/issues/2040
This needs to be confirmed with a current version again please @pantharshit00.
This still happens in 2.6.0-dev.61
. The output still uses the prisma directory as a root.
We still treat prisma
as root directory in 2.21.2. I guess we should close this now as fixing this now will break thing for folks.
If this is relative to the schema file, this is also technically correct. I wonder if we document it somewhere differently (or not at all, and adding the "relative to your schema.primsa file where you define the generator could help a lot), or if indeed this can be different per generator.
Ok, it is indeed relative to schema.prisma
location. I just tried that out.
We don't document whether it is relative to schema or not: https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#fields-1