Skip to content

Conversation

@shalvah
Copy link
Contributor

@shalvah shalvah commented Sep 24, 2021

This PR adds a --pretend option to model:prune, similar to the one for migrate. As prune is a potentially destructive command (a typo in a query could wipe out the wrong half of your database!), it's helpful to have an extra way to "sanity check" before committing.

The pretend option will print the number of records matching the prunable() query. (I considered printing out the query instead, as migrate's does, but that might be less useful, since it won't take chunking into account and might produce an expensive query.)

If this PR is accepted, I'll go ahead to update the docs.

@taylorotwell taylorotwell merged commit df9ea5d into laravel:8.x Sep 24, 2021
@shalvah shalvah deleted the pretend-prune branch September 24, 2021 18:11
@shalvah
Copy link
Contributor Author

shalvah commented Sep 24, 2021

Thanks; sending in a PR for the docs soon.

victorvilella pushed a commit to cdsistemas/framework that referenced this pull request Oct 12, 2021
* Add --pretend option for model:prune command

* Fix tests

* Fix code style
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