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.

Prisma migration not working with dolt

See original GitHub issue

Discussed in https://github.com/prisma/prisma/discussions/15786

<div type='discussions-op-text'>

Originally posted by PavelSafronov October 14, 2022 Hi Prisma folks, Pavel with Dolthub here. Our product, dolt, provides a MySQL-like database, and one of our customers is experiencing issues while using Prisma+dolt, while the same migration works with Prisma+MySQL.

The error they are encountering is

Error: Error: unknown error: table not found: _prisma_migrations
   0: migration_core::state::DevDiagnostic
             at migration-engine/core/src/state.rs:251

But according to dolt DB logs, this error happens before Prisma queries the database for tables. Our current theory is that a different error is being originally thrown, and somehow causes the table not found error. But that’s just a theory.

Here is a repro repo that can illustrate the issue: https://github.com/PavelSafronov/prisma-dolt-debug I’ve included DB and Prisma logs for both the successful (MySQL) and the unsuccessful (dolt) runs.

We’re kind of stuck here:

  • We’ve enabled Prisma logs, but those don’t appear to capture the engine internals. Is there a way to get engine logs?
  • We’ve tried stepping through the Node.js code, but this in turns calls the Rust engine code, and I’m not sure how to step through that code. Is there a way to debug the Rust engine code during a migration?

Any advice you have will be really appreciated.</div>

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
PavelSafronovcommented, Oct 20, 2022

I’m not sure about how long this will take us to fix, but I don’t think Prisma should be special-casing our error messages, that seems like a bad idea. It might be a good idea to avoid preparing a statement this early in the process, but Prisma may have very valid reasons for doing what it’s doing right now.

1reaction
PavelSafronovcommented, Oct 14, 2022

Hi @janpio , here are the answers to your questions:

  • Obsidian db is just an empty database the test creates. It’s the name our customer used for the repro repo.
  • Just tried db push with dolt, and that command succeeded. Curious.
  • HostedDolt should work, but I’ve been testing this with just a local dolt installation, and that’s what the repro repo uses as well.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Migration troubleshooting in development - Prisma
This guide describes how to resolve issues with Prisma Migrate in a development environment, which often involves resetting your database.
Read more >
The Database as Code Landscape - Bytebase
In Liquibase, a schema migration unit is encapsulated in a Change Set . ... Prisma is targeting the last problem of wiring code...
Read more >
"Migration troubleshooting in production" documentation offers ...
prisma migrate deploy issues a warning if an already applied migration has been edited - however, it does not stop the migration process....
Read more >
Prisma migration is bad state - Stack Overflow
Connect back to your main Database and baseline the generated migration by running prisma migrate resolve --applied ...
Read more >
Effortless database schema migration with Prisma
However, they are quite tedious to perform and manage. To solve this problem, Prisma ORM created a tool called Prisma Migrate that provides ......
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