Search code examples
sql-serverdatabaseversion-controlsql-server-data-tools

SSDT - How to: Incremental Updates?


I'm using the Database project in Visual Studio.

In my scenario I have several customers using different versions of the database.

For example, a customer who is in version 5 and another in version 7.

I make available an update to version 8.

The client version 5 should run the "cumulative" scripts (that update to version 6 and 7) before running the script that updates to version 8.

The client version 7 should run just what upgrade to version 8.

Is there any automatic way to do that today with the SSDT?


Solution

  • With msbuild: /p:GetVersion=CXXXX

    Form VS, get the specific version (right-click the Project in Solution Explorer) Before publishing.

    You run this against the two different targets, and the publish scripts will be created for the specified target (one per target).

    If you use a dacpac instead, the script is auto-generated at deploy-time from the dacpac, by comparing to the target. If yo want to deploy the same version you can use the same dacpac file on both targets, the generated script will be created specifically for each target.