db\Migration safeDown()

safeDown() public method This method contains the logic to be executed when removing this migration. This method differs from down() in that the DB logic implemented here will be enclosed within a DB transaction. Child classes may implement this method instead of down() if the DB logic needs to be within a transaction. public boolean safeDown ( )return boolean Return a false value to indicate the migration fails and should not proceed further. All other return values mean the migration s

db\Migration renameColumn()

renameColumn() public method Builds and executes a SQL statement for renaming a column. public void renameColumn ( $table, $name, $newName )$table string The table whose column is to be renamed. The name will be properly quoted by the method. $name string The old name of the column. The name will be properly quoted by the method. $newName string The new name of the column. The name will be properly quoted by the method.

db\Migration init()

init() public method Initializes the migration. This method will set $db to be the 'db' application component, if it is null. public void init ( )

db\Migration insert()

insert() public method Creates and executes an INSERT SQL statement. The method will properly escape the column names, and bind the values to be inserted. public void insert ( $table, $columns )$table string The table that new rows will be inserted into. $columns array The column data (name => value) to be inserted into the table.

db\Migration execute()

execute() public method Executes a SQL statement. This method executes the specified SQL statement using $db. public void execute ( $sql, $params = [] )$sql string The SQL statement to be executed $params array Input parameters (name => value) for the SQL execution. See yii\db\Command::execute() for more details.

db\Migration getDb()

getDb() protected method (available since version 2.0.6) protected void getDb ( )

db\Migration dropPrimaryKey()

dropPrimaryKey() public method Builds and executes a SQL statement for dropping a primary key. public void dropPrimaryKey ( $name, $table )$name string The name of the primary key constraint to be removed. $table string The table that the primary key constraint will be removed from.

db\Migration dropForeignKey()

dropForeignKey() public method Builds a SQL statement for dropping a foreign key constraint. public void dropForeignKey ( $name, $table )$name string The name of the foreign key constraint to be dropped. The name will be properly quoted by the method. $table string The table whose foreign is to be dropped. The name will be properly quoted by the method.

db\Migration dropIndex()

dropIndex() public method Builds and executes a SQL statement for dropping an index. public void dropIndex ( $name, $table )$name string The name of the index to be dropped. The name will be properly quoted by the method. $table string The table whose index is to be dropped. The name will be properly quoted by the method.

db\Migration dropTable()

dropTable() public method Builds and executes a SQL statement for dropping a DB table. public void dropTable ( $table )$table string The table to be dropped. The name will be properly quoted by the method.