Changing Name & Location of the Prisma Folder in Prisma 2
Asked Answered
D

1

6

I would like to change the name and location of the prisma folder. Currently it called prisma and it sits on the root folder of my nextjs project. I'd like to name it db and have it within the src folder. Is that possible? If so, how?

Decretal answered 5/7, 2021 at 11:24 Comment(0)
D
17

The prisma docs explain how to do this: https://www.prisma.io/docs/orm/prisma-schema/overview#prisma-schema-file-location

For my particular situation, I added the following code to package.json:

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

That changed the location to a folder called db inside of the src folder. I tested it out it works exactly as I wanted -- migrations and all.

Decretal answered 5/7, 2021 at 13:42 Comment(2)
where exactly to put this code in package.json? under the root?Bills
you can put it as another key in package.json: example: { "scripts": ... "prisma": { "schema" : "<your-path>" } }Sievers

© 2022 - 2024 — McMap. All rights reserved.