I'm setting up database projects in Visual Studio for our existing databases and I wonder what the difference is between Schema Compare and Publish. For me Publish is a familiar term from using Visual Studio to develop web apis, desktop apps etc, but as it seems it would be possible to achieve the same functionality using Schema Compare I wonder why they are two implemented as separate things in Visual Studio.
CodePudding user response:
With a schema compare, you can more easily import changes from the database into your project or manually pick/choose what you want to compare. Useful for when you need to cherry-pick items from one side or another - or even compare two databases/dacpacs that aren't in a project at all.
Publish is designed to take the state of your project, compare that to a database, and push those changes. The Publish functionality includes the schema comparison portion, but then just picks up all differences and acts on them. It can also run the Pre/Post deploy scripts you have set up, which a Schema Compare doesn't do.