Search code examples
sql-servervisual-studiodeploymentversion-controlsql-server-data-tools

SSDT How to: Deploy .dacpac without losing custom client database objects?


I'm using the Database project in Visual Studio.

In my scenario I have customers who intuitively customize the database I provide for them.

For example, the client contracts a third party to create a customized system for them, then this third creates some tables in my database.

I know I should never allow third party access to my database but the company I'm working they allow this.

How can I make when deploying .dacpac these objects that are not part of my schema are not excluded? I think this probably is not possible, what can I do in this case?


Solution

  • It is possible, and often very useful. There are probably objects in your target that you do not want to drop. We Always drop our objects in our production dbs in a controlled fashion (not automatically), using a separate drop-script.

    There is an msbuild parameter not to drop objects found in target but not in source. Just use parameter "Drop objects in target but not in Project" to false. This setting will leave those objects untouched. The option is also there when publishing from within VS.

    DropObjectsNotInSource=FALSE