What are the challenges you face when working across database platforms? Take the survey
Options

Preventing baseline from deploying via command line

I would like to prevent the scripts in my Baseline folder from being executed when I run MSBuild through the command line. I have applied semantic versioning on my project and have applied the setting in the sqlProj to set the baseline. This is the structure of my migrations folder:
Migrations
./1.0.0-Baseline
./. /0001_tables.sql
././0002_userDefinedFunctions.sql

./1.0.1-TestFeature
././0006_createTableTest.sql

I have tried using the BaselineUptoMigration argument however that hasn't seemed to make a difference. Here is a snippet of my MSBUILD
set-alias msb "$env:windir\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"
    exec { msb $readyRollDatabaseProject /p:TargetDatabase=$targetDb /p:TargetServer=$targetServer /p:DBDeployOnBuild=True /p:ShadowServer=$shadowServer /p:BaselineUptoMigration=0005_schemas.sql }
Tagged:

Comments

  • Options
    SimonDSimonD Posts: 2
    edited May 11, 2017 10:01PM
    I got it working now, I will explain what the problem was.

    I have three sqlProjects in my solution. When I right clicked on the second or third project and modified the value for 'Set the baseline for existing database....' it updated the first sqlProject in my solution. I am not sure why the properties page doesn't save correctly, also this is a recurring issue. I had to open the sqlProj file myself and modify these values to fix the problem:
    <DeployOnceUseSemver>True</DeployOnceUseSemver>
    <SemverInitialBaseline>True</SemverInitialBaseline>
    
  • Options
    Thanks very much for that thorough report, Simon. I've been able to reproduce the issue per those steps and have logged an issue record for this (#561). The team is now investigating and I'll report back once I have an update
    Daniel Nolan
    Product Manager
    Redgate Software
  • Options
    dnlnlndnlnln Posts: 234 Gold 2
    edited May 17, 2017 11:05PM
    Just a quick update on this: the team has found the cause of the issue with saving project settings in a multi-project solution and is now working on a fix. I'll update again once we know which release it will be in.
    Daniel Nolan
    Product Manager
    Redgate Software
Sign In or Register to comment.