Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

RFC : Ability to temporarily block migrations. #494

Closed
rquadling opened this issue Feb 18, 2015 · 3 comments
Closed

RFC : Ability to temporarily block migrations. #494

rquadling opened this issue Feb 18, 2015 · 3 comments

Comments

@rquadling
Copy link
Collaborator

Hi.

You are developing away, creating migrations, testing migrating and rolling back and forth and all is working well.

You rollback a few to do some amendments to a now unmigrated migration (imagine you are working on a branch with other developers and, as yet, the migrations haven't taken place on the production DB, so any currently outstanding migrations can be edited before the branch is closed and committed to production).

But suddenly you realise you've gone back too far. And the particular migration that is happily being rolledback is that big one which does a LOT of data manipulation.

Well there goes the next hour waiting for the rollback to finish, just to migrate forward 1 step again.

It would be nice to add a breakpoint to which rollback will automatically stop whilst there is a breakpoint present.

So, I propose a new command ...

phinx breakpoint [-t|--target="..."]

If there is no target then the most recent migration will be assumed.

If a target is supplied and it exists, it will have the breakpoint set/unset, depending upon if the migration is already set to be the breakpoint.

The breakpoint will be stored in the phinxlog table (breakpoint bit not null default 0).

During migration or rollback if the migration has the breakpoint bit set, then migrate/rollback stops.

Theoretically, you could set a breakpoint on a unmigrated migration, this would stop the migration at that point, allowing you to rollback/forward between a set of migrations. May not be too useful, but would be a supported "feature".

One use case for us would be that when we are feature branching, we don't want to be able to play with the existing committed/deployed migrations and we haven't yet flushed them and rebuilt are base schema (we have our own way of doing this, but we are happily waiting for phinx to be able to do this!).

So, upon creating a new feature branch, we would phinx breakpoint and our new feature related migrations would be the only ones we could play with, no matter how far back we accidentally attempt to rollback.

I'd appreciate any comments/suggestions/alternative implementations/etc. on this.

Happy to do the work once some feedback is given to see if this is a useful feature as well as any ideas/use cases that I've not considered.

Regards,

Richard.

rquadling added a commit to rquadling/phinx that referenced this issue Feb 23, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Feb 23, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Mar 4, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Mar 4, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Mar 4, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Mar 6, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Apr 29, 2015
rquadling added a commit to rquadling/phinx that referenced this issue May 11, 2015
rquadling added a commit to rquadling/phinx that referenced this issue May 15, 2015
@rquadling
Copy link
Collaborator Author

No feedback? Is anyone out there?

rquadling added a commit to rquadling/phinx that referenced this issue Jun 1, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Jun 1, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Jun 4, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Jun 4, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Jun 8, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Jun 8, 2015
rquadling pushed a commit to rquadling/phinx that referenced this issue Jun 9, 2015
* feature/BreakpointSupport:
  Phinx is PHP >= 5.3 (currently failing in tests)
  Fix migrated call for STRICT_TRANS_TABLES environments.
  Allow rollback --force option to bypass breakpoint.
  Allow all breakpoints to be removed.
  Put the breakpoint message between the migrations. I think this looks a better placement.
  Initial implementation of a breakpoint for migration rollback. See cakephp#494 for the issue.
rquadling added a commit to rquadling/phinx that referenced this issue Jun 9, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Jun 14, 2015
rquadling pushed a commit to rquadling/phinx that referenced this issue Jun 14, 2015
* feature/BreakpointSupport:
  Phinx is PHP >= 5.3 (currently failing in tests)
  Fix migrated call for STRICT_TRANS_TABLES environments.
  Allow rollback --force option to bypass breakpoint.
  Allow all breakpoints to be removed.
  Put the breakpoint message between the migrations. I think this looks a better placement.
  Initial implementation of a breakpoint for migration rollback. See cakephp#494 for the issue.
rquadling added a commit to rquadling/phinx that referenced this issue Jun 23, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Jun 23, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Jul 6, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Jul 6, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Jul 15, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Jul 15, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Aug 4, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Aug 4, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Aug 24, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Sep 4, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Sep 4, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Sep 16, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Sep 28, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Sep 28, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Oct 22, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Oct 22, 2015
rquadling added a commit to rquadling/phinx that referenced this issue Nov 10, 2015
@pedanticantic
Copy link

This is a really great feature, as it stops accidental rollback of the entire set of database changes. It's really nice to have a safety net like this.

@rquadling
Copy link
Collaborator Author

Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants