source/Core/DbMetaDataHandler.php
public function getAddFieldSql($table, $field, $newField, $prevField, $tableSet = null)
    {
        if (!$tableSet) {
            $tableSet = $table;
        }
        $res = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getAll("show create table {$table}");
        $tableSql = $res[0][1];

        // removing comments;
        $tableSql = preg_replace('/COMMENT \\\'.*?\\\'/', '', $tableSql);
        preg_match("/.*,\s+(['`]?" . preg_quote($field, '/') . "['`]?\s+[^,]+),.*/", $tableSql, $match);
        $fieldSql = $match[1];

        $sql = "";
        if (!empty($fieldSql)) {
            $fieldSql = preg_replace("/" . preg_quote($field, '/') . "/", $newField, $fieldSql);
            $sql = "ALTER TABLE `$tableSet` ADD " . $fieldSql;
            if ($this->tableExists($tableSet) && $this->fieldExists($prevField, $tableSet)) {
                $sql .= " AFTER `$prevField`";
            }
        }

        return $sql;
    }
public function getAddFieldSql($table, $field, $newField, $prevField, $tableSet = null)
    {
        if (!$tableSet) {
            $tableSet = $table;
        }
        $res = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getAll("show create table {$table}");
        $tableSql = $res[0][1];

        // removing comments;
        $tableSql = preg_replace('/COMMENT \\\'.*?\\\'/', '', $tableSql);
        preg_match("/.*,\s+(['`]?" . preg_quote($field, '/') . "['`]?\s+[^,]+),.*/", $tableSql, $match);
        $fieldSql = $match[1];

        $sql = "";
        if (!empty($fieldSql)) {
            $fieldSql = preg_replace("/" . preg_quote($field, '/') . "/", $newField, $fieldSql);
            $sql = "ALTER TABLE `$tableSet` ADD " . $fieldSql;
            if ($this->tableExists($tableSet) && $this->fieldExists($prevField, $tableSet)) {
                $sql .= " AFTER `$prevField`";
            }
        }

        return $sql;
    }
public function getAddFieldSql ( $ table , $ field , $ newField , $ prevField , $ tableSet = null ) { if ( ! $ tableSet ) { $ tableSet = $ table ; } $ res = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) -> getAll ( "show create table {$table}" ) ; $ tableSql = $ res [ 0 ] [ 1 ] ; // removing comments; $ tableSql = preg_replace ( '/COMMENT \\\'.*?\\\'/' , '' , $ tableSql ) ; preg_match ( "/.*,\s+(['`]?" . preg_quote ( $ field , '/' ) . "['`]?\s+[^,]+),.*/" , $ tableSql , $ match ) ; $ fieldSql = $ match [ 1 ] ; $ sql = "" ; if ( ! empty ( $ fieldSql ) ) { $ fieldSql = preg_replace ( "/" . preg_quote ( $ field , '/' ) . "/" , $ newField , $ fieldSql ) ; $ sql = "ALTER TABLE `$tableSet` ADD " . $ fieldSql ; if ( $ this -> tableExists ( $ tableSet ) && $ this -> fieldExists ( $ prevField , $ tableSet ) ) { $ sql .= " AFTER `$prevField`" ; } } return $ sql ; }
Get sql for new multi-language field creation

@param string $table     core table name
@param string $field     field name
@param string $newField  new field name
@param string $prevField previous field in table
@param string $tableSet  table to change (if not set take core table)

@return string
Get sql for new multi - language field creation