Add migration to fix wrong index on type (fixes #1884)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -39,7 +39,8 @@ class Version1000Date20200308073933 extends SimpleMigrationStep {
|
|||||||
'notnull' => true,
|
'notnull' => true,
|
||||||
'default' => 0
|
'default' => 0
|
||||||
]);
|
]);
|
||||||
$table->addIndex(['participant'], 'deck_assigned_users_idx_t');
|
//$table->addIndex(['participant'], 'deck_assigned_users_idx_t');
|
||||||
|
$table->addIndex(['type'], 'deck_assigned_users_idx_ty');
|
||||||
|
|
||||||
return $schema;
|
return $schema;
|
||||||
}
|
}
|
||||||
|
|||||||
36
lib/Migration/Version10200Date20201111150114.php
Normal file
36
lib/Migration/Version10200Date20201111150114.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace OCA\Deck\Migration;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use OCP\DB\ISchemaWrapper;
|
||||||
|
use OCP\Migration\IOutput;
|
||||||
|
use OCP\Migration\SimpleMigrationStep;
|
||||||
|
|
||||||
|
class Version10200Date20201111150114 extends SimpleMigrationStep {
|
||||||
|
|
||||||
|
|
||||||
|
function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
|
||||||
|
/** @var ISchemaWrapper $schema */
|
||||||
|
$schema = $schemaClosure();
|
||||||
|
|
||||||
|
// Fix wrong index added in Version1000Date20200308073933
|
||||||
|
$table = $schema->getTable('deck_assigned_users');
|
||||||
|
if ($table->hasIndex('deck_assigned_users_idx_t')) {
|
||||||
|
$table->dropIndex('deck_assigned_users_idx_t');
|
||||||
|
if (!$table->hasIndex('deck_assigned_users_idx_ty')) {
|
||||||
|
$table->addIndex(['type'], 'deck_assigned_users_idx_ty');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user