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

prisma db push creates new prisma client inside of ./node_modules/@prisma/client #4885

Closed
supermacro opened this issue Nov 16, 2020 · 4 comments · Fixed by #7058
Closed

prisma db push creates new prisma client inside of ./node_modules/@prisma/client #4885

supermacro opened this issue Nov 16, 2020 · 4 comments · Fixed by #7058
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/schema Issue for team Schema. topic: prisma db push CLI: prisma db push
Milestone

Comments

@supermacro
Copy link

Bug description

I noticed that if my schema.prisma generator client directive does not explicitly set the output dir to "./node_modules/.prisma/client" then when I run npx prisma db push --preview-feature --force the new prisma client gets generated in ./node_modules/@prisma/client. Which, from my understanding, should not be the case. My understanding is that by default the client should be generated in ./node_modules/.prisma/client

How to reproduce

Run npx prisma db push --preview-feature --force without an explicit output dir in the generator client directive.

Expected behavior

npx prisma db push --preview-feature --force should have generated the prisma client inside of ./node_modules/.prisma/client

Prisma information

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

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

model Admin {
  @@map("admins")
  id         String @id @default(cuid()) 
  email      String @unique
  username   String @unique
  password   String
  sites      Site[]
  created_at DateTime @default(now())
  updated_at DateTime @updatedAt
}


model Site {
  @@map("sites")
  id       String @id @default(cuid())
  hostname String @unique
  verified Boolean @default(false)
  dns_tag  String @unique @default(uuid())
  admin    Admin @relation(fields: [admin_id], references: [id])
  admin_id String 
  posts    Post[]
  created_at DateTime @default(now())
  updated_at DateTime @updatedAt
}


model User {
  @@map("users")
  id         String @id @default(cuid())
  email      String @unique
  username   String @unique
  password   String
  comments   Comment[]
  created_at DateTime @default(now())
  updated_at DateTime @updatedAt
}


model Comment {
  @@map("comments")
  id         String @id @default(cuid())
  parent     Comment?
  author     User?
  anon_author_name String @unique
  body       String @default("")
  votes      Int @default(0)
  post       Post @relation(fields: [post_id], references: [id])
  post_id    String
  created_at DateTime @default(now())
  updated_at DateTime @updatedAt
}


model Post {
  @@map("posts")
  id         String @id @default(cuid())
  url_slug   String @unique
  site       Site @relation(fields: [site_id], references: [id])
  site_id    String
  comments   Comment[]
  created_at DateTime @default(now())
  updated_at DateTime @updatedAt
}

Environment & setup

  • OS: Mac OS Catalina (10.15.7)
  • Database: PostgreSQL
  • Node.js version: 10.16.0
  • Prisma version:
Environment variables loaded from /Users/giorgiodelgado/code/avila/parlez-vous/server/.env
@prisma/cli          : 2.11.0
@prisma/client       : 2.11.0
Current platform     : darwin
Query Engine         : query-engine 58369335532e47bdcec77a2f1e7c1fb83a463918 (at node_modules/@prisma/engines/query-engine-darwin)
Migration Engine     : migration-engine-cli 58369335532e47bdcec77a2f1e7c1fb83a463918 (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core 58369335532e47bdcec77a2f1e7c1fb83a463918 (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary        : prisma-fmt 58369335532e47bdcec77a2f1e7c1fb83a463918 (at node_modules/@prisma/engines/prisma-fmt-darwin)
Studio               : 0.311.0
@Jolg42
Copy link
Member

Jolg42 commented Nov 17, 2020

Could not reproduce with a simple SQLite schema like

datasource db {
  provider = "sqlite"
  url      = "file:./dev.db"
}

generator client {
  provider = "prisma-client-js"
}

model cat {
  id Int @id
  name String
}
j42@Pluto ~/D/r/repro-db-push-generate> npx @prisma/cli db push --preview-feature
Environment variables loaded from /Users/j42/Dev/repro/repro-db-push-generate/prisma/.env
Prisma schema loaded from prisma/schema.prisma

🚀  Your database is now in sync with your schema. Done in 14ms

Running generate... (Use --skip-generate to skip the generators)
✔ Created ./package.json
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN my-prisma-project@1.0.0 No description
npm WARN my-prisma-project@1.0.0 No repository field.

audited 3 packages in 1.003s
found 0 vulnerabilities


> @prisma/client@2.11.0 postinstall /Users/j42/Dev/repro/repro-db-push-generate/node_modules/@prisma/client
> node scripts/postinstall.js

npm WARN my-prisma-project@1.0.0 No description
npm WARN my-prisma-project@1.0.0 No repository field.

+ @prisma/client@2.11.0
added 2 packages from 1 contributor and audited 5 packages in 1.296s
found 0 vulnerabilities


✔ Generated Prisma Client (version: 2.11.0) to ./node_modules/@prisma/client in 75ms

j42@Pluto ~/D/r/repro-db-push-generate> ls -la node_modules/.prisma/client/
total 40248
drwxr-xr-x  7 j42  staff       224 Nov 17 14:08 .
drwxr-xr-x  3 j42  staff        96 Nov 17 14:08 ..
-rw-r--r--  1 j42  staff     25784 Nov 17 14:08 index.d.ts
-rw-r--r--  1 j42  staff     24741 Nov 17 14:08 index.js
-rw-r--r--  1 j42  staff        77 Nov 17 14:08 package.json
-rwxr-xr-x  1 j42  staff  20538156 Nov 17 14:08 query-engine-darwin
-rw-r--r--  1 j42  staff       272 Nov 17 14:08 schema.prisma

It's confusing that the path actually used for generation is node_modules/.prisma/client/ but the command outputs ./node_modules/@prisma/client.
We should fix that.

@timsuchanek timsuchanek transferred this issue from prisma/prisma-client-js Jan 5, 2021
@timsuchanek timsuchanek added bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. kind/bug A reported bug. team/schema Issue for team Schema. labels Jan 5, 2021
@Jolg42
Copy link
Member

Jolg42 commented Jan 6, 2021

@timsuchanek this last part is probably not yet fixed?

It's confusing that the path actually used for generation is node_modules/.prisma/client/ but the command outputs ./node_modules/@prisma/client.
We should fix that.

@tomhoule
Copy link
Contributor

tomhoule commented Mar 3, 2021

Scheduling this so we can look and see if it's fixe.d

@tomhoule tomhoule added this to the 2.19.0 milestone Mar 3, 2021
@pantharshit00
Copy link
Contributor

I can also confirm this is more of a cosmetic issue which we can fix :)

@janpio janpio added bug/2-confirmed Bug has been reproduced and confirmed. topic: prisma db push CLI: prisma db push and removed bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. labels Mar 10, 2021
@albertoperdomo albertoperdomo modified the milestones: 2.19.0, 2.20.0 Mar 17, 2021
@tomhoule tomhoule modified the milestones: 2.20.0, 2.21.0 Mar 31, 2021
@tomhoule tomhoule modified the milestones: 2.21.0, 2.22.0 Apr 14, 2021
@Jolg42 Jolg42 modified the milestones: 2.22.0, 2.23.0 May 5, 2021
Andrew-Colman pushed a commit to Andrew-Colman/prisma that referenced this issue Aug 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/schema Issue for team Schema. topic: prisma db push CLI: prisma db push
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants