mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04: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');
|
$fields = $this->argument('fields');
|
||||||
$migrate = $this->option('migrate');
|
$migrate = $this->option('migrate');
|
||||||
$lower = strtolower($name);
|
$lower = strtolower($name);
|
||||||
|
|
||||||
// convert 'name:string,description:text' to 'name,description'
|
// convert 'name:string,description:text' to 'name,description'
|
||||||
$fillable = explode(',', $fields);
|
$fillable = explode(',', $fields);
|
||||||
$fillable = array_map(function($item) {
|
$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' => 'transformer', '--fields' => $fields]);
|
||||||
Artisan::call('ninja:make-class', ['name' => $name, 'module' => $name, 'class' => 'lang', '--filename' => 'texts']);
|
Artisan::call('ninja:make-class', ['name' => $name, 'module' => $name, 'class' => 'lang', '--filename' => 'texts']);
|
||||||
|
|
||||||
if ($migrate) {
|
if ($migrate == 'false') {
|
||||||
Artisan::call('module:migrate', ['module' => $name]);
|
|
||||||
} else {
|
|
||||||
$this->info("Use the following command to run the migrations:\nphp artisan module:migrate $name");
|
$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');
|
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'
|
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
|
.. code-block:: php
|
||||||
|
|
||||||
php artisan module:migrate <module>
|
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.
|
.. Tip:: You can specify the module icon by setting a value from http://fontawesome.io/icons/ for "icon" in modules.json.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user