Database Migration Woes Entity Framework 4.1 Code First
We are following the Entity Framework Code First model and developing a couple of applications. Now we have production/staging/development databases, and I need a good way to ensure changes are properly effected in each of the environments.
The blunt approach is to have the app create an empty database (or deploy an empty database) and then migrate all the necessary data, but this is just a lame way of doing things.
I checked online and there are suggestions for VSDBCMD (?), but we only have VS 2010 prof, so no database projects to speak of.
Any other solution?
If I migrated to EF 4.3 which supposedly has support for migrations, do I need to change anything else in the code?
.
Re: Database Migration Woes Entity Framework 4.1 Code First
We generally use Management Studio to generate scripts for creation of tables and, if required, insertion of data. Such a script can be run by SQLCMD directly, from a batch file or from a Custom Action during installation.
Re: Database Migration Woes Entity Framework 4.1 Code First
This is my scenario: I have development going on on four different machines (which in turn may have their own database versions). At the end of the development cycle, I use a staging machine (usually my laptop) where all the changes are integrated and the final database structure created.
Now the changes have to be deployed on a staging server, which has an older copy of the database. How do I synchronize the database on the staging server with that on my laptop? I could generate the DDL scripts from Management Studio, but I can't run them as they are on the staging server database.
Is there a way I can generate the change scripts through Management Studio automatically?