question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
xlxAciDxlxcommented, Dec 18, 2020

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

1reaction
tomhoulecommented, Dec 21, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Windows/MySQL] Table `_migration` doesn't exist ... - GitHub
It works at WSL2 (Ubuntu 20.02) + MySQL 8.0.21. At windows OS, attach the code below to prisma.schema . And then, you can...
Read more >
File not exist when run mysql database migrations on windows
\internal\db\migrations , this is migration files path. First of all i run the command docker compose up .for an existing docker.yaml , then...
Read more >
Diagnose issues for MySQL | Database Migration Service
This can happen if the migration job can't find the dump file at the given location. Check the dump path to ensure a...
Read more >
10.2.1 A Visual Guide to Performing a Database Migration
From MySQL Workbench, choose Database and then Migrate to open the migration wizard and display the migration wizard overview (see the figure that...
Read more >
SELECT * FROM error: table does not exist - post migration
Dear All, Following a migration from MS Access to Oracle SQL, via Oracle SQL Developer, I am unable to perform a simple SELECT...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found