Skip to content

Commit 01e31c1

Browse files
Update docs
1 parent e8fe66c commit 01e31c1

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

docs/how-to-use/running.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ bar/2022_10_14_000003_test3 # 3
2222
2022_10_14_000004_test4 # 4
2323
```
2424

25+
## Isolating Action Execution
26+
27+
If you are deploying your application across multiple servers and running migrations as part of your deployment process, you likely do not want two servers attempting to migrate
28+
the database at the same time. To avoid this, you may use the `isolated` option when invoking the `migrate:actions` command.
29+
30+
When the `isolated` option is provided, Laravel will acquire an atomic lock using your application's cache driver before attempting to run your migrations. All other attempts to
31+
run the `migrate:actions` command while that lock is held will not execute; however, the command will still exit with a successful exit status code:
32+
33+
```bash
34+
php artisan migrate:actions --isolated
35+
```
36+
2537
## Split Launch Option
2638

2739
Sometimes it becomes necessary to launch actions separately, for example, to notify about the successful deployment of a project.
@@ -39,7 +51,7 @@ For backwards compatibility, the `before` parameter is set to `true` by default,
3951
```php
4052
use DragonCode\LaravelActions\Action;
4153

42-
return new class () extends Action
54+
return new class extends Action
4355
{
4456
protected $before = false;
4557

@@ -95,7 +107,7 @@ To do this, override the `$once` variable in the action file:
95107
```php
96108
use DragonCode\LaravelActions\Action;
97109

98-
return new class () extends Action
110+
return new class extends Action
99111
{
100112
protected $once = false;
101113

@@ -123,7 +135,7 @@ For this you can use the `$environment` parameter:
123135
```php
124136
use DragonCode\LaravelActions\Action;
125137

126-
return new class () extends Action
138+
return new class extends Action
127139
{
128140
/** @var string|array|null */
129141
protected $environment = 'production';
@@ -140,7 +152,7 @@ You can also specify multiple environment names:
140152
```php
141153
use DragonCode\LaravelActions\Action;
142154

143-
return new class () extends Action
155+
return new class extends Action
144156
{
145157
/** @var string|array|null */
146158
protected $environment = ['testing', 'staging'];
@@ -163,7 +175,7 @@ For this you can use the `$except_environment` parameter:
163175
```php
164176
use DragonCode\LaravelActions\Action;
165177

166-
return new class () extends Action
178+
return new class extends Action
167179
{
168180
/** @var string|array|null */
169181
protected $exceptEnvironment = 'production';
@@ -180,7 +192,7 @@ You can also specify multiple environment names:
180192
```php
181193
use DragonCode\LaravelActions\Action;
182194

183-
return new class () extends Action
195+
return new class extends Action
184196
{
185197
/** @var string|array|null */
186198
protected $exceptEnvironment = ['testing', 'staging'];
@@ -205,7 +217,7 @@ will reduce the time it takes to create the action.
205217
```php
206218
use DragonCode\LaravelActions\Action;
207219

208-
return new class () extends Action
220+
return new class extends Action
209221
{
210222
protected $transactions = true;
211223

0 commit comments

Comments
 (0)