There is an application using EntityFramework as ORM. It is necessary to fasten the database migration to this application. EF Code First Migrations are currently under review.
For data structure migration, the DbMigration class provides special methods ( AddTable , AddColumn , etc.). To migrate the data itself, according to the information from here :
But there are some arbitrary commands that can be run.
It is proposed to execute SQL scripts by calling the Sql , SqlFile and SqlResource .
It is assumed that the application can support work with different DBMS (SqlServer, Oracle, Postgre). Since Sql-scripts of migrations can (and most likely will) differ from each other for different DBMS, the question arises how to choose the right script depending on the DBMS?
I assume that you need to write a code like:
if (IsSqlServer) { SqlFile("Script1_SqlServer.sql"); } else if (IsOracle) { SqlFile("Script1_Oracle.sql"); } If I am right, then how is it more appropriate to organize a DBMS check (get IsSqlServer, IsOracle values)? If not, what should be done to migrate data?
Databaseis an instance context property. Is it assumed that I need to create a context as part of the migration? - Vlad