Skip to content

Generate preview of SQL that will be executed by bundle #27723

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
davidkeaveny opened this issue Mar 29, 2022 · 4 comments
Open

Generate preview of SQL that will be executed by bundle #27723

davidkeaveny opened this issue Mar 29, 2022 · 4 comments

Comments

@davidkeaveny
Copy link

The EF Core bundle looks to be very helpful for simplifying automated deployment scenarios; however, it's still a bit of a black box as to what is going to happen when the bundle gets executed against a specific server. It would be very helpful to have the bundle generate the SQL script that is about to execute and return that, so that it can be reviewed e.g. by the DBA in a manual approval step in the build pipeline. Once approval is granted, then the bundle gets run for real.

I'm imagining something along the lines of efbundle --dry-run this-needs-approval.sql, which would check the migrations history of the destination database, and write out the to-be-executed migrations to the named file. This could then be picked up and published by the deployment pipeline (such as Azure DevOps or Octopus Deploy) and the build paused until the SQL script is reviewed; then efbundle can be executed without the --dry-run option, and the code will be executed.

https://octopus.com/blog/dbup-database-deployment-automation gives a nice example of how this can already be achieved using DbUp with a more full-featured report on what has changed, so not just the combined SQL script but scripts grouped by migration etc

@ajcvickers
Copy link
Contributor

See also #25872.

@sk-shahnawaz

This comment was marked as resolved.

@roji

This comment was marked as resolved.

@gls-psteiner
Copy link

This is a great idea and I imagine most developers and DBAs would welcome this change. Other organizations I've worked for required that any migration script be reviewed by a DBA - which, as far as I can tell, isn't possible yet with EF bundle. But it's also something that would be very useful to developers as a gut check before running a script blindly. Thanks for posting this suggestion.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

6 participants