Ecto and PlanetScale MySQL database

I’m trying to set up the production environment of a Phoenix app to point to a PlanetScale-managed MySQL database, but when I try to deploy the app, the migrate command fails with the following error:

** (MatchError) no match of right hand side value: {:error, %MyXQL.Error{connection_id: 2345279677, message: “in autocommit mode, transactionID should be zero but was: 1674845486107521990”, mysql: %{code: 1105, name: nil}, statement: “SELECT RELEASE_LOCK(‘ecto_Gesttalt.Repo’)”}}

Has anyone run into a similar issue?

We use PlanetScale at I will reach out to one of the engineers who set up the integration and ask them to follow up here.

I think this might be the result of PlanetScale’s branching concept. It doesn’t allow you to make schema changes to your production database. For this reason, we don’t run Ecto migrations against our PlanetScale databases at

This was exactly the issue. I had to create a development branch, run the migrations against it, and then deploy them through PlanetScale. Since I was coming from the mental model of “migrations run at deployment time”, I was wrongly expecting PlanetScale to follow the same model.
Thanks folks :pray:

1 Like

I also ran into this same error in my app when running migrations in PlanetScale. I follow their branching strategy but didn’t have much luck.

It turned out that I had to set the Repo config value migration_lock to false. Once I did that, migrations ran fine via mix ecto.migrate against my DB branch and I could merge my changes in PlanetScale.