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

Support database table rollbacks #40

Open
ashleyfae opened this issue Apr 28, 2020 · 6 comments
Open

Support database table rollbacks #40

ashleyfae opened this issue Apr 28, 2020 · 6 comments
Labels
workflow-needs-research Needs to be researched

Comments

@ashleyfae
Copy link
Contributor

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.

@JJJ
Copy link
Collaborator

JJJ commented May 3, 2020

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!

@alexstandiford
Copy link
Collaborator

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.

@ashleyfae
Copy link
Contributor Author

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() {}
}

@JJJ
Copy link
Collaborator

JJJ commented May 5, 2021

@ashleyfae
Copy link
Contributor Author

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.

@JJJ JJJ added the workflow-needs-research Needs to be researched label Sep 21, 2021
@Mte90
Copy link

Mte90 commented Jul 6, 2022

There are some updates about it? I see that some plugin that use berlindb have something for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
workflow-needs-research Needs to be researched
Projects
None yet
Development

No branches or pull requests

4 participants