Skip to content

Updated upgrade documentation #146

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

Merged
merged 2 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions docs/prologue/upgrade-guide/3.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@
- [Changing the name of an action column in the database](#changed-action-repository)
- [Action storage directory changed](#actions-location)

### Call Upgrade Command
## The easiest way to upgrade

> Note
> If you used inheritance of actions from other actions, then you will need to process these files manually.

For your convenience, we have created an upgrade console command:

```bash
composer require dragon-code/laravel-migration-actions:^3.0
php artisan migrate:actions:upgrade
php artisan migrate
```

It will do the following:
Expand All @@ -34,6 +36,7 @@ It will do the following:
- Replace the `up` method with `__invoke` if the class does not have a `down` method
- Replace named classes with anonymous ones
- Create a configuration file according to the data saved in your project
- Changes properties from `snake_case` to `camelCase`

## Updating Dependencies

Expand All @@ -45,7 +48,7 @@ Laravel Actions now requires PHP 8.0.2 or greater.

You should update the following dependency in your application's `composer.json` file:

- `dragon-code/laravel-actions` to `^3.0`
- `dragon-code/laravel-migration-actions` to `^3.0`

## Configuration

Expand All @@ -57,7 +60,8 @@ php artisan vendor:publish --provider="DragonCode\LaravelActions\ServiceProvider

## Actions Location

Move the action files to the `actions` folder in the project root, or update the `actions.path` option in the configuration file.
Move the action files to the `actions` folder in the project root, or update the `actions.path` option in the
configuration file.

## Parent Namespace

Expand Down Expand Up @@ -93,14 +97,14 @@ Just call the `php artisan migrate` command to make changes to the action reposi

Make sure all overridden properties are typed:

```
protected $once >> protected bool $once
protected $transactions >> protected bool $transactions
protected $transaction_attempts >> protected int $transactionAttempts
protected $environment >> protected string|array|null $environment
protected $except_environment >> protected string|array|null $exceptEnvironment
protected $before >> protected bool $before
```
| Old Name | New Name |
|---------------------------------|--------------------------------------------------|
| protected $once | protected bool $once |
| protected $transactions | protected bool $transactions |
| protected $transaction_attempts | protected int $transactionAttempts |
| protected $environment | protected string\|array\|null $environment |
| protected $except_environment | protected string\|array\|null $exceptEnvironment |
| protected $before | protected bool $before |

## Added recursive search for actions in a folder

Expand Down
27 changes: 24 additions & 3 deletions docs/prologue/upgrade-guide/4.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### High Impact Changes

- [Renamed project namespace](#renamed-project-namespace)
- [Rename package name](#rename-package-name)
- [Changing the names of console commands](#changing-the-names-of-console-commands)

### Medium Impact Changes
Expand All @@ -13,7 +13,27 @@

- [Changed the default name of the table for storing actions](#changed-the-default-name-of-the-table-for-storing-actions)

## Renamed project namespace
## The easiest way to upgrade

> Note
> If you used inheritance of actions from other actions, then you will need to process these files manually.

For your convenience, we have created an upgrade console command:

```bash
composer remove dragon-code/laravel-migration-actions
composer require dragon-code/laravel-actions:^4.0
php artisan actions:upgrade
php artisan migrate
```

It will do the following:

- Renaming manually invoked commands in a project to a new name

## Updating Dependencies

### Rename package name

You should update the following dependency in your application's `composer.json` file:

Expand Down Expand Up @@ -75,4 +95,5 @@ DragonCode\LaravelActions\Constants\Names::ACTIONS

The new table name is `actions`.

You can also specify any name in the application [settings](https://github.com/TheDragonCode/laravel-actions/blob/main/config/actions.php).
You can also specify any name in the
application [settings](https://github.com/TheDragonCode/laravel-actions/blob/main/config/actions.php).
2 changes: 1 addition & 1 deletion src/Processors/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected function getData(): array
protected function getStatusFor(array $completed, string $action): string
{
if ($batch = Arr::get($completed, $action)) {
return "[$batch] $this->statusRan";
return sprintf('[%s] %s', $batch, $this->statusRan);
}

return $this->statusPending;
Expand Down