Create a table.

@param string $name    the table name.
@param array  $columns the columns in the table.

@return $this
354859
public function createTable($name, $columns)
    {
        $cols = null;

        foreach ($columns as $col => $options) {
            $cols .= "\t" . $col . ' ' . implode(' ', $options) . ",\n";
        }
        $cols = substr($cols, 0, -2);

        $this->sql = "CREATE TABLE "
            . $this->prefix
            . $name
            . "\n(\n"
            . $cols
            . "\n);\n";

        if ($this->dialect == 'sqlite') {
            $this->sql = str_replace('auto_increment', '', $this->sql);
        }

        return $this;
    }
1116470
public function addColumns(array $columns)
    {
        /*
         * Build a final collection of list column objects
         */
        foreach ($columns as $columnName => $config) {
            $this->allColumns[$columnName] = $this->makeListColumn($columnName, $config);
        }
    }
711227
public function primary($columns, $name = null)
    {
        $this->addCachePrimary($columns);

        return parent::primary($columns, $name);
    }
553608
public function index($columns, $name = NULL, $algorithm = NULL)
    {
        $conn = $this->connection->getConnection();
        $db = r\db($this->connection->getDatabaseName());
        $db->table($this->table)->indexCreate($column)
            ->run($conn);

        return $this;
    }
796315
public function createIndex($name, $columns, $unique=false)
    {
        if (!is_array($columns)) {
            $columns = array($columns);
        }
        foreach ($columns as &$column) {
            $column = $this->_database->prepareIdentifier($column);
        }
        $this->_database->exec(
            sprintf(
                'CREATE %s INDEX %s ON %s (%s)',
                $unique ? 'UNIQUE' : '',
                $this->_database->prepareIdentifier($name),
                $this->_database->prepareIdentifier($this->_name),
                implode(', ', $columns)
            )
        );
        // Reset index cache to force re-read by next getIndexes() invokation
        $this->_indexes = array();
    }
1197780
public function select($columns = [])
    {
        $columns = is_array($columns) ? $columns : func_get_args();

        if (! empty($columns)) {
            $this->columns = $columns;
        }

        return $this;
    }
60388
final public function createColumnIfNotExists(Column $column): Table
    {
        if (!$this->hasColumn($column::getName())) {
            $this->createColumn($column);
        }

        return $this;
    }
1367788
public function create($columns, $options='charset=utf8 engine=innodb')
    {
        $columnSql = array();
        $platform = $this->_connection->platform();

        foreach($columns as $name=>$type)
            $columnSql []= $type->columnSql($name, $platform);

        $sql = sprintf('CREATE TABLE %s (%s) %s',
            $this->_name->quoted(),
            implode(', ', $columnSql),
            $options
        );

        $this->_connection->execute($sql);
    }
677046
public function withColumnsButIgnoringConstraints(array $columns) : Table
    {
        if ($this->columns === $columns) {
            return $this;
        }

        return new self($this->name, $columns);
    }
884302
public function columns($columns = '*')
    {
        if (false === is_array($columns) && $columns != '*') {
            $columns = func_get_args();
        }
        foreach ($columns as $column) {
            $this->sql['columns'][$column] = 1;
        }
        return $this;
    }
1250568
public function renameIndex(array $columns, string $name): AbstractTable
    {
        if (!$this->hasIndex($columns)) {
            throw new SchemaException(
                "Undefined index ['" . join("', '", $columns) . "'] in '{$this->getName()}'"
            );
        }

        //Declaring new index name
        $this->index($columns)->setName($name);

        return $this;
    }
1205812
private function buildColumns(array $columns)
    {
        $this->columns = [];
        foreach ($columns as $key => $column)
        {
            $column = new DataTableColumn($column);
            $this->columns[$key] = $column;
            if($column->getName() != ""){
                $this->columns[$column->getName()] = $column;
            }
            if($column->getData() != ""){
                $this->columns[$column->getData()] = $column;
            }
        }
    }
396371
public function setColumns(array $columns, $add = false) {
        if (!$add) {
            $this->columnDefinition = [];
        }
        foreach ($columns as $key => $def) {
            $this->addColumn($key, $def);
        }
        return $this;
    }
844662
public function createTable($name, $fields, array $constraints=[], $ifNotExists=TRUE)
	{
		$existsStr = $ifNotExists ? ' IF NOT EXISTS ' : ' ';

		// Reorganize into an array indexed with column information
		// Eg $columnArray[$colname] = array(
		// 		'type' => ...,
		// 		'constraint' => ...,
		// 		'index' => ...,
		// )
		$columnArray = \arrayZipper([
			'type' => $fields,
			'constraint' => $constraints
		]);

		// Join column definitions together
		$columns = [];
		foreach($columnArray as $n => $props)
		{
			$str = $this->getDriver()->quoteIdent($n);
			$str .= isset($props['type']) ? " {$props['type']}" : "";
			$str .= isset($props['constraint']) ? " {$props['constraint']}" : "";

			$columns[] = $str;
		}

		// Generate the sql for the creation of the table
		$sql = 'CREATE TABLE'.$existsStr.$this->getDriver()->quoteTable($name).' (';
		$sql .= implode(', ', $columns);
		$sql .= ')';

		return $sql;
	}
1302294
public function columns($columns) {
        if (is_array($columns)) {
            $this->sql .= '(`' . implode('`, `', $columns) . '`) ';
        } else if (is_string($columns)) {
            $this->sql .= "($columns) ";
        }
        return $this;
    }
1200334
public function setColumns(array $columns)
    {
        $this->mappingColumns = null;
        $this->columns = array_values($columns);

        return $this;
    }
725354
public function columns(array $columns)
    {
        foreach ($columns as $name => $value) {
            $this->columns[$this->grammar->buildId($name)] = $value;
        }

        return $this;
    }