With my recent changes on one branch, let's name it Branch A
, I changed relations between entities, as well as renamed some properties. I created migrations and applied them to our Postgres-Database, good so far. I committed and pushed the migrations to the git repo and created a pull request. Now I'm waiting on the review of a colleague of mine to merge it to the master branch.
Now the problem.
I started to work on the next item and created another branch, Branch B
. I created it from the master, so Branch B
does NOT have the changes I made with Branch A
, but the Database does, as we don't have it into source control. Now I get, of course, errors, as it cannot find the data with the renamed property from Branch A
and the not yet renamed property of Branch B
. I could drop the database and recreate it with the initial migration, but that's a lot of work and I will lose data.
We're working with .NET 5 and EF Core, the database provider is Postgres.
So, how do I resolve this misery, without having the database added to the source control?
You can try to apply previous migration (from the master) to your already updated database. It'll try to reverse the changes. Check the link below: