mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Auto-run module migrations
This commit is contained in:
parent
8cc867939f
commit
8015b88c31
@ -42,7 +42,7 @@ class MakeModule extends Command
|
||||
$fields = $this->argument('fields');
|
||||
$migrate = $this->option('migrate');
|
||||
$lower = strtolower($name);
|
||||
|
||||
|
||||
// convert 'name:string,description:text' to 'name,description'
|
||||
$fillable = explode(',', $fields);
|
||||
$fillable = array_map(function($item) {
|
||||
@ -69,10 +69,10 @@ class MakeModule extends Command
|
||||
Artisan::call('ninja:make-class', ['name' => $name, 'module' => $name, 'class' => 'transformer', '--fields' => $fields]);
|
||||
Artisan::call('ninja:make-class', ['name' => $name, 'module' => $name, 'class' => 'lang', '--filename' => 'texts']);
|
||||
|
||||
if ($migrate) {
|
||||
Artisan::call('module:migrate', ['module' => $name]);
|
||||
} else {
|
||||
if ($migrate == 'false') {
|
||||
$this->info("Use the following command to run the migrations:\nphp artisan module:migrate $name");
|
||||
} else {
|
||||
Artisan::call('module:migrate', ['module' => $name]);
|
||||
}
|
||||
|
||||
Artisan::call('module:dump');
|
||||
|
@ -42,17 +42,18 @@ Run the following command to create a CRUD module:
|
||||
|
||||
php artisan ninja:make-module Inventory 'name:string,description:text'
|
||||
|
||||
You can make adjustments to the migration file and then run:
|
||||
To edit the migration before it's run add ``--migrate=false``
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
php artisan ninja:make-module <module> <fields> --migrate=false
|
||||
|
||||
After making adjustments to the migration file you can run:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
php artisan module:migrate <module>
|
||||
|
||||
To create and migrate in one step add ``--migrate=true``
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
php artisan ninja:make-module <module> <fields> --migrate=true
|
||||
|
||||
.. Tip:: You can specify the module icon by setting a value from http://fontawesome.io/icons/ for "icon" in modules.json.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user