Skip to content
This repository was archived by the owner on Nov 4, 2021. It is now read-only.

Commit 9ef326c

Browse files
committed
Rename elastic:migrate command to be compatible with Elastic Migrations package
1 parent b030768 commit 9ef326c

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ elastic:create-index | `index-configurator` - The index configurator class | Cre
327327
elastic:update-index | `index-configurator` - The index configurator class | Updates settings and mappings of an Elasticsearch index.
328328
elastic:drop-index | `index-configurator` - The index configurator class | Drops an Elasticsearch index.
329329
elastic:update-mapping | `model` - The model class | Updates a model mapping.
330-
elastic:migrate | `model` - The model class, `target-index` - The index name to migrate | Migrates model to another index.
330+
elastic:migrate-model | `model` - The model class, `target-index` - The index name to migrate | Migrates model to another index.
331331

332332
For detailed description and all available options run `php artisan help [command]` in the command line.
333333

@@ -483,7 +483,7 @@ As you might know, you can't change the type of already created field in Elastic
483483
The only choice in such case is to create a new index with necessary mapping and import your models into the new index.
484484
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.
485485
As soon as migration is over it starts reading from the new index and removes the old index.
486-
This is how the artisan `elastic:migrate` command works.
486+
This is how the artisan `elastic:migrate-model` command works.
487487

488488
Before you run the command, make sure that your index configurator uses the `ScoutElastic\Migratable` trait.
489489
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
492492
php artisan elastic:update-index "App\MyIndexConfigurator"
493493
```
494494

495-
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:
495+
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:
496496

497497
```
498-
php artisan elastic:migrate "App\MyModel" my_index_v2
498+
php artisan elastic:migrate-model "App\MyModel" my_index_v2
499499
```
500500

501501
Note, that if you need just to add new fields in your mapping, use the `elastic:update-mapping` command.

src/Console/ElasticMigrateCommand.php renamed to src/Console/ElasticMigrateModelCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use ScoutElastic\Payloads\RawPayload;
1212
use Symfony\Component\Console\Input\InputArgument;
1313

14-
class ElasticMigrateCommand extends Command
14+
class ElasticMigrateModelCommand extends Command
1515
{
1616
use RequiresModelArgument {
1717
RequiresModelArgument::getArguments as private modelArgument;
@@ -20,7 +20,7 @@ class ElasticMigrateCommand extends Command
2020
/**
2121
* {@inheritdoc}
2222
*/
23-
protected $name = 'elastic:migrate';
23+
protected $name = 'elastic:migrate-model';
2424

2525
/**
2626
* {@inheritdoc}

src/ScoutElasticServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use ScoutElastic\Console\ElasticIndexCreateCommand;
1111
use ScoutElastic\Console\ElasticIndexDropCommand;
1212
use ScoutElastic\Console\ElasticIndexUpdateCommand;
13-
use ScoutElastic\Console\ElasticMigrateCommand;
13+
use ScoutElastic\Console\ElasticMigrateModelCommand;
1414
use ScoutElastic\Console\ElasticUpdateMappingCommand;
1515
use ScoutElastic\Console\IndexConfiguratorMakeCommand;
1616
use ScoutElastic\Console\SearchableModelMakeCommand;
@@ -40,7 +40,7 @@ public function boot()
4040
ElasticIndexUpdateCommand::class,
4141
ElasticIndexDropCommand::class,
4242
ElasticUpdateMappingCommand::class,
43-
ElasticMigrateCommand::class,
43+
ElasticMigrateModelCommand::class,
4444
]);
4545

4646
$this

0 commit comments

Comments
 (0)