Search code examples
sqldatabasemigrationproduction-environment

Data Migrations on Production Database


Is there any way to have data migrations on production database not to be with SQL?

We are using MigratorDotNet and when we build a new funcionality for the application that changes the scheme of the database and we need to do some data updates we have to do this complex and troublesome SQL statements so the data is consistent on production.

Was wondering if there was another way to do this, what are the bests practices to do this? Any ideas on other possible solutions?

We cannot use something like NHibernate because then we have to keep fixing old migrations when the scheme changes, and that can be error prone.


Solution

  • The trick is to use your migration tool and fold said data manipulation statements into the migrations. We use an extended version of the same thing typically for a few projects and it can definitely handle that trick.