Property | Type | Description | |
---|---|---|---|
$Version | MigrationVersion | MigrationVersion instance | |
$connection | null | string | Connection used for the migration_schema table of the migration versions | |
$migrationConnection | null | string | This can be used to override the connection of migration file | |
$path | string | Current path to load and save migrations | |
$skip | array | Skip a version or it can skip many version using comma as separate. | |
$type | string | Type of migration, can be 'app' or a plugin name |
Property | Type | Description | |
---|---|---|---|
$_messages | array | Messages used to display action being performed |
Method | Description | |
---|---|---|
afterMigration ( &$Migration, string $direction ) : void | Callback used to create a new line after the migration | |
beforeAction ( &$Migration, string $type, array $data ) : void | Callback used to display actions being performed | |
beforeMigration ( &$Migration, string $direction ) : void | Callback used to display what migration is being runned | |
generate ( ) : void | Generate a new migration file | |
getOptionParser ( ) : string | Get the option parser. | |
main ( ) : void | Override main | |
run ( ) : void | Run the migrations | |
startup ( ) : void | Override startup | |
status ( ) : void | Displays a status of all plugin and app migrations |
Method | Description | |
---|---|---|
_connectionNamesEnum ( ) : array | Get a list of connection names. | |
_execute ( array $options, boolean $once ) : boolean | Execute migration | |
_fieldNamesArray ( array $fields ) : array | Return list of field names from array of field/index definitions | |
_finalizeGeneratedMigration ( &$migration, &$migrationName, &$fromSchema ) : void | Finalizes the generated migration - offers to preview it, prompts for a name, writes the file, and updates db version if needed. | |
_findSchemaFile ( Folder $folder, string $schemaFiles, string $name ) : mixed | Finds schema file | |
_fromComparison ( array $migration, array $comparison, array $oldTables, array $currentTables ) : array | Generate a migration string using comparison | |
_generateDump ( &$migration ) : void | Generate a dump of the current database. | |
_generateFromCliArgs ( &$migration, &$migrationName, &$comparison ) : void | Generate a migration from arguments passed in at the command line | |
_generateFromComparison ( &$migration, &$oldSchema, &$comparison ) : void | Generate a migration by comparing schema.php with the database. | |
_generateFromInverseComparison ( &$migration, &$oldSchema, &$comparison ) : void | Generate a migration by comparing the database with schema.php. | |
_generateMigration ( string $name, string $class, array $migration ) : string | Generate a migration | |
_generateTemplate ( string $template, array $vars ) : string | Include and generate a template string based on a template file | |
_getFieldType ( string $field, string $type, array $validTypes ) : string | Return valid field type based on name of field | |
_getPath ( string $type = null ) : string | Return the path used | |
_getSchema ( string $type = null ) : mixed | Load and construct the schema class if exists | |
_getSchemaClassName ( string $name = null, boolean $suffix = true ) : string | Gets the schema class name | |
_migrationChanges ( array $migration ) : boolean | _migrationsChanges method | |
_outputLog ( array $log ) : void | Output the SQL log in dry mode | |
_overwriteSchema ( ) : void | Overwrite the schema.php file | |
_parseCommandLineFields ( string $name ) : array | Parse fields from the command line for use with generating new migration files | |
_parseSingleCommandLineField ( &$fields, &$indexes, string $field, array $validTypes ) : void | Parse a single argument from the command line into the fields array | |
_promptForMigrationName ( ) : string | Prompt the user for a name for their new migration. | |
_promptVersionOptions ( array $mapping, string $latestVersion ) : array | Output prompt with different migration versions to choose from | |
_readSchema ( ) : array | Reads the schema data | |
_showInfo ( array $mapping, string $type = null ) : void | Shows a list of available migrations | |
_singleStepOptions ( array $mapping, string $latestVersion, array $default = [] ) : array | Single step options for up/down migrations | |
_startMigrationConnection ( ) : string | Set a migration connection | |
_updateSchema ( ) : void | Update the schema, making a call to schema shell | |
_values ( array $values ) : string | Format a array/string into a one-line syntax | |
_writeMigration ( string $name, integer $version, array $migration ) : boolean | Write a migration with given name |
protected _connectionNamesEnum ( ) : array | ||
return | array | The list of connection names |
protected _fieldNamesArray ( array $fields ) : array | ||
$fields | array | Field/index definitions |
return | array | List of field names |
protected _finalizeGeneratedMigration ( &$migration, &$migrationName, &$fromSchema ) : void | ||
return | void |
protected _fromComparison ( array $migration, array $comparison, array $oldTables, array $currentTables ) : array | ||
$migration | array | Migration instructions array |
$comparison | array | Result from CakeSchema::compare() |
$oldTables | array | List of tables on schema.php file |
$currentTables | array | List of current tables on database |
return | array |
protected _generateDump ( &$migration ) : void | ||
return | void | (The variables passed by reference are changed; nothing is returned) |
protected _generateFromCliArgs ( &$migration, &$migrationName, &$comparison ) : void | ||
return | void | (The variables passed by reference are changed; nothing is returned) |
protected _generateFromComparison ( &$migration, &$oldSchema, &$comparison ) : void | ||
return | void | (The variables passed by reference are changed; nothing is returned) |
protected _generateFromInverseComparison ( &$migration, &$oldSchema, &$comparison ) : void | ||
return | void | (The variables passed by reference are changed; nothing is returned) |
protected _getSchema ( string $type = null ) : mixed | ||
$type | string | Can be 'app' or a plugin name |
return | mixed | False in case of no file found, schema object |
protected _migrationChanges ( array $migration ) : boolean | ||
$migration | array | list of migrations |
return | boolean |
protected _outputLog ( array $log ) : void | ||
$log | array | List of queries per migration |
return | void |
protected _overwriteSchema ( ) : void | ||
return | void |
protected _parseCommandLineFields ( string $name ) : array | ||
$name | string | Name of migration |
return | array |
protected _parseSingleCommandLineField ( &$fields, &$indexes, string $field, array $validTypes ) : void | ||
$field | string | A single command line argument - eg. 'id:primary_key' or 'name:string' |
$validTypes | array | Valid data types for the relevant database - eg. string, integer, biginteger, etc. |
return | void |
protected _promptForMigrationName ( ) : string | ||
return | string |
protected _startMigrationConnection ( ) : string | ||
return | string | The name of the migration connection. |
protected _updateSchema ( ) : void | ||
return | void |
public afterMigration ( &$Migration, string $direction ) : void | ||
$direction | string | Direction being runned |
return | void |
public beforeMigration ( &$Migration, string $direction ) : void | ||
$direction | string | Direction being runned |
return | void |
public getOptionParser ( ) : string | ||
return | string |
public MigrationVersion $Version | ||
return | MigrationVersion |
protected array $_messages | ||
return | array |
public array $skip | ||
return | array |
public string $type | ||
return | string |