Search code examples
sql-serversql-server-data-tools

Renaming table results in CREATE statement rather than ALTER


In a .sqlproj I have changed the name of a table (amongst other changes). I did the renaming in Visual Studio 2012 through the right click 'refactor' option. When I try to publish the changes, the deployment script has a CREATE TABLE command rather than an ALTER TABLE command for the table renaming. What am I doing wrong here?


Solution

  • I've gotten to the root of my problem. The database to which I was publishing the script was a copy (bacpac) of the true database. The bacpac was missing the dbo.__RefactorLog table, so when running the script it was ignoring the refactorlog file and just creating the database.