ECarry / photography-website-nextjs14

An open-source Photo Blog📸🌟 built using Next.js 14, Drizzle, postgresql, Auth.js V5, Shadcn/ui and Hono.js.
https://p.ecarry.me
56 stars 6 forks source link

Deployment error for prisma #1

Closed CallMeL closed 6 months ago

CallMeL commented 6 months ago

Hi! Thanks for this brilliant work!

I followed the readme to set up the environment, but there is an error regarding the prisma.photo.findMany(), is there anything I should do in the planetscale dashboard?

This is the whole terminal output:

> photography-website-nextjs13-full-stack@0.1.0 dev
> next dev

   ▲ Next.js 14.1.0
   - Local:        http://localhost:3000
   - Environments: .env

 ✓ Ready in 1696ms
 ✓ Compiled /middleware in 166ms (217 modules)
 ○ Compiling / ...
 ✓ Compiled / in 2.5s (1505 modules)
 ✓ Compiled in 200ms (708 modules)
 ⨯ PrismaClientKnownRequestError: 
Invalid `prisma.photo.findMany()` invocation:

The table `(not available)` does not exist in the current database.
    at async HomePage (page.tsx:15:20)
 ⨯ PrismaClientKnownRequestError: 
Invalid `prisma.photo.findMany()` invocation:

The table `(not available)` does not exist in the current database.
    at async HomePage (page.tsx:15:20)

Thank you! Looking forward to your reply.

ECarry commented 6 months ago
  1. Run npx prisma generate: Ensure that you run this command in your project directory. It generates the Prisma Client based on your data model. If you’ve made changes to your data model, remember to run this command each time.
  2. go ->app->(home)->(routes)->page.tsx const photos = await db.photo.findMany({ where: { category: { title: 'ecarry' } }, orderBy: { createdAt: 'desc' } }) ---> const photos = await db.photo.findMany({ orderBy: { createdAt: 'desc' } })
ECarry commented 6 months ago

You can clone the dev branch. I made some modifications and updated the documentation. git clone -b dev https://github.com/ECarry/photography-website-nextjs14-full-stack.git

CallMeL commented 6 months ago

Thanks! The dev branch and new readme file solve my problem perfectly!