Skip to content

Commit 22fa192

Browse files
Merge pull request #47125 from nextcloud/backport/47116/stable28
[stable28] fix(migration): Add column only if it does not exist
2 parents df821f6 + 4218e7f commit 22fa192

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

core/Migrations/Version13000Date20170718121200.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,12 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
150150
$table->addIndex(['user_id', 'root_id', 'mount_point'], 'mounts_user_root_path_index', [], ['lengths' => [null, null, 128]]);
151151
} else {
152152
$table = $schema->getTable('mounts');
153-
$table->addColumn('mount_id', Types::BIGINT, [
154-
'notnull' => false,
155-
'length' => 20,
156-
]);
153+
if (!$table->hasColumn('mount_id')) {
154+
$table->addColumn('mount_id', Types::BIGINT, [
155+
'notnull' => false,
156+
'length' => 20,
157+
]);
158+
}
157159
if (!$table->hasIndex('mounts_mount_id_index')) {
158160
$table->addIndex(['mount_id'], 'mounts_mount_id_index');
159161
}

0 commit comments

Comments
 (0)