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

[11.x] Added an event that reports files being deleted when calling the schema:dump --prune command #53870

Merged
merged 3 commits into from
Dec 14, 2024

Conversation

andrey-helldar
Copy link
Contributor

@andrey-helldar andrey-helldar commented Dec 12, 2024

The art schema:dump console command is able to report the end of a job by sending the SchemaDumped event, but is unable to report file deletion if the command is called with the --prune parameter.

This PR adds a new event to implement this feature.

P.S.: I didn't find any tests to check both the art schema:dump command and the event, so I didn't add tests for the new event either.

P.S.2: The static analyzer error has nothing to do with my code :)

P.S.3: My case that started it all:

I am developing a package to export data from tables selected by the developer. Yesterday I added the ability to delete files, but I was surprised that in Laravel the SchemaDumped event doesn't contain a label when calling the console command with the --prune flag (and it shouldn't, because the essence of the event is related to the database schema, not to the files). That's why I decided to add a new event, called in case of launching a console command with the parameter of file trimming.

@taylorotwell
Copy link
Member

I'm not sure if I would call the event SchemaPruned. The migrations are what is pruned.

@taylorotwell taylorotwell marked this pull request as draft December 13, 2024 15:58
@andrey-helldar
Copy link
Contributor Author

andrey-helldar commented Dec 13, 2024

@taylorotwell, I couldn't think of anything better at the time. I thought the name SchemaFilesDeleted was a bit too long, but still more appropriate. Or MigrationsPruned. What do you think?

@andrey-helldar
Copy link
Contributor Author

I've started brainstorming for the best title. I'll be back with the final result.

@andrey-helldar
Copy link
Contributor Author

@taylorotwell I can't say that many people participated in the brainstorm, but one of the suggested names is MigrationsPruned. I think it is more suitable for the name of the event and better reflects its essence.

There were also some less popular names:

  • MigrationFilesPruned
  • MigrationFilesDeleted
  • MigrationsCleaned

I added a commit with the event name changed to MigrationsPruned.

@andrey-helldar andrey-helldar marked this pull request as ready for review December 14, 2024 16:48
@taylorotwell taylorotwell merged commit 83c3855 into laravel:11.x Dec 14, 2024
38 checks passed
@andrey-helldar andrey-helldar deleted the patch/2024-12-13/01-15 branch December 14, 2024 23:12
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