Skip to content

Commit 7e0d643

Browse files
committed
skip unique index creation, if index already exists
Signed-off-by: dartcafe <github@dartcafe.de>
1 parent 991ebca commit 7e0d643

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

lib/Db/V6/IndexManager.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ public function createUniqueIndices(): array {
3939

4040
foreach (TableSchema::UNIQUE_INDICES as $tableName => $uniqueIndices) {
4141
foreach ($uniqueIndices as $name => $definition) {
42+
43+
// skip if the unique index exists
44+
if ($this->schema->hasTable($this->getTableName($tableName))) {
45+
$table = $this->schema->getTable($this->getTableName($tableName));
46+
if ($table->hasIndex($name)) {
47+
continue;
48+
}
49+
}
4250
$messages[] = $this->createIndex($tableName, $name, $definition['columns'], true);
4351
}
4452
}

0 commit comments

Comments
 (0)