Migration Script Rollbacks
The only obstacle I have with switching to SQL Source Control 3 as a complete solution to source controlling and deploying is its inability to rollback custom code in a Migration Script. I would like when creating a Migration Script the ability to create a Reverse Migration Script so that if I use SQL compare to roll a code push back to a previous version in source control, it will grab the reverse script the same way as it grabs the migration script currently when pushing.
For example, if my migration script has an update statement in it to modify some table data, I want to be able to put in the reverse migration script another update statement that will undo the changes of the first update. (in the case that I don't want to actually source control the data)
As we noted in https://redgate.uservoice.com/forums/39019-sql-source-control/suggestions/2299881-migrations-support-for-git-mercurial, we have stopped work on Migrations v2 beta.
Unfortunately, there are currently no plans to include migration script rollbacks alongside the forward migration scripts, but we are still watching this request with interest.
-
saul commented
This is a serious needed feature. this feature as doug said exists in Code First in EF.
-
doug commented
Sadly this is amazingly easy when using Code First in EF6, with a simple 'up'/ 'down' migration file. Which also means that all your SQL version control is now with your code and Red-Gate becomes every more irrelevant. So there is going to be a group of dinosaurs that are stuck in the SQL server realm and youngsters who just use whatever EF can connect to. Sure a EF6 query can take 600ms to run versa the same hand coded ado query being 40ms, but customers want faster code delivery and developer productivity, not faster execution.
It is a shame that Red-Gate is still living in the past somewhat :( -
Anonymous commented
Hi there, we are looking at moving to SQL Source Control from our existing inhouse script solution. - 15 seats.
We require the ability to us Reverse Migration Scripts. I noticed in the documentation in the above link (http://documentation.red-gate.com/display/MV2) there is no reference to reverse migration scripts - what is the status of this feature?
Thanks,
dave -
Luke commented
This has just come up in our latest sprint retrospective - developers are having to create rollback snippets for migration scripts and insert them manually into the appropriate section of a change script. Having this managed by SQL Source Control & SQL Compare would be a much nicer developer experience.