[11.x] Support wiping config stated databases #51503
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on issues [ #42047, #21009 ] and pull request [ #30656 ] :
This pull request suggestion propose a light addition to allow wiping multiple databases if stated in config file.
When using multiple databases in a Laravel project, using the
migrate:fresh
command will systematically return an error because of second database not being wiped before re-running migrations. Only the default connection database will be wiped.This PR propose a config value named
database.wipes
that is empty by default. If this one collects the different connection database names and thedb:wipe
command has no--database
option, thisdatabase.wipes
config variable will be taken into account and wipe the databases indicated in the config variable.config/database.php
src/Illuminate/Database/Console/WipeCommand.php
This can also help prevent the
RefreshDatabase
trait to fail when using multiple databases too.This might be problematic for people having already used a custom
database.wipes
config variable. But I suppose adding new config variables always lead to some probable issues like this. Otherwise this shouldn't cause issues to existing projects.What are your thoughts on this? I hope it helps