mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix schema migration that creates multiple UNIQUE indexes at once (#18)
* Fix schema migration that creates multiple UNIQUE indexes at once * Add to changelog Co-authored-by: Markus Bauer <markus.bauer@cispa.saarland>
This commit is contained in:
parent
a5a0ccd551
commit
ef8fee29b2
2 changed files with 5 additions and 1 deletions
|
@ -55,6 +55,10 @@ It means that composer will look at `master` branch of repository configured und
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
### 2022-09-27
|
||||||
|
|
||||||
|
- Fixed multiple `CREATE UNIQUE INDEX` statements from schema shell that did not work on PostgreSQL.
|
||||||
|
|
||||||
### 2022-03-08
|
### 2022-03-08
|
||||||
|
|
||||||
- Fixed passing `params["pass"]` argument to `invokeArgs` when resolving controller action - `array_values` used to avoid problems with named parameters.
|
- Fixed passing `params["pass"]` argument to `invokeArgs` when resolving controller action - `array_values` used to avoid problems with named parameters.
|
||||||
|
|
|
@ -488,7 +488,7 @@ class DboSource extends DataSource {
|
||||||
*/
|
*/
|
||||||
protected function _execute($sql, $params = array(), $prepareOptions = array()) {
|
protected function _execute($sql, $params = array(), $prepareOptions = array()) {
|
||||||
$sql = trim($sql);
|
$sql = trim($sql);
|
||||||
if (preg_match('/^(?:CREATE|ALTER|DROP)\s+(?:TABLE|INDEX)/i', $sql)) {
|
if (preg_match('/^(?:CREATE|ALTER|DROP)\s+(?:UNIQUE\s+)?(?:TABLE|INDEX)/i', $sql)) {
|
||||||
$statements = array_filter(explode(';', $sql));
|
$statements = array_filter(explode(';', $sql));
|
||||||
if (count($statements) > 1) {
|
if (count($statements) > 1) {
|
||||||
$result = array_map(array($this, '_execute'), $statements);
|
$result = array_map(array($this, '_execute'), $statements);
|
||||||
|
|
Loading…
Reference in a new issue