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
> Actions are like version control for your migration process, allowing your team to modify and share the application's actionable schema. If you have ever had to tell a teammate to manually perform any action on a producton server, you've come across an issue that actions solves.
19
12
20
13
## Installation
21
14
22
15
To get the latest version of Laravel Actions, simply require the project using [Composer](https://getcomposer.org):
23
16
24
17
```bash
25
-
$ composer require andrey-helldar/laravel-actions
18
+
$ composer require dragon-code/laravel-actions
26
19
```
27
20
28
21
Or manually update `require` block of `composer.json` and run `composer update`.
29
22
30
23
```json
31
24
{
32
25
"require": {
33
-
"andrey-helldar/laravel-actions": "^1.7"
26
+
"dragon-code/laravel-actions": "^2.0"
34
27
}
35
28
}
36
29
```
37
30
31
+
### Upgrade from `andrey-helldar/laravel-actions`
32
+
33
+
1. In your `composer.json` file, replace `"andrey-helldar/laravel-actions": "^1.0"` with `"dragon-code/laravel-actions": "^2.0"`.
34
+
2. Replace the `Helldar\LaravelActions` namespace prefix with `DragonCode\LaravelActions` in your app;
35
+
3. Run the `command composer` update.
36
+
4. Profit!
37
+
38
38
#### Laravel Framework
39
39
40
40
Nothing else needs to be done. All is ready 😊
41
41
42
42
#### Lumen Framework
43
43
44
-
This package is focused on Laravel development, but it can also be used in Lumen with some workarounds. Because Lumen works a little different, as it is like a
45
-
barebone version of Laravel and the main configuration parameters are instead located in `bootstrap/app.php`, some alterations must be made.
44
+
This package is focused on Laravel development, but it can also be used in Lumen with some workarounds. Because Lumen works a little different, as it is like a barebone version of
45
+
Laravel and the main configuration parameters are instead located in `bootstrap/app.php`, some alterations must be made.
46
46
47
-
You can install `Laravel Actions` in `app/Providers/AppServiceProvider.php`, and uncommenting this line that registers the App Service Providers so it can
48
-
properly load.
47
+
You can install `Laravel Actions` in `app/Providers/AppServiceProvider.php`, and uncommenting this line that registers the App Service Providers so it can properly load.
@@ -68,8 +67,7 @@ To create a migration, use the `make:migration:action` Artisan command:
68
67
php artisan make:migration:action my_action
69
68
```
70
69
71
-
The new action will be placed in your `database/actions` directory. Each action file name contains a timestamp, which allows Laravel to determine the order of
72
-
the actions.
70
+
The new action will be placed in your `database/actions` directory. Each action file name contains a timestamp, which allows Laravel to determine the order of the actions.
73
71
74
72
> At the first start, you need to create a table by running the `migrate:actions:install` command.
75
73
>
@@ -85,8 +83,8 @@ php artisan migrate:actions
85
83
86
84
#### Forcing Actions To Run In Production
87
85
88
-
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
89
-
database, you will be prompted for confirmation before the commands are executed. To force the commands to run without a prompt, use the `--force` flag:
86
+
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, you will
87
+
be prompted for confirmation before the commands are executed. To force the commands to run without a prompt, use the `--force` flag:
90
88
91
89
```
92
90
php artisan migrate:actions --force
@@ -99,7 +97,7 @@ In some cases, you need to call the code every time you deploy the application.
99
97
To do this, override the `$once` variable in the action file:
100
98
101
99
```php
102
-
use Helldar\LaravelActions\Support\Actionable;
100
+
use DragonCode\LaravelActions\Support\Actionable;
103
101
104
102
class Reindex extends Actionable
105
103
{
@@ -114,8 +112,7 @@ class Reindex extends Actionable
114
112
115
113
If the value is `$once = false`, the `up` method will be called every time the `migrate:actions` command called.
116
114
117
-
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
118
-
command is called.
115
+
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.
119
116
120
117
#### Execution In A Specific Environment
121
118
@@ -124,7 +121,7 @@ In some cases, it becomes necessary to execute an action in a specific environme
124
121
For this you can use the `$environment` parameter:
125
122
126
123
```php
127
-
use Helldar\LaravelActions\Support\Actionable;
124
+
use DragonCode\LaravelActions\Support\Actionable;
128
125
129
126
class Reindex extends Actionable
130
127
{
@@ -141,7 +138,7 @@ class Reindex extends Actionable
141
138
You can also specify multiple environment names:
142
139
143
140
```php
144
-
use Helldar\LaravelActions\Support\Actionable;
141
+
use DragonCode\LaravelActions\Support\Actionable;
145
142
146
143
class Reindex extends Actionable
147
144
{
@@ -164,7 +161,7 @@ In some cases, it becomes necessary to execute an action excluding certain envir
164
161
For this you can use the `$except_environment` parameter:
165
162
166
163
```php
167
-
use Helldar\LaravelActions\Support\Actionable;
164
+
use DragonCode\LaravelActions\Support\Actionable;
168
165
169
166
class Reindex extends Actionable
170
167
{
@@ -181,7 +178,7 @@ class Reindex extends Actionable
181
178
You can also specify multiple environment names:
182
179
183
180
```php
184
-
use Helldar\LaravelActions\Support\Actionable;
181
+
use DragonCode\LaravelActions\Support\Actionable;
185
182
186
183
class Reindex extends Actionable
187
184
{
@@ -199,14 +196,14 @@ By default, no actions will be excluded. The same happens if you specify `null`
199
196
200
197
#### Database Transactions
201
198
202
-
In some cases, it becomes necessary to undo previously performed actions in the database. For example, when code execution throws an error. To do this, the code
203
-
must be wrapped in a transaction.
199
+
In some cases, it becomes necessary to undo previously performed actions in the database. For example, when code execution throws an error. To do this, the code must be wrapped in
200
+
a transaction.
204
201
205
-
By setting the `$transactions = true` parameter, you will ensure that your code is wrapped in a transaction without having to manually call
206
-
the `DB::transaction()` method. This will reduce the time it takes to create the action.
202
+
By setting the `$transactions = true` parameter, you will ensure that your code is wrapped in a transaction without having to manually call the `DB::transaction()` method. This
203
+
will reduce the time it takes to create the action.
207
204
208
205
```php
209
-
use Helldar\LaravelActions\Support\Actionable;
206
+
use DragonCode\LaravelActions\Support\Actionable;
210
207
211
208
class AddSomeData extends Actionable
212
209
{
@@ -229,15 +226,13 @@ class AddSomeData extends Actionable
229
226
230
227
### Rolling Back Actions
231
228
232
-
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
233
-
action files:
229
+
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:
234
230
235
231
```
236
232
php artisan migrate:actions:rollback
237
233
```
238
234
239
-
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
240
-
five actions:
235
+
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:
The `migrate:actions:refresh` command will roll back all of your migrations and then execute the `migrate:actions` command. This command effectively re-creates
255
-
your entire database:
249
+
The `migrate:actions:refresh` command will roll back all of your migrations and then execute the `migrate:actions` command. This command effectively re-creates your entire
250
+
database:
256
251
257
252
```
258
253
php artisan migrate:actions:refresh
259
254
```
260
255
261
-
You may roll back & re-migrate a limited number of migrations by providing the `step` option to the `refresh` command. For example, the following command will
262
-
roll back & re-migrate the last five migrations:
256
+
You may roll back & re-migrate a limited number of migrations by providing the `step` option to the `refresh` command. For example, the following command will roll back &
0 commit comments