Migrate: Local and remote migrations are not in lockstep

Created on 7 Jul 2019  路  9Comments  路  Source: prisma/migrate

After an attempted migration, I get the following error:
Error: Local and remote migrations are not in lockstep. We have migration 20190707191708 locally and 20190707213735 remotely at the same position in the history.

How can this be fixed? Neither of prisma migrate save/up/down wants to do anything...

bu0-needs-info datamodel-migrations kinbug teamigrations

Most helpful comment

Looks like a migration failed. Try deleting the entry from the _Migrations table which matches the error message.

If the error is persistent please give us a minimal reproduction

All 9 comments

Looks like a migration failed. Try deleting the entry from the _Migrations table which matches the error message.

If the error is persistent please give us a minimal reproduction

I'm running into this issue too, nuking every row in the _Migrations table seems to allow me to apply my migration, but I still don't understand what the error means or how it's supposed to be solved correctly... what do you mean by "deleting the entry which matches the error message" @pantharshit00 ? The error message names two migrations, are you saying to delete both?

Right now these need to be manually handled. Yes, I am saying to delete both of the entries.

In the near future, we will use the lift.lock file to resolve conflicts via the CLI.

Facing the same issue on my end as well. This is the error I run the command in package.json script where my programs are running as pods in Kubernetes. So, 2 pods succeeded and 2 of them give this error.

> cd "src/app/db/prisma" && yes | prisma2 lift up

Error: Local and remote migrations are not in lockstep. We have migration 20191220182717-tcdb locally and 20191220124833-tcdb remotely at the same position in the history.

Temporarily hacking to make prisma2 lift up run in the background like this prisma2 lift up & so that my scripts don't fail.

@tvvignesh You should NOT apply migrations again and again. Please do it in a separate step in your CI pipeline.

@tvvignesh You should NOT apply migrations again and again. Please do it in a separate step in your CI pipeline.

Sure. Have separated it out now. Figuring out how to setup the CI for database without duplicating schema.prisma in both the service and the CI. Any specific recommendations available for CI pipeline setup for migrate? Any workflow people typically follow? In my case, I use Gitlab CI with Skaffold on Kubernetes for all my microservices and databases. Thanks.

@tvvignesh I remember you opened a new issue regarding this. We will follow up there.

Any update about this issue?

Thanks for taking the time to report this issue!

We've recently released a Prisma Migrate Preview (2.1.3.0 release notes), which has quite a few changes compared to the previous experimental version. We believe this issue is no longer relevant in this new version, so we are closing this.

We would encourage you to try out Prisma Migrate Preview. If you come across this or any other issue in the preview version, please feel free to open a new issue in prisma/prisma.
For general feedback on Prisma Migrate Preview, feel free to chime in on this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

steebchen picture steebchen  路  3Comments

jwld picture jwld  路  3Comments

MichalLytek picture MichalLytek  路  3Comments

RafaelKr picture RafaelKr  路  3Comments

marcjulian picture marcjulian  路  4Comments