src/models/Schema.php
public function getDropKey(TableSchema $table, $indent = 0)
    {
        $textIndent = $this->textIndent($indent);
        $tableName = static::removePrefix($table->name, $this->db->tablePrefix);

        $definition = <<<DEFINITION
{$textIndent}foreach (\$this->runSuccess as \$keyName => \$value) {
{$textIndent}    if ('addAutoIncrement' === \$keyName) {
{$textIndent}        continue;
{$textIndent}    } elseif ('PRIMARY' === \$keyName) {
{$textIndent}        // must be remove auto_increment before drop primary key
{$textIndent}        if (isset(\$this->runSuccess['addAutoIncrement'])) {
{$textIndent}            \$value = \$this->runSuccess['addAutoIncrement'];
{$textIndent}            \$this->dropAutoIncrement("{\$value['table_name']}", \$value['column_name'], \$value['column_type'], \$value['property']);
{$textIndent}        }
{$textIndent}        \$this->dropPrimaryKey(null, '{{%{$tableName}}}');
{$textIndent}    } elseif (!empty(\$keyName)) {
{$textIndent}        \$this->dropIndex("`\$keyName`", '{{%{$tableName}}}');
{$textIndent}    }
{$textIndent}}
DEFINITION;

        return $definition . self::ENTER;

    }
public function getDropKey(TableSchema $table, $indent = 0)
    {
        $textIndent = $this->textIndent($indent);
        $tableName = static::removePrefix($table->name, $this->db->tablePrefix);

        $definition = <<<DEFINITION
{$textIndent}foreach (\$this->runSuccess as \$keyName => \$value) {
{$textIndent}    if ('addAutoIncrement' === \$keyName) {
{$textIndent}        continue;
{$textIndent}    } elseif ('PRIMARY' === \$keyName) {
{$textIndent}        // must be remove auto_increment before drop primary key
{$textIndent}        if (isset(\$this->runSuccess['addAutoIncrement'])) {
{$textIndent}            \$value = \$this->runSuccess['addAutoIncrement'];
{$textIndent}            \$this->dropAutoIncrement("{\$value['table_name']}", \$value['column_name'], \$value['column_type'], \$value['property']);
{$textIndent}        }
{$textIndent}        \$this->dropPrimaryKey(null, '{{%{$tableName}}}');
{$textIndent}    } elseif (!empty(\$keyName)) {
{$textIndent}        \$this->dropIndex("`\$keyName`", '{{%{$tableName}}}');
{$textIndent}    }
{$textIndent}}
DEFINITION;

        return $definition . self::ENTER;

    }
drop column key
@param TableSchema $table
@param $indent int text-indent 文本缩进
@return string