addIndex

@param string       $type
@param array|string $columns
@param string       $name
@param string       $comment
@param array        $options

@return mixed
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();
    }
390115
public static function addIndex($table, $type, $columns, $name)
    {
        $cols = static::buildIndexDeclare($name, $columns, $table);

        return static::build(
            'CREATE',
            strtoupper($type),
            $cols
        );
    }
171833
public function addColumn($acronym, $type = null, array $options = [])
    {
        if (in_array($acronym, $this->reservedColumnAcronyms)) {
            throw new ReservedColumnAcronymException($acronym);
        }

        if ($type === null) {
            $type = Column::class;
        }

        $column = new $type($acronym, $options);

        // only DoctrineTable can sort nested properties. Therefore disable them for other tables.
        if (!$this instanceof DoctrineTable && $column instanceof SortableColumnInterface && $column->isSortable()) {
            if (strpos($column->getSortExpression(), '.') !== false) {
                $column->setSortable(false);
            }
        }

        if ($column instanceof TemplateableColumnInterface) {
            $column->setTemplating($this->templating);
        }

        if ($column instanceof SortableColumnInterface) {
            $column->setTableIdentifier($this->getIdentifier());
        }

        if ($column instanceof FormattableColumnInterface) {
            $column->setFormatterManager($this->formatterManager);
        }

        $this->columns->set($acronym, $column);

        return $this;
    }
587380
public function add($name, $type = null, array $options = array(), array $fieldDescriptionOptions = array())
    {
        if (null === $this->formMapper) {
            throw new LogicException('No FormMapper to add fields to, please make sure you start with AdminUtil->map');
        }
        $this->formMapper->add($name, $type, $options, $fieldDescriptionOptions);
        if ($this->addHelp) {
            $this->formMapper->setHelps([$name => 'help' . (null !== $this->helpPrefix ? sprintf('.%s', $this->helpPrefix) : '') . '.' . $name]);
        }
        return $this;
    }
1340263
def add_column(self, name, type_name, options=None):
        
        column = Column(name, type_name, options)

        self._add_column(column)

        return column
445705
protected function indexCommand($type, $columns, $index)
    {
        $columns = (array) $columns;

        // If no name was specified for this index, we will create one using a basic
        // convention of the table name, followed by the columns, followed by an
        // index type, such as primary or index, which makes the index unique.
        if (is_null($index)) {
            $index = $this->createIndexName($type, $columns);
        }

        return $this->addCommand($type, compact('index', 'columns'));
    }
15250
public function add($columnName, FilterTypeInterface $type = null, $filterName = null, array $options = array())
    {
        $this->filterDefinitions[$columnName] = array(
            'type' => $type,
            'options' => $options,
            'filtername' => $filterName,
        );

        return $this;
    }
857839
public function setColumnType($name, $type)
    {
        $this->_columns[$name]['type'] = $type;
        $this->_typeMap[$name] = $type;

        return $this;
    }
1014655
protected function makeField($name, $type = 'text', array $options = [])
    {
        $this->setupFieldOptions($name, $options);

        $fieldName = $this->getFieldName($name);

        $fieldType = $this->getFieldType($type);

        $field = new $fieldType($fieldName, $type, $this, $options);

        $this->eventDispatcher->dispatch(new AfterFieldCreation($this, $field));

        return $field;
    }
1081640
public function addColumn( $table, $name, $type )
    {
        return $this->handler->addColumn( $table, $name, $type );
    }
378403
public function addBefore($name, $fieldName, $type = 'text', $options = [], $modify = false)
    {
        $offset = array_search($name, array_keys($this->fields));

        $beforeFields = array_slice($this->fields, 0, $offset);
        $afterFields = array_slice($this->fields, $offset);

        $this->fields = $beforeFields;

        $this->add($fieldName, $type, $options, $modify);

        $this->fields += $afterFields;

        return $this;
    }
268850
public function createIndex($bucketName, $indexName, $columns, $condition = null, &$params = [], $options = [])
    {
        $this->beginProfile($token = "    > create index $bucketName.$indexName ...");

        $result = $this->db->createIndex($bucketName, $indexName, $columns, $condition, $params, $options);

        $this->endProfile($token);

        return $result;
    }
745204
protected function createIndex($name, array $columns)
    {
        $index = new Index($name);
        $index->setColumns($columns);
        $index->resetColumnsSize();

        $this->addIndex($index);

        return $index;
    }
1191919
public RestQueryResult addColumn( String name,
                                      String type ) {
        if (!StringUtil.isBlank(name)) {
            columns.put(name, type);
        }
        return this;
    }
757763
protected function addIndex($name, $cols)
    {
        if (empty($name)) {
            return Yii::t('podium/flash', 'Installation aborted! Index name missing.');
        }
        if (empty($cols)) {
            return Yii::t('podium/flash', 'Installation aborted! Index columns missing.');
        }
        try {
            $this->db->createCommand()->createIndex($this->getIndexName($name), $this->table, $cols)->execute();
            return $this->returnSuccess(Yii::t('podium/flash', 'Table index {name} has been added', [
                'name' => $this->getIndexName($name)
            ]));
        } catch (Exception $e) {
            return $this->returnError($e->getMessage(), __METHOD__,
                Yii::t('podium/flash', 'Error during table index {name} adding', [
                    'name' => $this->getIndexName($name)
                ])
            );
        }
    }
1155480
public function addIndex($columnName, $type = Table::INDEX_REGULAR) {
        if (!array_key_exists($columnName, $this->getIndexes()) && !array_key_exists($columnName,
                        $this->newIndexes))
                $this->newIndexes[$columnName] = $type;
        return $this;
    }
793860
public function addColumn($columnName, $typeName, array $options = [])
    {
        $column = new Column($columnName, Type::getType($typeName), $options);

        $this->_addColumn($column);

        return $column;
    }