DEV Community

Discussion on: How to work with stored procedures and not die trying

Collapse
 
hardkoded profile image
Darío Kondratiuk

Thank you Jakob! I like how many of you are finding out the dots I left out :)

So yes, Script.PostDeployment.sql is a script used to populate a brand new database. In order to solve what you mentioned we use different configurations, besides "Debug" and "Release" we created a "deployDB" configuration.

We manually edit the sqlproj file to indicate we want to include Script.PostDeployment.sql only when the configuration is "deployDB".

In the CI instead of executing msbuild in "Release" we call it in "deployDB" mode "/p:Configuration=deployDB"

You could also do that to publish to production. You can create another configuration called, lets say "publishToProd", create your own PROD.PostDeployment.sql and there setup all the scripts you want to be executed when you publish that to prod.

I think this deserves another post :)