'Get latest' & migration script problems

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

'Get latest' & migration script problems

Postby SteveS » Mon Oct 01, 2012 10:24 am


We're having trouble getting SSC to recognise that there are migration scripts to be included.

We have a database that is under source control with several migration scripts. The problem occurs when we want to start working on it on a fresh machine or database

Here are the steps that we are following:
1) Create a clean new database
2) Link it to existing db in source control
3) Click 'Get Latest'

The operation fails as it doesn't see there are migration scripts.

I think I know why this is happening...

As I understand, SSC relies on storing a version number in the extended properties of the database. It then uses that to determine whether the migration scripts are applicable or not.

However, for a fresh database that has just been linked to source control, these extended properties don't exist. As far as I see they only seem to get created once a successful commit or get is performed.

I've tried spoofing the extended properties, and using the database revision '1', but SSC doesn't seem to like this at all, throwing an exception
However repeating the step once it has failed seems to change something which then gets SSC to recognise that there are migration scripts to use. What it is, I don't know.

Shouldn't SSC be setting the extended properties when the database is first linked?
Otherwise I'm not sure how it knows which version it should be at.

Migration scripts are correctly picked up thereafter. The problem only occurs with a fresh database

Let me know if I'm doing something wrong, or you need more information

Posts: 2
Joined: Mon Oct 01, 2012 9:58 am

Postby CraigEddy » Tue Oct 02, 2012 2:52 am

This seems related to an issue I'm having with restoring from a database which is essentially a copy of the database I used to perform the initial commit, but which doesn't have any SQL Source Control information stored.

See http://www.red-gate.com/MessageBoard/viewtopic.php?t=15886
Posts: 24
Joined: Fri Sep 28, 2012 1:59 pm

Return to SQL Source Control Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests