Lost migration script in SSMS

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

Moderators: Chris Auckland, David Atkinson, sherr, PhilScrace, andy.campbell.smith

Lost migration script in SSMS

Postby AdamY » Thu May 23, 2013 7:54 pm

I recently created a migration script to cover some changes to a table and sprocs. When I committed the changes yesterday, the file disappeared from the "Migrations" tab of SQL Source Control. I have version 3.4.1.73 of SQL Source Control and I did check in these changes with the #ignorepolicies tag. I have restarted SSMS and rebooted my machine, but the issue persists. The only file that shows is one I committed 2 months ago.
Image

It seems the only part broken is the SQL Source Control because...
[1] The script does show in TFS and is in my local TFS file directory.
Image
Image

[2] When using SQL Compare to create a change script, it does recognize the migration script and use it.

The Migration Scripts location is correct in SQL Source Control.
Image

How do I get SQL Source Control to show the file again? Thank you for your help.
Last edited by AdamY on Wed Feb 26, 2014 5:34 am, edited 1 time in total.
AdamY
 
Posts: 41
Joined: Fri Oct 15, 2010 8:24 pm

Postby Chris Auckland » Tue May 28, 2013 12:11 pm

Thanks for your post, and sorry you're having trouble with the migration scripts.

In order for SQL Source Control to consider the migration script, the database revisions need to be correct in the database level extended properties, and the database needs to be linked to the exact same repository. We don't currently support cross branch migration scripts, so if something doesn't match up, then we err on the side of caution and ignore it.

Can you take a look at 'CompassionWeb 11234 to 11466.migrationScript' and also at the linked database's extended properties and see if the repository locations all match up?
Chris
Chris Auckland
 
Posts: 757
Joined: Tue Oct 24, 2006 2:12 pm
Location: Red Gate Software Ltd.

Answers

Postby AdamY » Thu May 30, 2013 6:47 pm

The database revision changes every time changes are checked in so I don't understand how that would cause a problem. The current DB revision (in extended properties) is 11468, but I have checked in changes since the migration script check-in so it should be different. And the older migration script is still showing (10507 to 10508). I'm not doing cross-branch migration scripts. SQL Compare is seeing the \"missing\" migration script, too.

I checked the repository locations and found this...

The DB extended property \"SQLSourceControl Scripts Location\" shows:
<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?>
<ISOCCompareLocation version=\"1\" type=\"TfsLocation\">
<ServerUrl>https://tfs.ci.org:8143/tfs/</ServerUrl>
<SourceControlFolder>$/Compassion.com/Source - Database/Dev/CompassionWeb</SourceControlFolder>
</ISOCCompareLocation>


The DB extended property \"SQLSourceControl Migration Scripts Location\" shows:
<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?>
<ISOCCompareLocation version=\"1\" type=\"TfsLocation\">
<ServerUrl>https://tfs.ci.org:8143/tfs/</ServerUrl>
<SourceControlFolder>$/Compassion.com/Source - Database/Dev/Migration Scripts</SourceControlFolder>
</ISOCCompareLocation>


'CompassionWeb 11234 to 11466.migrationScript' shows:
<MigrationScript version=\"2\" type=\"MigrationScript\">
<Name>CompassionWeb 11234 to 11466</Name>
<FromVersion version=\"1\" type=\"VersionInfoRaw\">
<Version>11234</Version>
<ScriptFolderLocation>&lt;?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?&gt;
&lt;!----&gt;
&lt;ISOCCompareLocation version=\"1\" type=\"TfsLocation\"&gt;
&lt;ServerUrl&gt;https://tfs.ci.org:8143/tfs/&lt;/ServerUrl&gt;
&lt;SourceControlFolder&gt;$/Compassion.com/Source - Database/Dev/CompassionWeb&lt;/SourceControlFolder&gt;
&lt;/ISOCCompareLocation&gt;</ScriptFolderLocation>
</FromVersion>
<ToVersion version=\"1\" type=\"VersionInfoRaw\">
<Version>11466</Version>
<ScriptFolderLocation>&lt;?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?&gt;
&lt;!----&gt;
&lt;ISOCCompareLocation version=\"1\" type=\"TfsLocation\"&gt;
&lt;ServerUrl&gt;https://tfs.ci.org:8143/tfs/&lt;/ServerUrl&gt;
&lt;SourceControlFolder&gt;$/Compassion.com/Source - Database/Dev/CompassionWeb&lt;/SourceControlFolder&gt;
&lt;/ISOCCompareLocation&gt;</ScriptFolderLocation>
</ToVersion>


And the migration file that is showing up properly also has the same values. \"CompassionWeb 10507 to 10508.migrationScript\" shows:
<MigrationScript version=\"2\" type=\"MigrationScript\">
<Name>CompassionWeb 10507 to 10508</Name>
<FromVersion version=\"1\" type=\"VersionInfoRaw\">
<Version>10507</Version>
<ScriptFolderLocation>&lt;?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?&gt;
&lt;!----&gt;
&lt;ISOCCompareLocation version=\"1\" type=\"TfsLocation\"&gt;
&lt;ServerUrl&gt;https://tfs.ci.org:8143/tfs/&lt;/ServerUrl&gt;
&lt;SourceControlFolder&gt;$/Compassion.com/Source - Database/Dev/CompassionWeb&lt;/SourceControlFolder&gt;
&lt;/ISOCCompareLocation&gt;</ScriptFolderLocation>
</FromVersion>
<ToVersion version=\"1\" type=\"VersionInfoRaw\">
<Version>10508</Version>
<ScriptFolderLocation>&lt;?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?&gt;
&lt;!----&gt;
&lt;ISOCCompareLocation version=\"1\" type=\"TfsLocation\"&gt;
&lt;ServerUrl&gt;https://tfs.ci.org:8143/tfs/&lt;/ServerUrl&gt;
&lt;SourceControlFolder&gt;$/Compassion.com/Source - Database/Dev/CompassionWeb&lt;/SourceControlFolder&gt;
&lt;/ISOCCompareLocation&gt;</ScriptFolderLocation>


Does any of that help you? I'm at a loss right now. I'm considering undoing all the DB changes, then changing them back and trying it over again - but I'm a little concerned that will cause other problems.
AdamY
 
Posts: 41
Joined: Fri Oct 15, 2010 8:24 pm

Resolved!

Postby AdamY » Thu May 30, 2013 11:22 pm

I unlinked the database from TFS, then relinked it (using the same location for Migration Scripts and the db code as I did before). Everything seems okay now. Looks like it just needed a "reboot".

IT Crowd says it best: http://youtu.be/p85xwZ_OLX0
Last edited by AdamY on Fri May 31, 2013 4:35 pm, edited 1 time in total.
AdamY
 
Posts: 41
Joined: Fri Oct 15, 2010 8:24 pm

Postby Chris Auckland » Fri May 31, 2013 3:59 pm

Thanks for your reply. The good old turn it off and on again trick to the rescue.

I hope it behaves from now on.
Chris
Chris Auckland
 
Posts: 757
Joined: Tue Oct 24, 2006 2:12 pm
Location: Red Gate Software Ltd.


Return to SQL Source Control 3

Who is online

Users browsing this forum: Wakwau and 1 guest