views:

32

answers:

1

In mySql Workbench there's a possibility to "sync" the model with the DB and vice versa. Is there a function like this in EF? I've added som entities and I'd like it to get reflected in the DB. Do I really have to regenerate the entire DB and loose data?

Thanks

+1  A: 

Sadly there is no easy way AFAIK to do this today.

One way to handle this is to generate the DDL and then cut and paste the new sections into SQL Server Management Studio and run them there. If you want to maintain scripts for each release of the database you'll need to take an approach like this too.

See also: http://stackoverflow.com/questions/2198426/database-migrations-for-entity-framework-4

PS The EF Power Pack: http://msdn.microsoft.com/en-us/data/ff830362.aspx may help. It says "The second useful feature related to model-first the ability to update an existing database and synchronize the model with it. This allows you to make changes to the model that can be deployed to the database without data loss."

Hightechrider
Not the solution I was hoping for but you provided a reasonable work around. Thanks!
Phil
EF Power pack may help also, see updated answer.
Hightechrider
Thank you. It seems as a good way of solving my problem. If I use it I'll comment on how I found it.
Phil