phinx icon indicating copy to clipboard operation
phinx copied to clipboard

Reference a migration from other

Open CauanCabral opened this issue 5 years ago • 1 comments

Use case:

Migration A: xxxxx_create_table_orders.php Many migrations and months later Migration Z: xxxxx_drop_table_orders.php

To make migration Z reversible, I need to implement up and down methods.

The up have a drop() call, so, on down I need a create() counterpart, with all my schema.

Suggestion

If we have one method to call from down witch run the migration A::up (or change) would be great. Something like:

public function down() {
    $this->use('create_table_orders');
}

I know there are limitations: if you have changed anything into table between the two migrations, that will be loose. But I think that can be advertised on docs.

CauanCabral avatar Nov 01 '19 20:11 CauanCabral

Do you want to make a PR for it?

dereuromark avatar Dec 08 '19 13:12 dereuromark