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:
Markus Bauer 2022-09-27 21:41:08 +02:00 committed by GitHub
parent a5a0ccd551
commit ef8fee29b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -55,6 +55,10 @@ It means that composer will look at `master` branch of repository configured und
## Changelog
### 2022-09-27
- Fixed multiple `CREATE UNIQUE INDEX` statements from schema shell that did not work on PostgreSQL.
### 2022-03-08
- Fixed passing `params["pass"]` argument to `invokeArgs` when resolving controller action - `array_values` used to avoid problems with named parameters.

View file

@ -488,7 +488,7 @@ class DboSource extends DataSource {
*/
protected function _execute($sql, $params = array(), $prepareOptions = array()) {
$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));
if (count($statements) > 1) {
$result = array_map(array($this, '_execute'), $statements);