Search code examples
postgresqlprismavercel

Prisma migrate not working due to schema not empty, but schema is empty (error P3005)


I wanted to test out prisma, as I have never used it before.

The inital migration was succesfull, but I am unable to make changes to the schema now.

Am I misunderstanding how prisma migrations are supposed to work?

What I did is create a simple prisma schema:

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

datasource db {
  provider          = "postgresql"
  url               = env("POSTGRES_PRISMA_URL")
  directUrl         = env("POSTGRES_URL_NON_POOLING")
}

model User {
  id    Int    @id @default(autoincrement())
  email String @unique
  name  String
}

And then ran prisma migrate dev --name init, which successfully setup my DB schema.

Now I made changes to the schema, I added one new column to the User model:

model User {
  id    Int    @id @default(autoincrement())
  email String @unique
  name  String
  username String
}

Running prisma migrate dev --name add_username fails with the error:

Error: P3005

The database schema is not empty. Read more about how to baseline an existing production database: https://pris.ly/d/migrate-baseline

What am I doing wrong?


Solution

  • As it seems it is an issue by the host (vercel in my case)

    See this