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

Supply a custom path to Prisma schema file for CLI commands (i.e. --schema?) #1412

Closed
Jolg42 opened this issue Jan 22, 2020 · 8 comments
Closed
Assignees
Labels
kind/feature A request for a new feature. topic: cli
Milestone

Comments

@Jolg42
Copy link
Member

Jolg42 commented Jan 22, 2020

This is useful when you want to run the commands from the root folder of your project for example and your schema.prisma file is in a subdirectory. It avoids changing directories.

  • What is the naming of the flag/param? (path, schema, ...)
  • Which commands require it?
  • Also available via ENV var? (e.g. PRISMA_SCHEMA_PATH)
  • How are the developers made aware of it being active?
@janpio janpio added this to the Preview 21 milestone Jan 22, 2020
@pantharshit00 pantharshit00 added kind/feature A request for a new feature. topic: cli labels Jan 23, 2020
@Jolg42 Jolg42 changed the title Supply a custom path to Prisma schema file for CLI commands (i.e. --path?) Supply a custom path to Prisma schema file for CLI commands (i.e. --schema?) Jan 30, 2020
@Jolg42
Copy link
Member Author

Jolg42 commented Jan 30, 2020

@schickling I'm implementing it like this --schema=./directory/prisma.schema
Spec will be in Notion soon!

@janpio
Copy link
Member

janpio commented Feb 6, 2020

Internal: Can you link the spec here please @Jolg42?

@Jolg42
Copy link
Member Author

Jolg42 commented Feb 6, 2020

There is none at the moment, Søren is on it :)

@timsuchanek timsuchanek removed their assignment Feb 6, 2020
@Jolg42
Copy link
Member Author

Jolg42 commented Feb 13, 2020

It is implemented as --schema=./path/to/prisma.schema (absolute or relative)

@sorenbs I can't find it in the spec, is it on a branch?

@Jolg42
Copy link
Member Author

Jolg42 commented Feb 14, 2020

It is in https://github.com/prisma/specs/blob/master/cli/README.md#init in Arguments sections like
schema specify the path used to read the schema.prisma file instead of the default path. The path can be absolute or relative. Note that the generation result is written to that same file.

@aeharake

This comment has been minimized.

@aeharake
Copy link

aeharake commented Mar 10, 2021

@ Jolg42 Hello, did you manage to find a way to specify the path from .env?

This is useful when you want to run the commands from the root folder of your project for example and your schema.prisma file is in a subdirectory. It avoids changing directories.

* What is the naming of the flag/param? (path, schema, ...)

* Which commands require it?

* Also available via ENV var? (e.g. `PRISMA_SCHEMA_PATH`)

* How are the developers made aware of it being active?

Ok got it. We can set this from package.json:

  "prisma": {
    "schema": "prisma/schema.prisma"
  },

@Jolg42
Copy link
Member Author

Jolg42 commented Mar 10, 2021

The docs are here https://www.prisma.io/docs/concepts/components/prisma-schema#prisma-schema-file-location

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature A request for a new feature. topic: cli
Projects
None yet
Development

No branches or pull requests

5 participants