CreateMigration
Scaffolds a new migration file
class System\Console\CreateMigration
extends System\Console\BaseScaffoldCommand
implements
Symfony\Component\Console\Command\SignalableCommandInterface
Extends
Class | Description |
---|---|
BaseScaffoldCommand
|
Traits
Trait | Description |
---|---|
HandlesCleanup
|
Console Command Trait that injects cross-platform signal handling to trigger cleanup on exit through the handleCleanup() method on the implementing class. |
HasPluginArgument
|
Console Command Trait that provides autocompletion for the "plugin" argument |
ProvidesAutocompletion
|
Console Command Trait that injects cross-platform signal handling to trigger cleanup on exit through the handleCleanup() method on the implementing class. |
Properties
protected
static
$defaultName
:
string
|
null
= "create:migration"
The default command name for lazy loading.
protected
$description
:
string
= "Creates a new migration."
The console command description.
protected
$migrationScaffolds
:
array
= {"create":{"scaffold\/migration\/migration.create.stub":"updates\/{{version}}\/{{snake_name}}.php"},"update":{"scaffold\/migration\/migration.update.stub":"updates\/{{version}}\/{{snake_name}}.php"},"migrate":{"scaffold\/migration\/migration.stub":"updates\/{{version}}\/{{snake_name}}.php"}}
Available migration scaffolds and their types
protected
$replaces
:
array
= ["make:migration"]
List of commands that this command replaces (aliases)
protected
$signature
:
string
= "create:migration\n {plugin : The name of the plugin. <info>(eg: Winter.Blog)<\/info>}\n {--name= : The name of the migration}\n {--model= : The model to create a migration for. <info>(eg: Post)<\/info>}\n {--table= : The table to migrate, defaults to autogenerated from the provided model. <info>(eg: winter_blog_posts)<\/info>}\n {--for-version= : Generate a migration for a specific version}\n {--c|create : Generate a migration that creates the specified table}\n {--u|update : Generate a migration that updates the specified table}\n {--f|force : Overwrite existing files with generated files.}\n {--uninspiring : Disable inspirational quotes}\n "
The name and signature of this command.
protected
$type
:
string
= "Migration"
The type of class being generated.
protected
$validatePluginInput
:
bool
= true
Validate the provided plugin input against the PluginManager.
inherited protected $files : Winter\Storm\Filesystem\Filesystem
The filesystem instance.
inherited protected $laravel : Winter\Storm\Foundation\Application
inherited
protected
$nameFrom
:
string
= "name"
The argument that the generated class name comes from
inherited
protected
$reservedNames
:
string[]
= ["__halt_compiler","abstract","and","array","as","break","callable","case","catch","class","clone","const","continue","declare","default","die","do","echo","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","eval","exit","extends","final","finally","fn","for","foreach","function","global","goto","if","implements","include","include_once","instanceof","insteadof","interface","isset","list","namespace","new","or","print","private","protected","public","require","require_once","return","static","switch","throw","trait","try","unset","use","var","while","xor","yield"]
Reserved names that cannot be used for generation.
inherited
protected
$stubs
:
array
= []
A mapping of stub to generated file.
inherited
protected
$vars
:
array
= []
An array of variables to use in stubs.
Methods
public makeStubs () : void
Make all stubs.
protected getNameInput () : string
Get the desired class name from the input.
protected getNextVersion ($currentVersion) : string
Get the next version number based on the current number.
Property | Type | Description |
---|---|---|
$currentVersion | mixed |
mixed
|
protected
mapFieldType (string $fieldName, array $fieldConfig, $model = null
)
: array
Maps model fields config to DB Schema column types.
Property | Type | Description |
---|---|---|
$fieldName | string |
string
|
$fieldConfig | array |
array
|
$model | mixed |
mixed
|
protected prepareVars () : array
Prepare variables for stubs.
protected processVars (array $vars) : array
Create vars for model fields mappings so they can be used in update/create stubs
Property | Type | Description |
---|---|---|
$vars | array |
array
|
inherited public __construct () : void
Create a new controller creator command instance.
inherited
public
alert (string $string, int | string | null $verbosity = null
)
: void
Write a string in an alert box.
Property | Type | Description |
---|---|---|
$string | string |
string
|
$verbosity | int | string | null |
int | string | null
|
inherited public complete (Symfony\Component\Console\Completion\CompletionInput $input, Symfony\Component\Console\Completion\CompletionSuggestions $suggestions) : void
Provide autocompletion for this command's input
Property | Type | Description |
---|---|---|
$input | Symfony\Component\Console\Completion\CompletionInput |
Symfony\Component\Console\Completion\CompletionInput
|
$suggestions | Symfony\Component\Console\Completion\CompletionSuggestions |
Symfony\Component\Console\Completion\CompletionSuggestions
|
inherited
public
error (string $string, int | string | null $verbosity = null
)
: void
Write a string as error output.
Property | Type | Description |
---|---|---|
$string | string |
string
|
$verbosity | int | string | null |
int | string | null
|
inherited
public
getPlugin ($identifier = null
)
: System\Classes\PluginBase | null
Get the plugin instance for the input.
Property | Type | Description |
---|---|---|
$identifier | mixed |
mixed
|
inherited
public
getPluginIdentifier ($identifier = null
)
: string
Get the desired plugin name from the input.
Property | Type | Description |
---|---|---|
$identifier | mixed |
mixed
|
inherited public getSubscribedSignals () : array
Returns the process signals this command listens to
inherited public handle () : int | bool | null
Execute the console command.
inherited public handleSignal (integer $signal) : void
Handle the provided Unix process signal
Property | Type | Description |
---|---|---|
$signal | integer |
integer
|
inherited public handleWindowsSignal (integer $event) : void
Handle the provided Windows process singal.
Property | Type | Description |
---|---|---|
$event | integer |
integer
|
inherited public makeStub (string $stubName)
Make a single stub.
Property | Type | Description |
---|---|---|
$stubName | string |
string
The source filename for the stub. |
inherited public suggestPluginValues ()
Return available plugins for autocompletion of the "plugin" argument
inherited protected getDestinationForStub (string $stubName) : string
Get the destination path for the provided stub name
Property | Type | Description |
---|---|---|
$stubName | string |
string
|
inherited protected getDestinationPath () : string
Get the base path to output generated stubs to
inherited protected getLangKeys () : array
Gets the localization keys and values to be stored in the plugin's localization files Can reference $this->vars and $this->laravel->getLocale() internally
inherited protected getSourcePath () : string
Get the base path to source stub files from
inherited protected isReservedName (string $name) : bool
Checks whether the given name is reserved.
Property | Type | Description |
---|---|---|
$name | string |
string
|
inherited protected makeDirectory (string $path) : void
Build the directory for the class if necessary.
Property | Type | Description |
---|---|---|
$path | string |
string
|
inherited protected modifyString (string | array $type, string $string) : string
Internal helper that handles modify a string, with extra logic.
Property | Type | Description |
---|---|---|
$type | string | array |
string | array
|
$string | string |
string
|