Database upgrade script

Oct 23, 2009 at 8:50 PM

Hi,

Can you please outline the steps to be followed when I change my model so that the database upgrade scripts are created properly? Righ now, if I change my model, the database upgrade scripots are generated under Upgrade Scripts folder, but the content is empty. I am not sure what I am doing wrong here.

Thanks

Coordinator
Oct 25, 2009 at 12:04 AM

The generated scripts are empty. These are placeholders for you to add your upgrade scripts. They are numbered in the order of generation. If you have something that needs to be added like adding a column to a table. This is the place to put it. I have created a WIKI article for database migration (see below). You can run the generated installer from the environment by following the instructions. You actually only need to set two properties for this. Due to the fact that non-nullable fields can cause an installation to fail if data is present, you will need to write your own upgrade script. The generated files are just placeholders.

http://nhydrate.codeplex.com/wikipage?title=Database%20Migration&referringTitle=Documentation

Coordinator
Oct 28, 2009 at 9:54 PM

The newest version of the generator now creates the difference scripts for you. In each SQL file that that generated under "Upgrade Scripts\Generated", the difference in the last model and current model is created.