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
Copy file name to clipboardExpand all lines: README.md
+41-1Lines changed: 41 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ Or manually update `require` block of `composer.json` and run `composer update`.
23
23
```json
24
24
{
25
25
"require": {
26
-
"dragon-code/laravel-migration-actions": "^2.4"
26
+
"dragon-code/laravel-migration-actions": "^2.6"
27
27
}
28
28
}
29
29
```
@@ -79,6 +79,46 @@ The new action will be placed in your `database/actions` directory. Each action
79
79
>
80
80
> If you execute `migrate:actions` with the first command, the `migrate:actions:install` command will be called automatically.
81
81
82
+
#### Automatically Generate A File Name
83
+
84
+
If you are not worried about the names of your files, then in version [2.6](https://github.com/TheDragonCode/laravel-migration-actions/releases/tag/v2.6.0) we added the ability to
85
+
automatically generate file names.
86
+
87
+
Just don't include the name attribute when creating the migration.
88
+
89
+
If a git repository is found in the main folder, then the name of the current active branch will be taken as a prefix:
90
+
91
+
```bash
92
+
php artisan make:migration:action
93
+
94
+
# 2022_01_28_184116_main_1643384476.php
95
+
# 2022_01_28_184117_main_1643384477.php
96
+
# 2022_01_28_184118_crm_2345_1643384478.php
97
+
# 2022_01_28_184119_crm_2345_1643384479.php
98
+
```
99
+
100
+
If the git repository is not found, then the default prefix will be used:
101
+
102
+
```bash
103
+
php artisan make:migration:action
104
+
105
+
# 2022_01_28_184116_auto_1643384476.php
106
+
# 2022_01_28_184117_auto_1643384477.php
107
+
# 2022_01_28_184118_auto_1643384478.php
108
+
```
109
+
110
+
If you are using Laravel prior to version [8.37](https://github.com/laravel/framework/releases/tag/v8.37.0), then to ensure backward compatibility, if the current git repository
111
+
branch name starts with a number, the `branch` prefix will be automatically added to it:
112
+
113
+
```bash
114
+
php artisan make:migration:action
115
+
```
116
+
117
+
```php
118
+
/* 2022_01_28_184116_branch_2x_1643384476.php */
119
+
class Branch2x1643384476 extends Actionable { }
120
+
```
121
+
82
122
### Running actions
83
123
84
124
To run all of your outstanding actions, execute the `migrate:actions` Artisan command:
0 commit comments