本文整理汇总了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);
}