Reputation: 63
Our development team was handed an ASP.NET MVC C# web application from a vendor that has been poorly built and maintained over the years. It started with code first migrations but at some point in time changes were made to the database that were not done with a migration. Now we have a production database with mismatched migrations. My question now, does anyone know of a way to create a migration from the current schema? Kind of like a reverse migration, take the current schema, and create a code first migration for its current state.
If not, open to suggestions as to what steps should be taken to get the migrations to match up with the current production database.
Upvotes: 0
Views: 257
Reputation: 63
The answer ended up being deleting all previous old migrations, adding a new migration based on current model schema and starting fresh from there. There were still some discrepancies we saw with the production database, like new foreign keys, and lost indexes. But it was a good place to start, and now allows us to spin up the database and run our seeders in new environments.
Upvotes: 0