Generate a SQL file instead of applying the changes to Database

197 views
Skip to first unread message

Chandu

unread,
Nov 1, 2016, 4:15:35 PM11/1/16
to DbUp Discuss
All,
At my work, for PROD environments all the changes to the database has to be provided to the DBA as SQL Scripts (running any custom executable -in this case happens to be dbUp; against PROD database by DBA is not allowed/restricted). 
Is there a way to generate a SQL file/s containing the changes instead of applying the changes directly against the Database (we are using SQL Server)?
Something similar to NHIbernate SchemaExport to a SQL file.

If this option doesnot exist, Would I be naive to say that the code @ https://github.com/DbUp/DbUp/blob/62f9c4fbbab1a3a4fc2db0beb6f9c35f6a92f019/src/DbUp/Support/SqlServer/SqlScriptExecutor.cs#L116 can be replaced with writing/appending to a file to generate the delta script?

I understand that journal update handling needs to be addressed as well (generate SchemaVersions updates etc.) 
-
Chandra


Darrell Tunnell

unread,
Nov 1, 2016, 4:56:11 PM11/1/16
to dbup-d...@googlegroups.com
I can imagine DbUp having the concept of "dry run" mode could be useful here. Where it wouldn't actually execute any scripts when in dry run mode, but just perhaps output / log the scripts it would have executed. 

--
You received this message because you are subscribed to the Google Groups "DbUp Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dbup-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chandu

unread,
Nov 1, 2016, 8:50:20 PM11/1/16
to DbUp Discuss
Thanks Darrell.
But 
I couldn't find an option for dry run (using version 3.3.5).

darrell...@gmail.com

unread,
Nov 1, 2016, 9:37:17 PM11/1/16
to DbUp Discuss

Yeah - there isn't currently a dry run feature in dbup as far as I know. I was just saying that I do think it would be a good feature to have in dbup (perhaps raise an issue on github and implement as a PR?).

Customising the classes you mentioned (the executor and the journal) to not actually execute the SQL but log it somewhere when in "dry run" mode sounds like it would work to me!

Get Outlook for Android

Reply all
Reply to author
Forward
0 new messages