prisma: [Windows/MySQL] Table `_migration` doesn't exist when migrating

Prisma version: 2.0.0-preview020.3 Operating System: Windows 10 Schema:

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

datasource db {
    default  = true
    provider = "mysql"
    url      = "mysql://root@localhost:3306/prisma2_api_rest"
}

enum Role {
    ADMIN
    USER
}

model User {
    id       Int    @id
    email    String @unique
    role     Role   @default(USER)
    username String @unique
}

When I try to run my migrations, I receive the following error:

Failure during a migration command: Connector error. (error: Error querying the database: Error querying the database: Error querying the database: Server error: `ERROR 42S02 (1146): Table 'prisma2_api_rest._migration' doesn't exist')

It also seems like the migration is dropping the table if it exists, but then it tries to access it which causes the error, as when running the migration I see the following:

Migration            Database actions                        Status
20200129144426-init  1 DropTable, 2 CreateTable statements.

Not entirely sure that’s significant though, because I’ve tried dropping the database and just creating the empty database with the same results.


I’ve also tried the TypeScript rest-express example and received the same error. I can provide the tiny package setup as a GitHub repo if need be, but given that I get the same error in the example I can’t imagine I’d be doing anything significantly different that’d cause this.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 18 (7 by maintainers)

Most upvoted comments

I can confirm that at least on my system this does now work out of the box! 😃

Great 😃 Then I’m happy to say it looks like we can close this issue. Thanks for the feedback!

I can also confirm this is now resolved 🥳 🎆 The new migrate is smoooooth 😎

I’ll be upgrading to the newer migrate on Monday so can confirm for you then.

Ahh I see. Sorry I didn’t see that addition. That might be a nice work around for now - I’ll test ASAP - thanks.