views:

148

answers:

2

I am using migrator.net to handle database migrations for SQL Server, and I like it so far. The only issue I've run into is how best to migrate changes to views. Thus far, I've been managing each update as a separate script file (which recreates the view). This lets me go back to previous versions of the view without duplicating the code. This approach is working okay for now, but it seems like a lot of work to make a small change to a view. Has anyone else run into this type of problem? Are there any libraries out there that handle view migrations more robustly?

Thanks!

+1  A: 

Whenever I have to change a view, I script the change into a DROP IF EXISTS and CREATE. That's my preference, and while it seems to be more work than other methods (ALTER scripts also work), it allows version control, as you suggest.

Randolph Potter
A: 

Views get stored in SQL Server as a block of text, so you can refer back to them. I can't remember what the table and column is where you will find them. But basically that's how I understand we do not have commands to update the odd line in the proc.