Methods |
public description() : string Returns a description of the migration |
public abstract down() : bool Returns true if the up migrate worked |
public executeAlters() : bool Run all the cached alter statements. You will need to call if this directly if you need to change a table altered in the current migration. |
public getAllTables(string $type = 'BASE TABLE') : array
|
public getErrors() : array
|
public getMySQLSetting(string $variable) : string
|
public id() : int Returns the migration id. Class name should be Migration_x |
public ran() : string |
public runSQL(string $sql, array $input = []) : bool Runs the current SQL statement immediately
|
public setRan(string $ran) : static |
public abstract up() : bool Returns true if the up migrate worked |
Properties |
protected array $errors = []
|
protected array $myslqDefaults = ['CURRENT_TIMESTAMP', 'CURRENT_DATE', 'true', 'false', 'b'0'', 'b'1'']
|
Methods |
protected addColumn(string $table, string $field, string $parameters) : bool Always adds a column |
protected addForeignKey(string $toTable, string $referenceTable, array $columns, string $onDelete = 'CASCADE', string $onUpdate = 'CASCADE') : bool Creates a foreign key on the table referencing the given table and columns.
|
protected addIndex(string $table, array|string $fields, string $indexType = '') : bool Add an index on the fields in the array.
|
protected addPrimaryKey(string $table, array $fields) : bool Adds a primary key to the table.
|
protected addPrimaryKeyAutoIncrement(string $table, string $field = '', string $newFieldName = '') : bool Adds a primary key to the table. If $field is not specified, it will the primary key will be the table name with Id appended. If $newFieldName is not specified, it will default to $field. This method works on an existing field only. |
protected alterColumn(string $table, string $field, string $parameters, string $newName = '') : bool Alters a column incluing a reneme if $newName is provided |
protected deleteDuplicateRows(string $table, array $keys) : bool Duplicate rows with the same key values will be deleted
|
protected dropAllIndexes(string $table) : void Drops all indexes on a table but not the primary key. |
protected dropColumn(string $table, string $field) : bool Drops a column if it exists |
protected dropForeignKey(string $table, array $columns) : bool Drops the foreign key on the table
|
protected dropIndex(string $table, array|string $fields) : bool Drops an index by the name used by addIndex
|
protected dropPrimaryKey(string $table) : bool Drops the primary key |
protected dropTable(string $table) : bool Drops a table if it exists |
protected dropTables(array $tables) : void Drops tables contained in the array
|
protected dropView(string $view) : bool Drops a view if it exists |
protected dropViews(array $views) : void Drops views contained in the array
|
protected indexExists(string $table, string $indexName) : bool Tests for existance of an index on the table |
protected renameTable(string $oldName, string $newName) : bool Renames an existing table |
Properties |
private array $alters = []
|
private string $ran = '' |
Methods |
private alter(string $type, string $table, string $field, string $extra = '', string $newName = '') : void |
private getFieldInfo(string $table, string $fieldName) : ?PHPFUI |