Migration reversible #8177

wants to merge 4 commits into


None yet
3 participants

marcandre commented Nov 11, 2012

The commit of this PR builds on those of #7627, but the need they both fulfill is independent. Both functionalities can be accepted/rejected independently.

It is currently impossible to create a change migration that has a some data processing that rely on schema changes. Indeed, when migrating down, the schema modifying methods will be recorded and only played back (inverted) after the data processing took place.

This PR aims at providing a mechanism to process data at the right moment and conditionally of the direction. Please see the documented example in marcandre/rails@migrati


steveklabnik commented Nov 11, 2012

This does not merge properly, and will need rebased.


marcandre commented Nov 12, 2012

@steveklabnik I've rebase both #7627 and this PR, but this won't last because changes to the Changelog (present in #7267) break the merge. Or am I missing something?

Ideally, #7627 will be accepted and merged, this would simplify looking at this PR.

@marcandre marcandre referenced this pull request Nov 12, 2012


Migration revert #7627


marcandre commented Nov 12, 2012

I should have mentioned that this PR also makes transaction{} invertible as its own inverse.

AFAIK, transaction add nothing in a migration (which is always inside one anyways), but this makes it easy to implement reversible.

@marcandre marcandre referenced this pull request Nov 19, 2012


Reversible commands #8267


steveklabnik commented Nov 19, 2012

this won't last because changes to the Changelog

Ah yes, damn Changelogs.


rafaelfranca commented Nov 19, 2012

Seems good to me, but need the documentation too.


steveklabnik commented Dec 15, 2012

@marcandre can you squash these commits? Since it seems you have the docs @rafaelfranca asked for, I think we can merge after that.


marcandre commented Dec 19, 2012

@tenderlove told me all 3 proposals were acceptable, so I'm closing this in favor of #8267

@marcandre marcandre closed this Dec 19, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment