src/CsvMigration.php
private function addIndex(DbField $dbField, string $type, bool $exists = true) : bool
    {
        if (empty($type)) {
            return false;
        }

        // skip if table exists and has specified index
        if ($exists && $this->table->hasIndex($dbField->getName())) {
            return false;
        }

        $options = [];
        $options['name'] = $type . '_' . $dbField->getName();
        if ('unique' === $type) {
            $options['unique'] = true;
        }

        $this->table->addIndex($dbField->getName(), $options);

        return true;
    }
private function addIndex(DbField $dbField, string $type, bool $exists = true) : bool
    {
        if (empty($type)) {
            return false;
        }

        // skip if table exists and has specified index
        if ($exists && $this->table->hasIndex($dbField->getName())) {
            return false;
        }

        $options = [];
        $options['name'] = $type . '_' . $dbField->getName();
        if ('unique' === $type) {
            $options['unique'] = true;
        }

        $this->table->addIndex($dbField->getName(), $options);

        return true;
    }
private function addIndex ( DbField $ dbField , string $ type , bool $ exists = true ) : bool { if ( empty ( $ type ) ) { return false ; } // skip if table exists and has specified index if ( $ exists && $ this -> table -> hasIndex ( $ dbField -> getName ( ) ) ) { return false ; } $ options = [ ] ; $ options [ 'name' ] = $ type . '_' . $ dbField -> getName ( ) ; if ( 'unique' === $ type ) { $ options [ 'unique' ] = true ; } $ this -> table -> addIndex ( $ dbField -> getName ( ) , $ options ) ; return true ; }
Add column index by type.

@param \CsvMigrations\FieldHandlers\DbField $dbField DbField object
@param string $type Index type
@param bool $exists Table exists flag
@return bool
Add column index by type .