You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
+
25
37
## Split Launch Option
26
38
27
39
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,
39
51
```php
40
52
use DragonCode\LaravelActions\Action;
41
53
42
-
return new class () extends Action
54
+
return new class extends Action
43
55
{
44
56
protected $before = false;
45
57
@@ -95,7 +107,7 @@ To do this, override the `$once` variable in the action file:
95
107
```php
96
108
use DragonCode\LaravelActions\Action;
97
109
98
-
return new class () extends Action
110
+
return new class extends Action
99
111
{
100
112
protected $once = false;
101
113
@@ -123,7 +135,7 @@ For this you can use the `$environment` parameter:
123
135
```php
124
136
use DragonCode\LaravelActions\Action;
125
137
126
-
return new class () extends Action
138
+
return new class extends Action
127
139
{
128
140
/** @var string|array|null */
129
141
protected $environment = 'production';
@@ -140,7 +152,7 @@ You can also specify multiple environment names:
140
152
```php
141
153
use DragonCode\LaravelActions\Action;
142
154
143
-
return new class () extends Action
155
+
return new class extends Action
144
156
{
145
157
/** @var string|array|null */
146
158
protected $environment = ['testing', 'staging'];
@@ -163,7 +175,7 @@ For this you can use the `$except_environment` parameter:
163
175
```php
164
176
use DragonCode\LaravelActions\Action;
165
177
166
-
return new class () extends Action
178
+
return new class extends Action
167
179
{
168
180
/** @var string|array|null */
169
181
protected $exceptEnvironment = 'production';
@@ -180,7 +192,7 @@ You can also specify multiple environment names:
Copy file name to clipboardExpand all lines: src/Concerns/Optionable.php
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ trait Optionable
18
18
Options::CONNECTION,
19
19
Options::FORCE,
20
20
Options::MUTE,
21
+
Options::ISOLATED,
21
22
];
22
23
23
24
protectedfunctionconfigure(): void
@@ -49,6 +50,7 @@ protected function availableOptions(): array
49
50
[Options::REALPATH, null, InputOption::VALUE_NONE, 'Indicate any provided action file paths are pre-resolved absolute path'],
50
51
[Options::STEP, null, InputOption::VALUE_OPTIONAL, 'Force the actions to be run so they can be rolled back individually'],
51
52
[Options::MUTE, null, InputOption::VALUE_NONE, 'Turns off the output of informational messages'],
53
+
[Options::ISOLATED, null, InputOption::VALUE_OPTIONAL, 'Do not run the actions command if another instance of the actions command is already running', false],
0 commit comments