Open ashleyfae opened 4 years ago
I agree, this would be pretty awesome.
I hadn't built the Table class with rollbacks in mind, so it may take a bit of effort and rethinking things to make it happen. That shouldn't stop us, though!
I wonder if an update would be best served as a class that is extended and instantiated? This would allow us to make abstract functions for both upgrading,and downgrading.
I wonder if an update would be best served as a class that is extended and instantiated? This would allow us to make abstract functions for both upgrading,and downgrading.
IIRC that's how Laravel does it.
class YourMigrationClass extends Migration {
/**
* Run the migration
*/
public function up() {}
/**
* Reverse the migration
*/
public function down() {}
}
Also see: https://make.wordpress.org/core/2021/05/03/feature-project-updates-on-updating-the-updaters/
Specifically outcomes 2 and 3. It talks about database migrations and rollbacks.
There are some updates about it? I see that some plugin that use berlindb have something for that
It would be cool to support rollbacks, kind of like Laravel does. For each table upgrade, you'd also write a rollback so you can go forward and go backwards to revert it.