Visual Studio Tools for Database Professionals - Rename Refactoring
I started playing again with VSTDB.
This version only includes on 'Refactoring', the 'Rename' one. The first thing I tried to do was to rename a database column.
There are 3 things to do when doing that refactoring:
- Renaming it in the database table.
- Renaming it in every other database object that references it (stored procedures, views, etc).
- Renaming it in your Data Access Code
3) was obviously out of the scope of the tool, perhaps they can do it with ADO.NET v.next.
2) works OK
1) This is one seems simple but it's tricky. If you generate migration scripts by comparing two DB schemas, you never know if a column was renamed or if there's a new column and the old one was deleted. That's the first test I do with any tool that claims to do 'database refactorings'. But if the VSTDB team was doing only one refactoring for this version, at least it should be well done. But it's not. When you rename a column you get a nice warning saying "The default script that is generated at deployment time results in dropping the existing table column and adding a new table column with the new name. This can result in data loss. If data must be maintained, please perform data migration manually".
Worse, the script to do that change creates a temporary table, copies the data, and renames the temporary table with the original table name. It does not do an alter table add column/drop column.
I was disappointed.