Upgrading To 6.x from 5.x
High-Impact Changes
- Updating Dependencies
- Changed the namespace
- Changed the name of the main class
- Changed names of console commands
- Changed event names
- Configuration file name changed
Minor-Impact Changes
- Changed directory location
- Database transactions
- Removed
$async
property - Removed
operations:stub
command - Changed property typing for events
Low-Impact Changes
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:
composer remove dragon-code/laravel-actions
composer require dragon-code/laravel-deploy-operations:^6.0
php artisan operations:upgrade
php artisan migrate
It will do the following:
- Changing the old namespace of “actions” to a new one
- Moves files to a new location
- Updates the configuration file
- Rename the stub file (if published)
Please note that the script allows you to automate most of the actions, but may not complete them completely. Therefore, you will need to manually check the result of the upgrade by checking this guide.
Updating Dependencies
You should change the package name in the composer.json
file from dragon-code/laravel-actions
to dragon-code/laravel-deploy-operations
, and also change its version to ^6.0
:
{
"require": {
// ...
"dragon-code/laravel-deploy-operations": "^6.0"
}
}
Then you need to update the dependencies:
composer update
Changed the namespace
The namespace has been changed from DragonCode\LaravelActions
to DragonCode\LaravelDeployOperations
.
You need to replace it in all actions of your application, as well as when using events.
Changed the name of the main class
You should replace DragonCode\LaravelActions\Action
namespace with DragonCode\LaravelDeployOperations\Operation
.
Changed names of console commands
New Name | Old Name |
---|---|
make:operation | make:action |
operations | actions |
operations:fresh | actions:fresh |
operations:install | actions:install |
operations:refresh | actions:refresh |
operations:reset | actions:reset |
operations:rollback | actions:rollback |
operations:status | actions:status |
operations:stub | actions:stub |
operations:upgrade | actions:upgrade |
Changed event names
New Name | Old Name |
---|---|
DeployOperationStarted | ActionStarted |
DeployOperationEnded | ActionEnded |
DeployOperationFailed | ActionFailed |
NoPendingDeployOperations | NoPendingActions |
Don't forget to also change the namespace from DragonCode\LaravelActions\Events
to DragonCode\LaravelDeployOperations\Events
.
Changed property typing for events
The type of the method
property for events has been changed.
Before:
use DragonCode\LaravelActions\Events\ActionEnded;
use DragonCode\LaravelDeployOperations\Enums\MethodEnum;
/** @var ActionEnded */
$event->method; // is string
After:
use DragonCode\LaravelDeployOperations\Enums\MethodEnum;
use DragonCode\LaravelDeployOperations\Events\DeployOperationEnded;
/** @var DeployOperationEnded */
$event->method; // is MethodEnum
Configuration file name changed
We recommend that you delete the old configuration file config/actions.php
and publish a new one. This way you will see the changes made to it.
php artisan vendor:publish --provider="DragonCode\LaravelDeployOperations\ServiceProvider"
Changed names of constants
If you use package constant references, you must also rename them.
The old name was in UPPER_CASE
, the new one was in PascalCase
.
For example:
// Old
class Names
{
public const ACTIONS = 'actions';
public const FRESH = 'actions:fresh';
// ...
}
// New
class Names
{
public const Operations = 'operations';
public const Fresh = 'operations:fresh';
// ...
}
Changed directory location
File storage directory changed to operations
from actions
.
Database transactions
The following properties have been removed:
$transactions
$transactionAttempts
Instead, you can use the hasTransactions
and transactionAttempts
methods.
The enabledTransactions
method has been renamed to hasTransactions
.
Removed $async
property
The $async
property has been removed from the base class. You can use the previously available isAsync
method instead.
Stub name changed
If you published a stub file, then you also need to rename it from stubs/action.stub
to stubs/deploy-operation.stub
and make changes to its structure.
Removed operations:stub
command
The php artisan operations:stub
console command has been removed. Use another command instead:
php artisan vendor:publish --tag=stubs --provider="DragonCode\LaravelDeployOperations\ServiceProvider"