Drops database table foreign key.
@param string $name key name
@return string result message
322841
protected function dropForeign($name)
    {
        if (empty($name)) {
            return Yii::t('podium/flash', 'Installation aborted! Foreign key name missing.');
        }
        try {
            $this->db->createCommand()->dropForeignKey($this->getForeignName($name), $this->table)->execute();
            return $this->returnWarning(Yii::t('podium/flash', 'Table foreign key {name} has been dropped', [
                'name' => $this->getForeignName($name)
            ]));
        } catch (Exception $e) {
            return $this->returnError($e->getMessage(), __METHOD__,
                Yii::t('podium/flash', 'Error during table foreign key {name} dropping', [
                    'name' => $this->getForeignName($name)
                ])
            );
        }
    }
1176225
public function dropColumn($name)
    {
        $this->requireColumn($name);
        $this->alter('DROP COLUMN ' . $this->_database->prepareIdentifier($name));
        unset($this->_columns[$name]); // Update column cache
        $this->_updateConstraints($name, null);
    }
241077
public function dropColumn( $table, $name )
    {
        try
        {
            $tmpTable = $table . '_old';

            $this->startTransaction();

            $this->copyTable( $table, $tmpTable, [ $name ] );

            $this->dropTable( $tmpTable );

            $this->commitTransaction();
        }
        catch ( Exception $e )
        {
            $this->rollbackTransaction();

            return FALSE;
        }

        return TRUE;
    }
322734
public function getTableName($name)
    {
        $tableName = null;
        if (isset($this->app['schema.tables'][$name])) {
            /** @var BaseTable $table */
            $table = $this->app['schema.tables'][$name];
            $tableName = $table->getTableName();
        }

        return $tableName;
    }
405834
public function destroyFieldMigrationForTable($name, $tableName)
    {
        $path = $this->getMigrationPath($tableName, $name);

        $this->delete($path);
    }
92397
public function forgetMigration($tableName, $name)
    {
        $capsules = $this->all();
        $keep = [];

        foreach ($capsules as $capsule) {
            if ($capsule->tableName == $tableName) {
                $key = $capsule->getMigrationIndex($name);
                $capsule->forgetMigration($key);
            }

            $keep[] = $capsule;
        }

        $this->write($keep);

        return $keep;
    }
141453
public function dropForeignKey($name)
    {
        if (!$this->hasForeignKey($name)) {
            throw SchemaException::tableForeignKeyDoesNotExist($this->getName(), $name);
        }

        unset($this->foreignKeys[$name]);
    }
382028
public function DropColumn($Name) {
      if (!$this->Query('alter table `'.$this->_DatabasePrefix.$this->_TableName.'` drop column `'.$Name.'`'))
         throw new Exception(sprintf(T('Failed to remove the `%1$s` column from the `%2$s` table.'), $Name, $this->_DatabasePrefix.$this->_TableName));

      return TRUE;
   }
285023
protected function getDropPrimaryKeySql($table, $name)
	{
		$sql = 'ALTER TABLE ONLY ' . $this->db->quoteName($table) . ' DROP CONSTRAINT ' . $this->db->quoteName($name);

		return $sql;
	}
944816
protected function dbDropTable($name = '')
    {
        $result = Eresus_CMS::getLegacyKernel()->db->drop($this->__table($name));
        return $result;
    }
231462
public function getTable($name)
	{

		if (!isset($this->_tables[$name]))
            $this->_tables[$name] = $this->_createTable($name);

        return $this->_tables[$name];
	}
511942
public function getTable($name)
    {
        return $this->tables->has($name) ? $this->tables[$name] : null;
    }
512128
public function getForeignKey(string $name = null)
    {
        // 构造 查询语句
        $sql = $this->db->getCreate($name ? $name : $this->tableName);
        $result = $this->query($sql);

        // 分析结果
        $statement = $result[0]['Create Table'];
        $matched = preg_match_all('/CONSTRAINT\s\S*\sFOREIGN\sKEY\s\(`([^`]*)`\) REFERENCES `([^`]*)` \(`([^`]*)`\)/i', $statement, $matches, PREG_SET_ORDER);
        if (!$matched) {
            return false;
        }

        // 如果有多个
        $fks = [];
        foreach ($matches as $m) {
            $fks[$m[1]] = [
                'table' => $m[2],
                'field' => $m[3]
            ];
        }
        return $fks;
    }
355597
public function dropIndex($name)
    {
        if (is_array($name))
            $name = $this->name.'___'.implode('__', $name);
        elseif(!is_int(strpos($name,'___')))
            $name = $this->name.'___'.$name;
        $name = $this->db->quotekey($name);
        $table = $this->db->quotekey($this->name);
        $cmd = array(
            'pgsql|sqlite2?|ibm' =>
                "DROP INDEX $name;",
            'mssql|sybase|dblib|odbc|sqlsrv' =>
                "DROP INDEX $table.$name;",
            'mysql'=>
                "ALTER TABLE $table DROP INDEX $name;",
        );
        $query = $this->findQuery($cmd);
        $this->queries[] = $query;
    }
1342789
protected function getDropColumnSQL($table, $name)
	{
		$sql = 'ALTER TABLE ' . $this->db->quoteName($table) . ' DROP COLUMN ' . $this->db->quoteName($name);

		return $sql;
	}
983646
public function removeAuthItem($name)
	{
		if($this->usingSqlite())
		{
			$this->db->createCommand()
				->delete($this->itemChildTable, 'parent=:name1 OR child=:name2', array(
					':name1'=>$name,
					':name2'=>$name
			));
			$this->db->createCommand()
				->delete($this->assignmentTable, 'itemname=:name', array(
					':name'=>$name,
			));
		}

		return $this->db->createCommand()
			->delete($this->itemTable, 'name=:name', array(
				':name'=>$name
			)) > 0;
	}
476272
public function getTable($name = '')
    {
        if ($name || empty($this->table)) {
            $name      = $name ?: $this->name;
            $tableName = $this->prefix;
            if ($name) {
                $tableName .= Parse::parseName($name);
            }
        } else {
            $tableName = $this->table;
        }
        return $tableName;
    }