createColumn example


    public function update($table$name$type)
    {
        if ($this->get($table$name) !== null) {
            $this->changeColumn($table$name$type);

            return;
        }

        $this->createColumn($table$name$type);
    }

    /** * @param string $table * @param string $keyColumn * * @return void */
    public function migrateAttributes($table$keyColumn)
    {
        $attributes = $this->getList($table);

        
return $query->getQuery()->getArrayResult();
    }

    /** * @param string|int|float|null $defaultValue * * @throws Exception */
    private function createAttribute(string $table, string $column, string $unifiedType, array $data = []$defaultValue = null): void
    {
        $this->schemaOperator->createColumn(
            $table,
            $column,
            $this->typeMapping->unifiedToSQL($unifiedType),
            $this->parseDefaultValue($unifiedType$defaultValue)
        );

        $data = array_merge($data[
            'tableName' => $table,
            'columnName' => $column,
            'columnType' => $unifiedType,
            'defaultValue' => $defaultValue,
        ]);
Home | Imprint | This part of the site doesn't use cookies.