diff --git a/README.md b/README.md index 56127e9..1b71ca1 100644 --- a/README.md +++ b/README.md @@ -327,7 +327,7 @@ elastic:create-index | `index-configurator` - The index configurator class | Cre elastic:update-index | `index-configurator` - The index configurator class | Updates settings and mappings of an Elasticsearch index. elastic:drop-index | `index-configurator` - The index configurator class | Drops an Elasticsearch index. elastic:update-mapping | `model` - The model class | Updates a model mapping. -elastic:migrate | `model` - The model class, `target-index` - The index name to migrate | Migrates model to another index. +elastic:migrate-model | `model` - The model class, `target-index` - The index name to migrate | Migrates model to another index. For detailed description and all available options run `php artisan help [command]` in the command line. @@ -483,7 +483,7 @@ As you might know, you can't change the type of already created field in Elastic The only choice in such case is to create a new index with necessary mapping and import your models into the new index. A migration can take quite a long time, so to avoid downtime during the process the driver reads from the old index and writes to the new one. As soon as migration is over it starts reading from the new index and removes the old index. -This is how the artisan `elastic:migrate` command works. +This is how the artisan `elastic:migrate-model` command works. Before you run the command, make sure that your index configurator uses the `ScoutElastic\Migratable` trait. If it's not, add the trait and run the artisan `elastic:update-index` command using your index configurator class name as an argument: @@ -492,10 +492,10 @@ If it's not, add the trait and run the artisan `elastic:update-index` command us php artisan elastic:update-index "App\MyIndexConfigurator" ``` -When you are ready, make changes in the model mapping and run the `elastic:migrate` command using the model class as the first argument and desired index name as the second argument: +When you are ready, make changes in the model mapping and run the `elastic:migrate-model` command using the model class as the first argument and desired index name as the second argument: ``` -php artisan elastic:migrate "App\MyModel" my_index_v2 +php artisan elastic:migrate-model "App\MyModel" my_index_v2 ``` Note, that if you need just to add new fields in your mapping, use the `elastic:update-mapping` command. diff --git a/src/Console/ElasticMigrateCommand.php b/src/Console/ElasticMigrateModelCommand.php similarity index 98% rename from src/Console/ElasticMigrateCommand.php rename to src/Console/ElasticMigrateModelCommand.php index 5c4db2e..9c966c6 100644 --- a/src/Console/ElasticMigrateCommand.php +++ b/src/Console/ElasticMigrateModelCommand.php @@ -11,7 +11,7 @@ use ScoutElastic\Payloads\RawPayload; use Symfony\Component\Console\Input\InputArgument; -class ElasticMigrateCommand extends Command +class ElasticMigrateModelCommand extends Command { use RequiresModelArgument { RequiresModelArgument::getArguments as private modelArgument; @@ -20,7 +20,7 @@ class ElasticMigrateCommand extends Command /** * {@inheritdoc} */ - protected $name = 'elastic:migrate'; + protected $name = 'elastic:migrate-model'; /** * {@inheritdoc} diff --git a/src/ScoutElasticServiceProvider.php b/src/ScoutElasticServiceProvider.php index ed9be97..9494106 100644 --- a/src/ScoutElasticServiceProvider.php +++ b/src/ScoutElasticServiceProvider.php @@ -10,7 +10,7 @@ use ScoutElastic\Console\ElasticIndexCreateCommand; use ScoutElastic\Console\ElasticIndexDropCommand; use ScoutElastic\Console\ElasticIndexUpdateCommand; -use ScoutElastic\Console\ElasticMigrateCommand; +use ScoutElastic\Console\ElasticMigrateModelCommand; use ScoutElastic\Console\ElasticUpdateMappingCommand; use ScoutElastic\Console\IndexConfiguratorMakeCommand; use ScoutElastic\Console\SearchableModelMakeCommand; @@ -40,7 +40,7 @@ public function boot() ElasticIndexUpdateCommand::class, ElasticIndexDropCommand::class, ElasticUpdateMappingCommand::class, - ElasticMigrateCommand::class, + ElasticMigrateModelCommand::class, ]); $this