Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entitiy Framework: "Update Database from Model" instead of "Generate Database from Model"

I have created a Entity Framework 4 model with Visual Studio 2010 and generated a database from it. Now I found myself adding new properties (with default values), changing documentation of columns, changing names of columns, changing types of columns several times. All tasks that do not require much "extra work" in order not to be possible to be achieved automatically (in my humble opinion). Everytime I did "Generate Database from Model" and lost of course the table data.

Is there a way just to update the database's architecture so to say - leaving the table data untouched? Maybe with some user interaction especially when changing types etc.? Or would this functionality be simply too difficult to be realized to work in a reliable way?

Thanks in advance! Cheers, David

like image 414
David Avatar asked Jun 16 '10 13:06

David


1 Answers

Noam Ben-Ami - MSFT1 (Microsoft Employee) answered my question at http://social.msdn.microsoft.com/Forums/en-us/adodotnetentityframework/thread/3adc080f-ee8c-4104-be29-95b2fb3fabe9 as follows:

We've build the entity designer database power pack to support this. You can download it here: http://visualstudiogallery.msdn.microsoft.com/en-us/df3541c3-d833-4b65-b942-989e7ec74c87

It includes a database generation workflow for the designer that does migration, rather than drop/create.

This posting is provided "AS IS" with no warranties, and confers no rights.

I haven't tested the tool yet, but I guess the info might be valueable for others, too.

like image 73
David Avatar answered Sep 28 '22 04:09

David