'Get latest' & migration script problems
SteveS
Posts: 4
Hi,
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
Cheers
Steve
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
Cheers
Steve
Comments
See http://www.red-gate.com/MessageBoard/viewtopic.php?t=15886