Adds an index to the indexlist.

@param string $name
@param string $type
@param string $column
972864
protected function addIndex($name, $type, $column)
    {
        if (isset($this->indexes[$name])) {
            $this->indexes[$name]['columns'][] = $column;
        }
        else {
            $this->indexes[$name] = [
                'name' => $name,
                'type' => $type,
                'columns' => [
                    $column
                ]
            ];
        }
    }
42010
public function addSubColumn($name, $display = null, $type = 'text',
                                 $value = null, $opts = array())
    {
        if (!$display) {
            $display = $name;
        }

        // Set a sensible default value for numbers
        if ($type == self::TYPE_NUMBER && $value === null) {
            $value = 0;
        }

        $baseOpts = array(
            self::KEY_NAME => $name,
            self::KEY_HEADER => $display,
            self::KEY_TYPE => $type
        );

        if ($value !== null) {
            $baseOpts[self::KEY_VALUE] = $value;
        }

        if (!empty($opts)) {
            $baseOpts = array_merge($baseOpts, $opts);
        }

        $this->subColumns[$name] = $baseOpts;
    }
397432
public function index($columns, $name = null, $algorithm = null)
    {
        $indexName = $name ?? md5(uniqid());

        return $this->indexCommand('index', $columns, $indexName, $algorithm);
    }
75926
public function addColumn($name, $format = null, $index = false)
    {
        $data = new \stdClass();
        $data->format = $format;
        $data->name = $name;
        if (!$index) {
            $this->columns[] = $data;
        } else {
            $this->columns[$index] = $data;
        }
    }
667936
public function addSorting($column, $type)
    {
        $availableSortTypes = [self::SORT_ASC, self::SORT_DESC];
        if (!in_array($type, $availableSortTypes)) {
            throw new \Exception(sprintf('Wrong sort type: "%s". Supported types: [%s]', $type, implode(',', $availableSortTypes)));
        }

        $this->sortParams[$column] = $type;

        return $this;
    }
73217
public static function buildIndexDeclare($name, $columns, $table = null)
    {
        $query = static::getQuery();
        $cols = [];

        foreach ((array) $columns as $key => $val) {
            if (is_numeric($key)) {
                $vals = explode('(', $val);
                $key = $query->quoteName($vals[0]);

                if (isset($vals[1])) {
                    $key .= '(' . trim($vals[1], '()') . ')';
                }

                $cols[] = $key;
            } else {
                if (!is_numeric($val)) {
                    $string = is_string($val) ? ' ' . $query->quote($val) : '';

                    throw new \InvalidArgumentException(
                        sprintf(
                            'Index length should be number, (%s)%s given.',
                            gettype($val),
                            $string
                        )
                    );
                }

                $cols[] = $query->quoteName($key) . '(' . $val . ')';
            }
        }

        $cols = '(' . implode(', ', $cols) . ')';

        return static::build(
            $name ? $query->quoteName($name) : null,
            $table ? 'ON ' . $query->quoteName($table) : null,
            $cols
        );
    }
1012081
public function addTo($email, $name = '', $type = 'to')
    {
        $this->to[] = array('email' => $email, 'name' => $name, 'type' => $type);

        return $this;
    }
790768
def add_index(columns, index_name = nil)
      options = { name: index_name } if index_name
      migration.add_index(table_name, columns, options || {})
    end
1137218
public function spatialIndex($columns, $name = null)
    {
        $connection_klass = get_class(\DLModel::getConnectionResolver()->connection());
        if ($connection_klass == 'Illuminate\Database\MySqlConnection') {
            // MySQL: Only MyISAM engine have spatial indexing
            $this->engine = 'MyISAM';
        }

        return $this->indexCommand('spatial', $columns, $name);
    }
710539
public function addColumn($column, $type)
    {
        $this->queryBuilder->addColumn($table, $column, $type);
        return $this;
    }
421774
public function onAddedToType(TypeInterface &$type)
    {
        parent::onAddedToType($type);

        if ($this->getAddIndex()) {
            $type->addIndex(new Index($this->name));
        }

        $type->addTrait(UpdatedAtInterface::class, UpdatedAtInterfaceImplementation::class)->serialize($this->name);
    }
604256
public function addColumn($column, $type, $table = null)
    {
        return $this->db->alterTable($this->getTable($table))
                        ->addColumn($column, $type)
                        ->execute();
    }
566258
public function on($type, $name, $callback)
    {
        $name = $type . '.' . $name;
        if (!isset($this->events[$name])) {
            $this->events[] = [];
        }

        $this->events[$name][] = $callback;
    }
499383
public function addIndex($type, $columns = [], $name = null, $comment = null, $options = [])
    {
        if (!$type instanceof Key) {
            if (!$columns) {
                throw new \InvalidArgumentException('No columns given.');
            }

            $columns = (array) $columns;

            $index = new Key($type, $columns, $name, $comment);
        } else {
            $index = $type;
        }

        if ($this->hasIndex($index->getName())) {
            $this->dropIndex($index->getName());
        }

        $query = MysqlGrammar::addIndex(
            $this->getName(),
            $index->getType(),
            $index->getColumns(),
            $index->getName(),
            $index->getComment()
        );

        $this->db->setQuery($query)->execute();

        return $this->reset();
    }
830277
public function index($name, $field, $order = null) {
        $this->index[$name] = [$field, $order];
        return $this;
    }
269527
public function addColumn(string $name): void
    {
        if (!in_array($name, $this->columns, true)) {
            $this->columns[] = $name;
        }
    }
854373
public function index($columns, $name = null, $flags = [], $options = [])
    {
        $columns = is_array($columns) ? $columns : [$columns];

        return $this->table->addIndex($columns, $name, $flags, $options);
    }