Declare table creation with specific set of columns

@param string $table
@param array  $columns
553610
public function declareCreation(string $table, array $columns)
    {
        $source = $this->method('up')->getSource();

        $source->addLine("\$this->table('{$table}')");
        foreach ($columns as $name => $type) {
            $source->addLine("    ->addColumn('{$name}', '{$type}')");
        }

        $source->addLine("    ->create();");

        $this->method('down')->getSource()->addString("\$this->table('{$table}')->drop();");
    }
449111
public function initialize(Table $table)
    {
        $this->table = $table;
        $this->table->setData($this->getData());
    }
947587
public function from($table, array $columns = null)
    {
        $this->q['from']['table'] = $table;

        if (isset($columns)) {
            $this->q['from']['columns'] = $columns;
        }

        return $this;
    }
507511
public function addColumns($columns)
    {
        foreach ($columns as $name => $value) {
            try {
                $this->addColumn($name, $value);
            } catch (Exception $e) {
            }
        }

        if (!empty($e)) {
            throw $e;
        }
    }
1200334
public function setColumns(array $columns)
    {
        $this->mappingColumns = null;
        $this->columns = array_values($columns);

        return $this;
    }
420554
private function createTable(Table $table)
    {
        if ($this->getSqlStatements) {
            $createFlags = AbstractPlatform::CREATE_INDEXES |
                AbstractPlatform::CREATE_FOREIGNKEYS;
            $this->addSql(
                $this->getPlatform()
                    ->getCreateTableSQL($table, $createFlags)
            );
        } else {
            $this->schemaManager->createTable($table);
        }
    }
1023547
public function indexExists( $table, $columns = [ ] )
    {
        $indexes = $this->getTableIndexes( $table );

        $name = '';

        $this->prepareIndexName( $columns, $name );

        foreach ( $indexes as $index )
        {
            if ( $index === $name )
            {
                return TRUE;
            }
        }

        return FALSE;
    }
968761
private function createFromCsv(array $data, string $table) : void
    {
        foreach ($data as $col) {
            $csvField = new CsvField($col);
            $dbFields = $this->factory->fieldToDb($csvField, $table);

            if (empty($dbFields)) {
                continue;
            }

            foreach ($dbFields as $dbField) {
                $this->createColumn($dbField);
            }
        }
    }
303675
public function setColumns(array $columns)
    {
        foreach ($columns as $column) {
            $this->columns[] = new Request\Column($column);
        }

        return $this;
    }
309307
public function select($columns = [])
    {
        $expr = new ColumnExpression($this->sql);

        if ($columns instanceof Closure) {
            $columns($expr);
        } else {
            if (!is_array($columns)) {
                $columns = [$columns];
            }
            $expr->columns($columns);
        }
    }
848890
protected function createTable(Table $table): void
	{
		$table->addPrimaryKey('id')
			->int()
			->setAutoIncrement();
		$table->addForeignKey('pageId', PagesMapper::class);
		$table->addColumn('name')
			->varChar();
		$table->addColumn('position')
			->int(3);
	}
933073
function columns(array $columns)
    {
        foreach ($columns as &$col) {
            if (!$col instanceof Attribute) {
                $col = new UnqualifiedColumn($col);
            }
        }
        $this->nodes->columns = $columns;
        return $this;
    }
445391
protected function insert_chunk($table, array $chunk, array $columns) {
        $i = 1;
        $params = array();
        $values = array();
        foreach ($chunk as $dataobject) {
            $vals = array();
            foreach ($columns as $field => $column) {
                $params[] = $this->normalise_value($column, $dataobject[$field]);
                $vals[] = "\$".$i++;
            }
            $values[] = '('.implode(',', $vals).')';
        }

        $fieldssql = '('.implode(',', array_keys($columns)).')';
        $valuessql = implode(',', $values);

        $sql = "INSERT INTO {$this->prefix}$table $fieldssql VALUES $valuessql";
        $this->query_start($sql, $params, SQL_QUERY_INSERT);
        $result = pg_query_params($this->pgsql, $sql, $params);
        $this->query_end($result);
        pg_free_result($result);
    }
336953
protected function insert_chunk($table, array $chunk, array $columns) {
        $fieldssql = '('.implode(',', array_keys($columns)).')';

        $valuessql = '('.implode(',', array_fill(0, count($columns), '?')).')';
        $valuessql = implode(',', array_fill(0, count($chunk), $valuessql));

        $params = array();
        foreach ($chunk as $dataobject) {
            foreach ($columns as $field => $column) {
                $params[] = $this->normalise_value($column, $dataobject[$field]);
            }
        }

        $sql = "INSERT INTO {$this->prefix}$table $fieldssql VALUES $valuessql";

        list($sql, $params, $type) = $this->fix_sql_params($sql, $params);
        $rawsql = $this->emulate_bound_params($sql, $params);

        $this->query_start($sql, $params, SQL_QUERY_INSERT);
        $result = $this->mysqli->query($rawsql);
        $this->query_end($result);
    }
348161
public function setTable($table)
    {
        if (is_array($table)) {
            if (!isset($table['name'])) {
                throw new \InvalidArgumentException('A name key is required when passing an array to setTable()');
            }
            $this->table = $table['name'];
        } else {
            $this->table = $table;
        }
    }
475305
public function setTables(array $tables)
    {
        $this->tables = array();

        foreach ($tables as $table) {
            $this->addTable($table);
        }
    }
332425
public function join($table, $on, array $columns = array())
    {
        if (!array_key_exists('joins', $this->query)) {
            $this->query['joins'] = array();
        }

        $this->query['select'] = array_merge($this->query['select'], $columns);
        $this->query['joins'][] = array($table, $on);

        return $this;
    }