X Tutup
The Wayback Machine - https://web.archive.org/web/20210815102600/https://github.com/prisma/prisma/issues/7809
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

generate output with output has weird package path on Windows #7809

Open
janpio opened this issue Jun 22, 2021 · 1 comment
Open

generate output with output has weird package path on Windows #7809

janpio opened this issue Jun 22, 2021 · 1 comment

Comments

@janpio
Copy link
Member

@janpio janpio commented Jun 22, 2021

λ npx prisma generate
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma

✔ Generated Prisma Client (2.25.0) to .\prisma\foo in 738ms
You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
```
import { PrismaClient } from './prisma\foo'
const prisma = new PrismaClient()
```

Note the ./prisma\foo. The paths for require need to use forward slashes on Windows as well afaik.

@pantharshit00
Copy link
Member

@pantharshit00 pantharshit00 commented Jul 28, 2021

For any good first issue takers, you will need to specify a custom output like so and run prisma generate to reproduce this:

generator client {
  provider = "prisma-client-js"
  output   = "./foo"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model User {
  id        String    @id @default(cuid())
  name      String
  email     String    @unique
  password  String?
  posts     Post[]
  comments  Comment[]
  createdAt DateTime  @default(now())
  updatedAt DateTime  @updatedAt

  @@index([name, email])
}

model Post {
  id        String    @id @default(cuid())
  title     String
  body      String
  published Boolean
  author    User      @relation(fields: [authorId], references: [id])
  authorId  String
  comments  Comment[]
  createdAt DateTime  @default(now())
  updatedAt DateTime  @updatedAt

  @@index([title])
}

model Comment {
  id        String   @id @default(cuid())
  text      String
  post      Post     @relation(fields: [postId], references: [id])
  postId    String
  author    User     @relation(fields: [authorId], references: [id])
  authorId  String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
X Tutup