Skip to content

prisma generate, typings not updating in VSCode unless IDE is restarted. #14722

@dstampher

Description

@dstampher

Bug description

Changing the type of a field in a model, or adding a new field, then running the command npx prisma db push and npx prisma generate are not updating the typings in my IDE, unless I restart VSCode after making my schema changes and running those commands.

During prototyping where I am frequently updating my models, this disrupts my workflow significantly.

How to reproduce

  1. Add a new field to a model
  2. Run npx prisma db push and npx prisma generate
  3. The field created in step 1 will not be recognized when executing await prisma.model.create(data: {...}).
  4. Restart VSCode
  5. Step 3 error goes away.

Expected behavior

The IDE recognizes the updates to the model and does not require a restart.

Prisma information

<!-- Do not include your database credentials when sharing your Prisma schema! -->
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

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

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

model YoutubeAccount {
  username        String          @unique
  password        String
  profile_path    String
  proxy           String
  video_templates VideoTemplate[]
}

model VideoTemplate {
  id                     Int             @id @default(autoincrement())
  inputDirs              String[]
  title                  String
  description            String
  tags                   String[]
  clipCount              Int
  duration               Int
  width                  Int
  height                 Int
  YoutubeAccount         YoutubeAccount? @relation(fields: [youtubeAccountUsername], references: [username])
  youtubeAccountUsername String?
}

Environment & setup

  • OS:
  • Windows
  • Database:
  • PostgreSQL
  • Node.js version:
  • Node 18.4.0

Prisma Version

npx prisma -v
Environment variables loaded from .env
prisma                  : 4.2.0
@prisma/client          : 4.2.0
Current platform        : windows
Query Engine (Node-API) : libquery-engine 2920a97877e12e055c1333079b8d19cee7f33826 (at node_modules\@prisma\engines\query_engine-windows.dll.node)
Migration Engine        : migration-engine-cli 2920a97877e12e055c1333079b8d19cee7f33826 (at node_modules\@prisma\engines\migration-engine-windows.exe)
Introspection Engine    : introspection-core 2920a97877e12e055c1333079b8d19cee7f33826 (at node_modules\@prisma\engines\introspection-engine-windows.exe)
Format Binary           : prisma-fmt 2920a97877e12e055c1333079b8d19cee7f33826 (at 
node_modules\@prisma\engines\prisma-fmt-windows.exe)
Default Engines Hash    : 2920a97877e12e055c1333079b8d19cee7f33826
Studio                  : 0.469.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions