0

We are using SSDT to create DACPAC and publish database changes. Our team is new to SSDT so we are generating the script first and manually verify it before publishing.

Currently it generates only a single sql script file with list of all changes. Is it possible to generate individual sql files for each database object so it is easier to review/verify?

Example: If procedure A and procedure B have been modified then it generate a script having both Procedure A and Procedure B alter statements. Is it possible to generate ProcedureA.sql and ProcedureB.sql files instead so it is easier to identify that they have been updated?

developer
  • 1,401
  • 4
  • 28
  • 73
  • What do you mean? When you run publish for the project in VS it generates the script for single database. – Dmitrij Kultasev Jun 26 '19 at 07:25
  • 1
    I meant, generate script command creates only one sql script having all the changes. Is it possible to change it to generate individual scripts? I have added an example above. – developer Aug 12 '19 at 09:35
  • 1
    I afraid you can't do that. What I've found is making easier to review the script are: 1) release frequently; 2) We are running powershell script that removes all noise from the deployment script and normally it has ONLY changes going to be deployed. For example remove all post/pre scripts that were executed already. – Dmitrij Kultasev Aug 12 '19 at 09:51
  • I see, I thought so. I will try your suggested points. Thanks. I have another question, how do you archive/remove a branch specific post deployment script after it has been deployed on production environment? – developer Aug 12 '19 at 10:12
  • 1
    we store all executed scripts in the log table, then in the pre/post script we check if that script was executed already or not. If needed can provide sample script – Dmitrij Kultasev Aug 12 '19 at 10:24
  • that's a very useful idea - it will work for my requirements too. Could you pls share the sample script? Thanks. – developer Aug 12 '19 at 10:37
  • Can you then please create the right question then? I mean something like "Ignore already executed pre/post scripts" or something like that? If I'll post the answer here it won't be relevant to that question... Maybe somebody would suggest better idea so it would be useful for me also :) – Dmitrij Kultasev Aug 12 '19 at 10:40
  • Sure, it will be useful for others too. – developer Aug 12 '19 at 11:24
  • https://stackoverflow.com/questions/57460337/ssdt-post-deployment-scripts – developer Aug 12 '19 at 11:28

0 Answers0