本文整理匯總了PHP中yii\db\Migration::dropColumn方法的典型用法代碼示例。如果您正苦於以下問題:PHP Migration::dropColumn方法的具體用法?PHP Migration::dropColumn怎麽用?PHP Migration::dropColumn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類yii\db\Migration
的用法示例。
在下文中一共展示了Migration::dropColumn方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: dropColumns
/**
* Drop multiple columns to a table
* @param string $table
* @param array $columns ["column_name"=>type]
*/
public function dropColumns($table, $columns)
{
foreach ($columns as $column => $type) {
parent::dropColumn($table, $column);
}
}
示例2: afterDelete
/**
* @throws \yii\base\NotSupportedException
*/
public function afterDelete()
{
parent::afterDelete();
$cm = $this->cm;
$mg = new Migration();
$table = Cm::$TAB_PREFIX[$cm->tab_index] . $cm->tab;
$tableSchema = $mg->db->getSchema()->getTableSchema('{{%' . $table . '}}');
if ($tableSchema === null) {
return;
}
$columns = $tableSchema->getColumnNames();
if (in_array($this->name, $columns)) {
$mg->dropColumn('{{%' . $table . '}}', $this->name);
}
}
示例3: dropColumn
/**
* @inheritdoc
* Note: table will be auto pefixied if [[$autoWrapTableNames]] is true.
*/
public function dropColumn($table, $column)
{
$table = $this->autoWrappedTableName($table);
return parent::dropColumn($table, $column);
}
示例4: dropColumn
public function dropColumn($table, $column, $type = null)
{
if ($type instanceof ForeignKeyColumn) {
$type->migrate = $this;
$type->sourceTable($table);
$type->sourceColumn($column);
$type->remove();
}
return parent::dropColumn($table, $column);
}