Error Next.JS Prisma client not picking up new models

I created a database table in my schema file as shown below

model Users {
  address String  @id @unique
  paid    Boolean @default(false)
}

model Vote {
  token String @id @unique
  count Int    @default(1)
}

and a prisma.ts file with the content below

// lib/prisma.ts
import { PrismaClient } from '@prisma/client';

let prisma: PrismaClient;

if (process.env.NODE_ENV === 'production') {
  prisma = new PrismaClient();
} else {
  if (!global.prisma) {
    global.prisma = new PrismaClient();
  }
  prisma = global.prisma;
}

export default prisma;

Everything was working fine and I could access my models using the exported prisma variable then I added a new model as shown below 

model LaunchPad {
  id                 Int    @id @unique @default(autoincrement())
  name               String
  symbol             String
  tokenId            String
  total_supply       String
  decimal            String
 
}

The global prisma variable is not picking up the new model and when I try to use it to save into the database using prisma.launchPad.create() it outputs the error below

TypeError: Cannot read property 'create' of undefined

 

message profile
Admin
2023-04-14

This problems happens sometimes and it has a very simple fix. All you need to do is to close your text editor and open it again

Add Message

Click on the button below to add a new message to this thread

Tags

#Javascript #next js

Thread detail

Satus: Open
Messages: 1Started: 2023-04-14
loading..

DEVMAESTERS

Newsletter

Services

Frontend Development |Backend Development |Full Website Development |Bootstrap Website upgrades | Website Debbugging | Website Hosting & deployment

Contact

Interested in hiring me or collaborating with me on a project, click on any of the links below to get my social media handle

Or contact me via Tel: (+234)-806-225-7480 | Email: abubakarzakari1703@gmail.com

Copywright@devmaesters.com
Privacy Policy

By using our website,
you agree that devmaesters can store cookies on your device and disclose information in accordance with our privacy policy.