Fix handling of multi column foreign keys (bug #946861).
This commit is contained in:
@@ -261,7 +261,7 @@ function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false)
|
||||
$tmpres[1] = preg_replace('/^CREATE TABLE/', 'CREATE TABLE IF NOT EXISTS', $tmpres[1]);
|
||||
}
|
||||
|
||||
if (preg_match_all('((,\r?\n[\s]*(CONSTRAINT|FOREIGN[\s]*KEY)[^\r\n,]+)+)', $tmpres[1], $regs)) {
|
||||
if (preg_match_all('((,\r?\n[\s]*(CONSTRAINT|FOREIGN[\s]*KEY)[^\r\n]+)+)', $tmpres[1], $regs)) {
|
||||
if (!isset($sql_constraints)) {
|
||||
if (isset($GLOBALS['no_constraints_comments'])) {
|
||||
$sql_constraints = '';
|
||||
@@ -277,7 +277,7 @@ function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false)
|
||||
$sql_constraints .= 'ALTER TABLE ' . PMA_backquote($table) . $crlf
|
||||
. preg_replace('/(,\r?\n|^)([\s]*)(CONSTRAINT|FOREIGN[\s]*KEY)/', '\1\2ADD \3', substr($regs[0][0], 2))
|
||||
. ";\n";
|
||||
$tmpres[1] = preg_replace('((,\r?\n[\s]*(CONSTRAINT|FOREIGN[\s]*KEY)[^\r\n,]+)+)', '', $tmpres[1]);
|
||||
$tmpres[1] = preg_replace('((,\r?\n[\s]*(CONSTRAINT|FOREIGN[\s]*KEY)[^\r\n]+)+)', '', $tmpres[1]);
|
||||
}
|
||||
$schema_create .= $tmpres[1];
|
||||
}
|
||||
|
Reference in New Issue
Block a user