Skip to content

Conversation

@nexxai
Copy link

@nexxai nexxai commented Jan 15, 2026

Problem

It is possible to create a migration that has unintended consequences. Maybe you dropped the wrong column, maybe the index you added was wrong, etc.

Proposed solution

In this PR, I have added a configuration option that allows you to automatically run a backup before migrations are run. We default this to only running in the environment called production, although this is also configurable (in cases where the production environment is called something else).

We listen for the MigrationsStarted event that Laravel broadcasts prior to actually running any new migrations and do a DB-only backup to ensure that any destructive changes can be reverted.

The configuration is set to off by default so that users with large databases don't immediately see larger migration times without opting in to the feature.

@freekmurze
Copy link
Member

Thanks for your work. I'm going to pass on this to keep the package simple.

@freekmurze freekmurze closed this Jan 19, 2026
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

Successfully merging this pull request may close these issues.

2 participants