Skip to content

Commit

Permalink
Merge 1ca3c6d into 458c27b
Browse files Browse the repository at this point in the history
  • Loading branch information
triadev authored Oct 19, 2018
2 parents 458c27b + 1ca3c6d commit fa2db56
Show file tree
Hide file tree
Showing 108 changed files with 2,034 additions and 5,446 deletions.
35 changes: 0 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,41 +41,6 @@ Elasticsearch migration for laravel.
The package is registered through the package discovery of laravel and Composer.
>https://laravel.com/docs/5.6/packages
## Configuration
| Key | ENV | Value | Description |
|:-------------:|-------------:|:-------------:|:-----:|
| host | ELASTICSEARCH_HOST | STRING | Host |
| port | ELASTICSEARCH_PORT | INTEGER | Default: 9200 |
| scheme | ELASTICSEARCH_SCHEME | STRING | https or http |
| user | ELASTICSEARCH_USER | STRING | Username |
| pass | ELASTICSEARCH_PASS | STRING | Password |
| migration.filePath | --- | STRING | File path for migration scripts |

## Usage

### Build migration
>Triadev\EsMigration\Business\Factory\MigrationBuilder::TYPE()
- createIndex
- updateIndex
- deleteIndex
- alias
- reindex
- deleteByQuery
- updateByQuery

### Commands

#### Start migration
Orchestra migrations
>php artisan triadev:elasticsearch:migrate:start VERSIONS
Example:
>php artisan triadev:elasticsearch:migrate:start migration1,migration2,migration3
#### Show migrations
>php artisan triadev:elasticsearch:migration:show
### Events
[Documentation: Laravel Events](https://laravel.com/docs/5.7/events)

Expand Down
13 changes: 0 additions & 13 deletions examples/addAndRemoveAlias/migrations.php

This file was deleted.

36 changes: 0 additions & 36 deletions examples/createAndUpdateIndex/migrations.php

This file was deleted.

19 changes: 0 additions & 19 deletions examples/createIndex/migrations.php

This file was deleted.

16 changes: 0 additions & 16 deletions examples/deleteByQuery/migrations.php

This file was deleted.

5 changes: 0 additions & 5 deletions examples/deleteIndex/migrations.php

This file was deleted.

9 changes: 0 additions & 9 deletions examples/reindex/migrations.php

This file was deleted.

20 changes: 0 additions & 20 deletions examples/updateByQuery/migrations.php

This file was deleted.

21 changes: 0 additions & 21 deletions examples/updateIndex/migrations.php

This file was deleted.

1 change: 1 addition & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="ELASTICSEARCH_PORT" value="9222"/>
</php>
</phpunit>
152 changes: 0 additions & 152 deletions src/Business/Factory/MigrationBuilder.php

This file was deleted.

32 changes: 32 additions & 0 deletions src/Business/Mapper/MigrationStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
namespace Triadev\EsMigration\Business\Mapper;

class MigrationStatus
{
const MIGRATION_STATUS_WAIT = 0;
const MIGRATION_STATUS_RUNNING = 1;
const MIGRATION_STATUS_DONE = 2;
const MIGRATION_STATUS_ERROR = 3;

/**
* Is migration status valid
*
* @param int $status
* @return bool
*/
public function isMigrationStatusValid(int $status) : bool
{
$valid = [
self::MIGRATION_STATUS_WAIT,
self::MIGRATION_STATUS_RUNNING,
self::MIGRATION_STATUS_DONE,
self::MIGRATION_STATUS_ERROR
];

if (in_array($status, $valid)) {
return true;
}

return false;
}
}
Loading

0 comments on commit fa2db56

Please sign in to comment.