Pages

Thursday, January 3, 2019

Pre-Deployment scripts executed after dacpac compares and generates changes scripts

If you deploy your database with TFS,
You probably use Pre-Deployment and Post-Deployment scripts

The important thing to note is that the process is:

  1. sqlpackage compares the dacpac to the database and generates a list of changes to make
  2. Pre-Deployment scripts executed
  3. Auto generated script of changed executed (from point #1)
  4. Post-Deployment scripts executed


As you can see,
The Pre-Deployment scripts are not actually 
executed before the compare.

Let`s suppose you want to execute the Pre-Deployment
scripts before sqlpackage compares the dacpac 
to the database and generates a list of changes to make.

What you can do is to add a step that will execute the scripts
in the Pre-Deployment folder
Before executing the step of sqlpackage.
By this, the ‘compare’ will be
done after the Pre-Deployment scripts were executed.

No comments:

Post a Comment