diff --git a/core/Migrations/Version30000Date20240815080800.php b/core/Migrations/Version30000Date20240815080800.php index 5212467ece04e..192b8e3e0376c 100644 --- a/core/Migrations/Version30000Date20240815080800.php +++ b/core/Migrations/Version30000Date20240815080800.php @@ -24,7 +24,9 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt $schema = $schemaClosure(); $table = $schema->getTable('webauthn'); - $table->addColumn('user_verification', Types::BOOLEAN, ['notnull' => false, 'default' => false]); + if (!$table->hasColumn('user_verification')) { + $table->addColumn('user_verification', Types::BOOLEAN, ['notnull' => false, 'default' => false]); + } return $schema; } } diff --git a/core/Migrations/Version31000Date20240814184402.php b/core/Migrations/Version31000Date20240814184402.php index 14b32a704beda..0b8e5276e0a18 100644 --- a/core/Migrations/Version31000Date20240814184402.php +++ b/core/Migrations/Version31000Date20240814184402.php @@ -35,10 +35,18 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt $schema = $schemaClosure(); $table = $schema->getTable('preferences'); - $table->addColumn('lazy', Types::SMALLINT, ['notnull' => true, 'default' => 0, 'length' => 1, 'unsigned' => true]); - $table->addColumn('type', Types::SMALLINT, ['notnull' => true, 'default' => 0, 'unsigned' => true]); - $table->addColumn('flags', Types::INTEGER, ['notnull' => true, 'default' => 0, 'unsigned' => true]); - $table->addColumn('indexed', Types::STRING, ['notnull' => false, 'default' => '', 'length' => 64]); + if (!$table->hasColumn('lazy')) { + $table->addColumn('lazy', Types::SMALLINT, ['notnull' => true, 'default' => 0, 'length' => 1, 'unsigned' => true]); + } + if (!$table->hasColumn('type')) { + $table->addColumn('type', Types::SMALLINT, ['notnull' => true, 'default' => 0, 'unsigned' => true]); + } + if (!$table->hasColumn('flags')) { + $table->addColumn('flags', Types::INTEGER, ['notnull' => true, 'default' => 0, 'unsigned' => true]); + } + if (!$table->hasColumn('indexed')) { + $table->addColumn('indexed', Types::STRING, ['notnull' => false, 'default' => '', 'length' => 64]); + } // removing this index from Version13000Date20170718121200 // $table->addIndex(['appid', 'configkey'], 'preferences_app_key'); @@ -46,8 +54,12 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt $table->dropIndex('preferences_app_key'); } - $table->addIndex(['userid', 'lazy'], 'prefs_uid_lazy_i'); - $table->addIndex(['appid', 'configkey', 'indexed', 'flags'], 'prefs_app_key_ind_fl_i'); + if (!$table->hasIndex('prefs_uid_lazy_i')) { + $table->addIndex(['userid', 'lazy'], 'prefs_uid_lazy_i'); + } + if (!$table->hasIndex('prefs_app_key_ind_fl_i')) { + $table->addIndex(['appid', 'configkey', 'indexed', 'flags'], 'prefs_app_key_ind_fl_i'); + } return $schema; } diff --git a/core/Migrations/Version33000Date20251023120529.php b/core/Migrations/Version33000Date20251023120529.php index 5c04b3942084d..87998e3d6aa02 100644 --- a/core/Migrations/Version33000Date20251023120529.php +++ b/core/Migrations/Version33000Date20251023120529.php @@ -35,7 +35,9 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt if ($schema->hasTable('preview_locations')) { $table = $schema->getTable('preview_locations'); - $table->addUniqueIndex(['bucket_name', 'object_store_name'], 'unique_bucket_store'); + if (!$table->hasIndex('unique_bucket_store')) { + $table->addUniqueIndex(['bucket_name', 'object_store_name'], 'unique_bucket_store'); + } } return $schema;