Friday, July 24, 2020

How to don’t go mad with schema compare in SSDT

SSDT (SQL Server Data Tools) is really great to manage database schema changes. However, due to a disappeared feature, SSDT can make you go mad very easily.

The schema compare has a lot of configurations. A really lot of configurations. You start the schema compare using the right-click on the SSDT project, but if you forget to tune the configurations in the way you like, you will end up with a script drop or creating objects that you never had intention to change, such as SQL Server logins or user permissions on the database.

As soon you get into the schema compare screen, you need to use the settings button to choose which objects will be part of the configuration and which ones will not, and also many comparison rules about what the script can or can’t do, such as delete your data.

In the past, it was easy to deal with these configurations: Inside the Visual Studio options (menu Tools -> Options) you could select the default configuration options you would like to use for the schema compare and that’s it, you would have always the same options.

Only God knows why the option to define the default configuration disappeared after Visual Studio 2010. It’s just not there anymore, so everytime you start a new schema compare you need to use the settings button to configure all the options again and again and again.

However, there is a simple and interesting way to avoid this: If you make the configuration once and, instead of making the comparison, you save the schema compare, you can edit the saved file and remove the source and target information.

As a result, you end up with a file containing all the options you choosed for the schema compare. From this point, you never again starts a schema compare from the right-click on the SSDT project. You will start the schema compare always opening your new configuration file, with all the options already set for you, allowing you to keep your mental health.

The post How to don’t go mad with schema compare in SSDT appeared first on Simple Talk.



from Simple Talk https://ift.tt/2CBDj2J
via

No comments:

Post a Comment