|
@@ -81,12 +81,12 @@ discard block |
|
|
block discarded – undo |
|
81
|
81
|
$db = $foreignKey->db; |
|
82
|
82
|
$schema = $foreignKey->schema; |
|
83
|
83
|
$onActions = $this->driver->actions(); |
|
84
|
|
- return " FOREIGN KEY (" . implode(", ", array_map(function ($idf) { |
|
|
84
|
+ return " FOREIGN KEY (" . implode(", ", array_map(function($idf) { |
|
85
|
85
|
return $this->escapeId($idf); |
|
86
|
86
|
}, $foreignKey->source)) . ") REFERENCES " . |
|
87
|
87
|
($db != "" && $db != $this->driver->database() ? $this->escapeId($db) . "." : "") . |
|
88
|
88
|
($schema != "" && $schema != $this->driver->schema() ? $this->escapeId($schema) . "." : "") . |
|
89
|
|
- $this->table($foreignKey->table) . " (" . implode(", ", array_map(function ($idf) { |
|
|
89
|
+ $this->table($foreignKey->table) . " (" . implode(", ", array_map(function($idf) { |
|
90
|
90
|
return $this->escapeId($idf); |
|
91
|
91
|
}, $foreignKey->target)) . ")" . //! reuse $name - check in older MySQL versions |
|
92
|
92
|
(preg_match("~^($onActions)\$~", $foreignKey->onDelete) ? " ON DELETE $foreignKey->onDelete" : "") . |
|
@@ -134,8 +134,7 @@ discard block |
|
|
block discarded – undo |
|
134
|
134
|
*/ |
|
135
|
135
|
public function applySqlFunction(string $function, string $column) |
|
136
|
136
|
{ |
|
137
|
|
- return ($function ? ($function == "unixepoch" ? "DATETIME($column, '$function')" : |
|
138
|
|
- ($function == "count distinct" ? "COUNT(DISTINCT " : strtoupper("$function(")) . "$column)") : $column); |
|
|
137
|
+ return ($function ? ($function == "unixepoch" ? "DATETIME($column, '$function')" : ($function == "count distinct" ? "COUNT(DISTINCT " : strtoupper("$function(")) . "$column)") : $column); |
|
139
|
138
|
} |
|
140
|
139
|
|
|
141
|
140
|
/** |