protected function addIndexes(Table $table)
    {
        $stmt = $this->dbh->query("SELECT INDEX_NAME, COLUMN_NAME FROM USER_IND_COLUMNS WHERE TABLE_NAME = '" . $table->getName() . "' ORDER BY COLUMN_NAME");

        $indices = [];
        while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
            $indices[$row['INDEX_NAME']][]= $row['COLUMN_NAME'];
        }

        foreach ($indices as $indexName => $columnNames) {
            $index = new Index($indexName);
            foreach ($columnNames as $columnName) {
                // Oracle deals with complex indices using an internal reference, so...
                // let's ignore this kind of index
                if ($table->hasColumn($columnName)) {
                    $index->addColumn($table->getColumn($columnName));
                }
            }
            // since some of the columns are pruned above, we must only add an index if it has columns
            if ($index->hasColumns()) {
                $table->addIndex($index);
            }
        }
    }
protected function addIndexes(Table $table)
    {
        $stmt = $this->dbh->query("SELECT INDEX_NAME, COLUMN_NAME FROM USER_IND_COLUMNS WHERE TABLE_NAME = '" . $table->getName() . "' ORDER BY COLUMN_NAME");

        $indices = [];
        while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
            $indices[$row['INDEX_NAME']][]= $row['COLUMN_NAME'];
        }

        foreach ($indices as $indexName => $columnNames) {
            $index = new Index($indexName);
            foreach ($columnNames as $columnName) {
                // Oracle deals with complex indices using an internal reference, so...
                // let's ignore this kind of index
                if ($table->hasColumn($columnName)) {
                    $index->addColumn($table->getColumn($columnName));
                }
            }
            // since some of the columns are pruned above, we must only add an index if it has columns
            if ($index->hasColumns()) {
                $table->addIndex($index);
            }
        }
    }
protected function addIndexes ( Table $ table ) { $ stmt = $ this -> dbh -> query ( "SELECT INDEX_NAME, COLUMN_NAME FROM USER_IND_COLUMNS WHERE TABLE_NAME = '" . $ table -> getName ( ) . "' ORDER BY COLUMN_NAME" ) ; $ indices = [ ] ; while ( $ row = $ stmt -> fetch ( \ PDO :: FETCH_ASSOC ) ) { $ indices [ $ row [ 'INDEX_NAME' ] ] [ ] = $ row [ 'COLUMN_NAME' ] ; } foreach ( $ indices as $ indexName => $ columnNames ) { $ index = new Index ( $ indexName ) ; foreach ( $ columnNames as $ columnName ) { // Oracle deals with complex indices using an internal reference, so... // let's ignore this kind of index if ( $ table -> hasColumn ( $ columnName ) ) { $ index -> addColumn ( $ table -> getColumn ( $ columnName ) ) ; } } // since some of the columns are pruned above, we must only add an index if it has columns if ( $ index -> hasColumns ( ) ) { $ table -> addIndex ( $ index ) ; } } }
Adds Indexes to the specified table.

@param Table $table The Table model class to add columns to.
Adds Indexes to the specified table .