Renaming a source-controlled DB

A SQL Server Management Studio add-in to source control your database in Subversion or Team Foundation Server.

Renaming a source-controlled DB

Postby JasonR » Thu Oct 13, 2011 10:35 pm

What is the best method for renaming a database that is source controlled?
Posts: 6
Joined: Thu Oct 13, 2011 10:28 pm

Postby DavidSimner » Sat Oct 15, 2011 3:43 pm

If you mean renaming the database on SQL server, then the best way is:

1. make sure that both the commit tab and the get latest tab are empty by committing all your outstanding changes and gettting all of your teammates
2. on the setup tab, right-click on the URL where it's linked to and click copy
3. on the setup tab, unlink the database from source control
4. rename the database
5. on the setup tab, link it to the same location (you can paste the URL that you copied above)
6. visit the commit tab and wait for the spinny to finish (you should see the spinny say "Accepting updates from source control" which is where it determines that your database is already fully up-to-date with no changes to commit or get, and we sort out our internal data structures to reflect this)

At this point you should be done. Let me know if you have any problems.
Posts: 54
Joined: Thu Feb 04, 2010 5:05 pm

Postby JasonR » Mon Oct 17, 2011 1:38 pm

Thanks for the reply. You were correct -- I did mean to ask how to change a database's name in SQL Management Studio while retaining its source control history.

Your process worked like a charm. Note that each user needs to re-link the database to the source control system after the name change.
Posts: 6
Joined: Thu Oct 13, 2011 10:28 pm

Return to SQL Source Control Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests