Generate foreign key remove.

@param string $table
@param string $indexName

@return string
356861
protected function getForeignKeyRemove($table, $indexName)
    {
        $result = sprintf("%s\$this->table(\"%s\")->dropForeignKey('%s');", $this->ind2, $table, $indexName);

        return $result;
    }
60546
protected function generateClassName($indexName)
    {
        if (isset($this->_classNames[$indexName])) {
            return $this->_classNames[$indexName];
        }

        if (($pos = strrpos($indexName, '.')) !== false) {
            $indexName = substr($indexName, $pos + 1);
        }

        $db = $this->getDbConnection();
        $patterns = [];
        $patterns[] = "/^{$db->tablePrefix}(.*?)$/";
        $patterns[] = "/^(.*?){$db->tablePrefix}$/";
        if (strpos($this->indexName, '*') !== false) {
            $pattern = $this->indexName;
            if (($pos = strrpos($pattern, '.')) !== false) {
                $pattern = substr($pattern, $pos + 1);
            }
            $patterns[] = '/^' . str_replace('*', '(\w+)', $pattern) . '$/';
        }
        $className = $indexName;
        foreach ($patterns as $pattern) {
            if (preg_match($pattern, $indexName, $matches)) {
                $className = $matches[1];
                break;
            }
        }

        return $this->_classNames[$indexName] = Inflector::id2camel($className, '_');
    }
428378
public function hasIndex($indexName, $tableName)
    {
        $result = false;

        foreach ($this->getIndices($tableName) as $index) {
            if ($indexName === $index['Column_name']) {
                $result = true;
            }
        }

        return $result;
    }
805446
public function createIndex($tableName, $indexName, $indexSpec)
    {
        $this->query("ALTER TABLE \"$tableName\" ADD " . $this->getIndexSqlDefinition($indexName, $indexSpec));
    }
566436
public function createIndex($indexName)
    {
        $this->indexName = $indexName;

        if (file_exists($this->config['storage'].$indexName)) {
            unlink($this->config['storage'].$indexName);
        }

        $this->index = new PDO('sqlite:'.$this->config['storage'].$indexName);
        $this->index->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

        $this->index->exec("CREATE TABLE IF NOT EXISTS wordlist (
                    id INTEGER PRIMARY KEY,
                    term TEXT UNIQUE COLLATE nocase,
                    num_hits INTEGER,
                    num_docs INTEGER)");

        $this->index->exec("CREATE UNIQUE INDEX 'main'.'index' ON wordlist ('term');");

        $this->index->exec("CREATE TABLE IF NOT EXISTS doclist (
                    term_id INTEGER,
                    doc_id INTEGER,
                    hit_count INTEGER)");

        $this->index->exec("CREATE TABLE IF NOT EXISTS fields (
                    id INTEGER PRIMARY KEY,
                    name TEXT)");

        $this->index->exec("CREATE TABLE IF NOT EXISTS hitlist (
                    term_id INTEGER,
                    doc_id INTEGER,
                    field_id INTEGER,
                    position INTEGER,
                    hit_count INTEGER)");

        $this->index->exec("CREATE TABLE IF NOT EXISTS info (
                    key TEXT,
                    value INTEGER)");

        $this->index->exec("INSERT INTO info ( 'key', 'value') values ( 'total_documents', 0)");

        $this->index->exec("CREATE INDEX IF NOT EXISTS 'main'.'term_id_index' ON doclist ('term_id' COLLATE BINARY);");

        if (!$this->dbh) {
            $connector = $this->createConnector($this->config);
            $this->dbh = $connector->connect($this->config);
        }
        return $this;
    }
91476
public function getPrimaryKey($tableName)
    {
        $indexes = $this->query("EXEC sp_helpindex '$tableName';");
        $indexName = '';
        foreach ($indexes as $index) {
            if ($index['index_keys'] == 'ID') {
                $indexName = $index['index_name'];
                break;
            }
        }

        return $indexName;
    }
908945
public function removeIndex($indexName) {
    $flip = array_flip($this->indexes);
    unset($flip[$indexName]);
    $this->indexes = array_values(array_flip($flip));
  }
651887
public function getDropIndexSQL($index, $table = null)
    {
        if ($index instanceof Index) {
            $index = $index->getQuotedName($this);
        } elseif (! is_string($index)) {
            throw new InvalidArgumentException('AbstractPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
        }

        return 'DROP INDEX ' . $index;
    }
533438
public function on(string $referencedTableName) : ForeignKeyOnDeleteModeDefiner
    {
        return new ForeignKeyOnDeleteModeDefiner(
                $this->callback,
                $this->localColumnNames,
                $this->referencedColumnNames,
                $referencedTableName
        );
    }
1359296
public function getDropForeignKeySQL($foreignKey, $table)
    {
        if (! $foreignKey instanceof ForeignKeyConstraint) {
            $foreignKey = new Identifier($foreignKey);
        }

        if (! $table instanceof Table) {
            $table = new Identifier($table);
        }

        $foreignKey = $foreignKey->getQuotedName($this);
        $table      = $table->getQuotedName($this);

        return 'ALTER TABLE ' . $table . ' DROP FOREIGN KEY ' . $foreignKey;
    }
462572
protected function getIndexRemove(string $indexName, array $output): array
    {
        $output[] = sprintf('%s->removeIndexByName("%s")', $this->ind3, $indexName);

        return $output;
    }
580622
public function deleteIndex($indexname) {

        $index = $this->getIndex($indexname);
        if ($index) {
            $i = $this->findIndexInArray($indexname);
            // Look for prev and next index
            $previndex = $this->getIndex($index->getPrevious());
            $nextindex = $this->getIndex($index->getNext());
            // Change their previous and next attributes
            if ($previndex) {
                $previndex->setNext($index->getNext());
            }
            if ($nextindex) {
                $nextindex->setPrevious($index->getPrevious());
            }
            // Delete the index
            unset($this->indexes[$i]);
            // Reorder the indexes
            $this->orderIndexes($this->indexes);
            // Recalculate the hash
            $this->calculateHash(true);
            // We have one deleted index, so the table has changed
            $this->setChanged(true);
        }
    }
1190603
public function setPrimaryKey(array $columnNames, $indexName = false)
    {
        $this->_addIndex($this->_createIndex($columnNames, $indexName ?: 'primary', true, true));

        foreach ($columnNames as $columnName) {
            $column = $this->getColumn($columnName);
            $column->setNotnull(true);
        }

        return $this;
    }
1038718
public function dropIndex($bucketName, $indexName)
    {
        $sql = $this->db->getQueryBuilder()->dropIndex($bucketName, $indexName);

        return $this->setSql($sql)->setBucketName($bucketName);
    }
1121135
public function dropColumn($table, $columnName)
    {
        $table = $this->prefixTable($table);

        return $this->container->make('Piwik\Updater\Migration\Db\DropColumn', array(
            'table' => $table, 'columnName' => $columnName
        ));
    }
8064
public static function dropIndex($table, $name)
    {
        $query = static::getQuery();

        return static::build(
            'DROP INDEX',
            $query->quoteName($name),
            'ON',
            $query->quoteName($table)
        );
    }
31271
private function getRemovedForeignKeys($tableName, TableDiff $diff)
    {
        foreach ($diff->removedForeignKeys as $index) {
            $this->addMessage($tableName, sprintf('removed foreign key from `%s`', implode(', ', $index->getUnquotedLocalColumns())));
        }
    }