public function getAddFieldIndexSql($table, $field, $newField, $tableSet = null)
    {
        $res = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getAll("show create table {$table}");

        $tableSql = $res[0][1];

        preg_match_all("/([\w]+\s+)?\bKEY\s+(`[^`]+`)?\s*\([^)]+(\(\d++\))*\)/iU", $tableSql, $match);
        $index = $match[0];

        $usingTableSet = $tableSet ? true : false;

        if (!$tableSet) {
            $tableSet = $table;
        }

        $indexQueries = [];
        $sql = [];
        if (count($index)) {
            foreach ($index as $key => $indexQuery) {
                if (preg_match("/\([^)]*\b" . $field . "\b[^)]*\)/i", $indexQuery)) {
                    //removing index name - new will be added automaticly
                    $indexQuery = preg_replace("/(.*\bKEY\s+)`[^`]+`/", "$1", $indexQuery);

                    if ($usingTableSet) {
                        // replacing multiple fields to one (#3269)
                        $indexQuery = preg_replace("/\([^\)]+\)+/", "(`$newField`{$match[3][$key]})", $indexQuery);
                    } else {
                        //replacing previous field name with new one
                        $indexQuery = preg_replace("/\b" . $field . "\b/", $newField, $indexQuery);
                    }
                    $indexQueries[] = "ADD " . $indexQuery;
                }
            }
            if (count($indexQueries)) {
                $sql = ["ALTER TABLE `$tableSet` " . implode(", ", $indexQueries)];
            }
        }

        return $sql;
    }