Skip to content

Commit 210e954

Browse files
Merge pull request #110 from TheDragonCode/4.x-1
Console commands have been changed
2 parents be8701b + 330e2fd commit 210e954

File tree

9 files changed

+57
-57
lines changed

9 files changed

+57
-57
lines changed

docs/helpers/execution-status.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ return new class () extends Action
3131
};
3232
```
3333

34-
Call the `php artisan migrate:actions` command.
34+
Call the `php artisan actions` command.
3535

3636
The log file will contain two `success` entries.
3737

@@ -66,6 +66,6 @@ return new class extends Action
6666
};
6767
```
6868

69-
Call the `php artisan migrate:actions` command.
69+
Call the `php artisan actions` command.
7070

7171
The log file will contain two `failed` entries.

docs/how-to-use/creating.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Creating Actions
22

3-
To create an action use the `make:migration:action` artisan command:
3+
To create an action use the `make:action` artisan command:
44

55
```bash
6-
php artisan make:migration:action some_name
6+
php artisan make:action some_name
77
```
88

99
The new action's file will be placed in your `actions` directory in the base path of your app.
@@ -18,7 +18,7 @@ If you do not specify the "name" attribute, then the file name will be generated
1818
> git branch name ?: 'auto'
1919
2020
```bash
21-
php artisan make:migration:action
21+
php artisan make:action
2222

2323
### When the git repository is found (`base_path('.git')` directory is exists) and HEAD branch name is 'qwerty'
2424
# 2022_10_11_225116_qwerty.php
@@ -36,31 +36,31 @@ php artisan make:migration:action
3636
You can use nested paths to create actions:
3737

3838
```bash
39-
php artisan make:migration:action Foo/Bar/QweRty
40-
php artisan make:migration:action Foo/Bar/QweRty.php
39+
php artisan make:action Foo/Bar/QweRty
40+
php artisan make:action Foo/Bar/QweRty.php
4141

42-
php artisan make:migration:action Foo\Bar\QweRty
43-
php artisan make:migration:action Foo\Bar\QweRty.php
42+
php artisan make:action Foo\Bar\QweRty
43+
php artisan make:action Foo\Bar\QweRty.php
4444

45-
php artisan make:migration:action foo\bar\QweRty
46-
php artisan make:migration:action foo\bar\QweRty.php
45+
php artisan make:action foo\bar\QweRty
46+
php artisan make:action foo\bar\QweRty.php
4747
```
4848

4949
All of these commands will create a file called `actions/foo/bar/Y_m_d_His_qwe_rty.php`.
5050

5151
For example:
5252

5353
```bash
54-
php artisan make:migration:action foo\bar\QweRty
54+
php artisan make:action foo\bar\QweRty
5555
# actions/foo/bar/2022_10_11_225734_qwe_rty.php
5656

57-
php artisan make:migration:action foo\bar\QweRty.php
57+
php artisan make:action foo\bar\QweRty.php
5858
# actions/foo/bar/2022_10_11_225734_qwe_rty.php
5959

60-
php artisan make:migration:action foo/bar/QweRty
60+
php artisan make:action foo/bar/QweRty
6161
# actions/foo/bar/2022_10_11_225734_qwe_rty.php
6262

63-
php artisan make:migration:action foo/bar/QweRty.php
63+
php artisan make:action foo/bar/QweRty.php
6464
# actions/foo/bar/2022_10_11_225734_qwe_rty.php
6565
```
6666

@@ -90,7 +90,7 @@ use DragonCode\LaravelActions\Action;
9090

9191
return new class () extends Action
9292
{
93-
public function __invoke(): void {} // called when `php artisan migrate:actions` running
93+
public function __invoke(): void {} // called when `php artisan actions` running
9494

9595
public function down(): void {} // doesn't call when `php artisan migrate:rollback` running
9696
// and any other commands to revert the action.

docs/how-to-use/rollback.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,41 @@
33
To roll back the latest action operation, you may use the `rollback` command. This command rolls back the last "batch" of actions, which may include multiple action files:
44

55
```
6-
php artisan migrate:actions:rollback
6+
php artisan actions:rollback
77
```
88

99
You may roll back a limited number of actions by providing the `step` option to the rollback command. For example, the following command will roll back the last five actions:
1010

1111
```
12-
php artisan migrate:actions:rollback --step=5
12+
php artisan actions:rollback --step=5
1313
```
1414

15-
The `migrate:actions:reset` command will roll back all of your application's actions:
15+
The `actions:reset` command will roll back all of your application's actions:
1616

1717
```
18-
php artisan migrate:actions:reset
18+
php artisan actions:reset
1919
```
2020

2121
For example:
2222

2323
```bash
24-
php artisan migrate:actions:rollback
24+
php artisan actions:rollback
2525
# action batch
2626
# 2022_10_12_021837_some 1
2727
# 2022_10_12_021838_some 2
2828
# 2022_10_12_021839_some 2
2929
# 2022_10_12_021840_some 3 // will be canceled
3030
# 2022_10_12_021841_some 3 // will be canceled
3131

32-
php artisan migrate:actions:rollback --step=1
32+
php artisan actions:rollback --step=1
3333
# action batch
3434
# 2022_10_12_021837_some 1
3535
# 2022_10_12_021838_some 2
3636
# 2022_10_12_021839_some 2
3737
# 2022_10_12_021840_some 3 // will be canceled
3838
# 2022_10_12_021841_some 3 // will be canceled
3939

40-
php artisan migrate:actions:rollback --step=2
40+
php artisan actions:rollback --step=2
4141
# action batch
4242
# 2022_10_12_021837_some 1
4343
# 2022_10_12_021838_some 2 // will be canceled
@@ -48,24 +48,24 @@ php artisan migrate:actions:rollback --step=2
4848

4949
## Roll Back & Action Using A Single Command
5050

51-
The `migrate:actions:refresh` command will roll back all of your actions and then execute the `migrate:actions` command. This command effectively re-creates your entire
51+
The `actions:refresh` command will roll back all of your actions and then execute the `actions` command. This command effectively re-creates your entire
5252
database:
5353

5454
```
55-
php artisan migrate:actions:refresh
55+
php artisan actions:refresh
5656
```
5757

5858
You may roll back & re-migrate a limited number of actions by providing the `step` option to the `refresh` command. For example, the following command will roll back &
5959
re-migrate the last five actions:
6060

6161
```
62-
php artisan migrate:actions:refresh --step=5
62+
php artisan actions:refresh --step=5
6363
```
6464

6565
## Drop All Actions & Rerun Actions
6666

67-
The `migrate:actions:fresh` command will drop all actions records from the actions table and then execute the migrate command:
67+
The `actions:fresh` command will drop all actions records from the actions table and then execute the migrate command:
6868

6969
```
70-
php artisan migrate:actions:fresh
70+
php artisan actions:fresh
7171
```

docs/how-to-use/running.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Running Actions
22

3-
To run all of your outstanding actions, execute the `migrate:actions` artisan command:
3+
To run all of your outstanding actions, execute the `actions` artisan command:
44

55
```bash
6-
php artisan migrate:actions
6+
php artisan actions
77
```
88

99
Action call order is checked by filename without path:
@@ -25,13 +25,13 @@ bar/2022_10_14_000003_test3 # 3
2525
## Isolating Action Execution
2626

2727
If you are deploying your application across multiple servers and running actions 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.
28+
the database at the same time. To avoid this, you may use the `isolated` option when invoking the `actions` command.
2929

3030
When the `isolated` option is provided, Laravel will acquire an atomic lock using your application's cache driver before attempting to run your actions. 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:
31+
run the `actions` command while that lock is held will not execute; however, the command will still exit with a successful exit status code:
3232

3333
```bash
34-
php artisan migrate:actions --isolated
34+
php artisan actions --isolated
3535
```
3636

3737
## Split Launch Option
@@ -41,10 +41,10 @@ Sometimes it becomes necessary to launch actions separately, for example, to not
4141
There is a `before` option for this when calling actions:
4242

4343
```bash
44-
php artisan migrate:actions --before
44+
php artisan actions --before
4545
```
4646

47-
When calling the `migrate:actions` command with the `before` parameter, the script will execute only those actions within which the value of the `before` parameter is `true`.
47+
When calling the `actions` command with the `before` parameter, the script will execute only those actions within which the value of the `before` parameter is `true`.
4848

4949
For backwards compatibility, the `before` parameter is set to `true` by default, but actions will only be executed if the option is explicitly passed.
5050

@@ -71,31 +71,31 @@ To run, you need to pass the `before` parameter. For example, when using [`deplo
7171
task('deploy', [
7272
// ...
7373
'artisan:migrate',
74-
'artisan:migrate:actions --before', // here
74+
'artisan:actions --before', // here
7575
'deploy:publish',
7676
'php-fpm:reload',
7777
'artisan:queue:restart',
78-
'artisan:migrate:actions', // here
78+
'artisan:actions', // here
7979
]);
8080
```
8181

82-
Thus, when `migrate:actions` is called, all actions whose `before` parameter is `true` will be executed, and after that, the remaining tasks will be executed.
82+
Thus, when `actions` is called, all actions whose `before` parameter is `true` will be executed, and after that, the remaining tasks will be executed.
8383

8484
> Note:
85-
> If you call the `migrate:actions` command without the `before` parameter,
85+
> If you call the `actions` command without the `before` parameter,
8686
> then all tasks will be executed regardless of the value of the `$before`
8787
> attribute inside the action class.
8888
8989
## Forcing Actions To Run In Production
9090

9191
> Some commands cannot be executed in production without confirmation.
92-
> These include all commands except `migrate:actions:status` and `migrate:actions`.
92+
> These include all commands except `actions:status` and `actions`.
9393
9494
Some action operations are destructive, which means they may cause you to lose data. In order to protect you from running these commands against your production database,
9595
you will be prompted for confirmation before the commands are executed. To force the commands to run without a prompt, use the `--force` flag:
9696

9797
```bash
98-
php artisan migrate:actions:install --force
98+
php artisan actions:install --force
9999
```
100100

101101
## Execution Every Time
@@ -118,7 +118,7 @@ return new class extends Action
118118
};
119119
```
120120

121-
If the value is `$once = false`, the `up` method will be called every time the `migrate:actions` command called.
121+
If the value is `$once = false`, the `up` method will be called every time the `actions` command called.
122122

123123
In this case, information about it will not be written to the `migration_actions` table and, therefore, the `down` method will not be called when the rollback command is called.
124124

docs/how-to-use/status.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Actions Status
22

3-
The `migrate:actions:status` command displays the execution status of actions. In it you can see which actions were executed and which were not:
3+
The `actions:status` command displays the execution status of actions. In it you can see which actions were executed and which were not:
44

55
```
6-
php artisan migrate:actions:status
6+
php artisan actions:status
77
```

docs/prologue/upgrade.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
For your convenience, we have created an upgrade console command:
2727

2828
```bash
29-
php artisan migrate:actions:upgrade
29+
php artisan actions:upgrade
3030
```
3131

3232
It will do the following:

src/Action.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ abstract class Action extends Migration
1414
* Determines the type of launch of the action.
1515
*
1616
* If true, then it will be executed once.
17-
* If false, then the action will run every time the `migrate:actions` command is invoked.
17+
* If false, then the action will run every time the `actions` command is invoked.
1818
*
1919
* @var bool
2020
*/
@@ -61,7 +61,7 @@ abstract class Action extends Migration
6161
* Determines the type of launch of the action.
6262
*
6363
* If true, then it will be executed once.
64-
* If false, then the action will run every time the `migrate:actions` command is invoked.
64+
* If false, then the action will run every time the `actions` command is invoked.
6565
*
6666
* @return bool
6767
*/

src/Constants/Names.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44

55
class Names
66
{
7-
public const FRESH = 'migrate:actions:fresh';
7+
public const FRESH = 'actions:fresh';
88

9-
public const INSTALL = 'migrate:actions:install';
9+
public const INSTALL = 'actions:install';
1010

11-
public const MAKE = 'make:migration:action';
11+
public const MAKE = 'make:action';
1212

13-
public const MIGRATE = 'migrate:actions';
13+
public const MIGRATE = 'actions';
1414

15-
public const REFRESH = 'migrate:actions:refresh';
15+
public const REFRESH = 'actions:refresh';
1616

17-
public const RESET = 'migrate:actions:reset';
17+
public const RESET = 'actions:reset';
1818

19-
public const ROLLBACK = 'migrate:actions:rollback.md';
19+
public const ROLLBACK = 'actions:rollback';
2020

21-
public const STATUS = 'migrate:actions:status';
21+
public const STATUS = 'actions:status';
2222

23-
public const UPGRADE = 'migrate:actions:upgrade';
23+
public const UPGRADE = 'actions:upgrade';
2424
}

tests/Commands/MigrateTest.php renamed to tests/Commands/ActionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Tests\TestCase;
1010
use Throwable;
1111

12-
class MigrateTest extends TestCase
12+
class ActionsTest extends TestCase
1313
{
1414
public function testMigrationCommand()
1515
{

0 commit comments

Comments
 (0)