Closed stevebauman closed 3 years ago
Okay I've updated my PR. Everything's green.
Note -- I had to remove the final
class declaration of the MigrationRepository
so I could successfully test the FreshCommand
.
Hey @stevebauman, the new command is available since v1.6.0 š
@babenkoivan You forgot to add it to the ServiceProvider commands array. (Currently its still not available as artisan command)
@christian-at-7lab ah.. what a shame! thank you for pointing it out! it's fixed now in v1.6.1
.
Thanks @babenkoivan! Appreciate your time š
Purpose
This PR adds the
elastic:migrate:fresh
command. It mirrors Laravel'smigrate:fresh
command, which drops all database tables and re-runs all migrations. In this case, we drop all indicies and re-run migrations.Description
When I'm running my integration tests that use ElasticSearch, I'm unable to use any provided command to drop all of the (non-system) indicies with an empty
elastic_migrations
table. If I need to drop any index, I have to use a raw command, or insert the migration into the DB table manually and then runelastic:migrate:rollback
.This would allow us to easily use the below in our integration tests, making sure we have a completely fresh ES instance to work with during each test-case:
More Info
The pattern used here:
Will fetch all non-system indicies (ones that are prefixed with a period), excluding indexes such as Kibana indexes (
.kibana
,.kibana_task_manager
).Dependents
This PR relies on the recently submitted PR here:
https://github.com/babenkoivan/elastic-adapter/pull/12
As always, please let me know if you have any issues with the implementation. I'd love to work with you to get this implemented.
Thanks for your time! ā¤ļø