question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

It would be great to have a rollback feature so that the schema can be rolled back to a specific migration. The functionality could be similar to EF migrations rollback.

Here’s the intended functionality:

Assume there are 4 migration scripts 1.1, 1.2, 1.3, 1.4

When migrate command is executed with a specific version e.g. 1.3 all migrations greater than that (1.4) will be rolled back by executing the corresponding rollback script. This means, in addition to the migrations directory, users need to provide a rollback directory with the rollback scripts (Similar to Up() and Down() methods in EF).

This functionality will be similar to EF Update-Database command.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:10
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
IndikaUdagedaracommented, Mar 28, 2018

Thanks @lecaillon

The use case is actually to get the db back to a stable state after a faulty migration. E.g. migration 1.4 broke something (although got successfully applied) so need to revert back to 1.3. I guess this could be achieved by rolling forward i.e. deploying a new 1.5 script to revert the changes in 1.4 but having a rollback feature would make it convenient for CI/CD. The steps would be

  • Run migration x
  • Run tests
  • If tests fail revert x, otherwise mark the deployment as success
3reactions
IndikaUdagedaracommented, Feb 17, 2020

We found DB migration rollbacks is problematic (although it sounds a nice feature). We ended up with

  • ensuring database changes are always backward compatible
  • rolling forward i.e. instead of rolling back a previous one, create a new migration with
Read more comments on GitHub >

github_iconTop Results From Across the Web

Rollback (data management)
In SQL, ROLLBACK is a command that causes all data changes since the last START TRANSACTION or BEGIN to be discarded by the...
Read more >
Rollback as an Agile Strategy
Rollback as an Agile Strategy ... Rollback is downgrading the current version of a software component to the previous one. This usually happens ......
Read more >
ROLLBACK TRANSACTION (Transact-SQL) - SQL Server
You can use ROLLBACK TRANSACTION to erase all data modifications made from the start of the transaction or to a savepoint.
Read more >
[WP Rollback] Support | WordPress.org
Topic; Voices; Replies; Last Post. Rollback not sticking? Started by: aricvanselous. 2; 1; 2 weeks, 2 days ago · Matt Cromwell.
Read more >
Liquibase Rollback Workflow
Note: Rollback support is available in command line, Ant, and Maven. ... There are several ways to revert your changes with the rollback-to-date...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found