Skip to content

Commit

Permalink
Applying variable naming scheme, returning schema only if changes are…
Browse files Browse the repository at this point in the history
… made for performance and removing the original

creation of the indicies for new installations

Signed-off-by: Rob Emery <[email protected]>
  • Loading branch information
mintsoft committed Feb 29, 2024
1 parent f4b6cea commit 0cdaad8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/Migration/Version1000Date20200306161713.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
]);
$table->setPrimaryKey(['id']);
$table->addIndex(['participant'], 'deck_assigned_users_idx_p');
$table->addIndex(['card_id'], 'deck_assigned_users_idx_c');
//$table->addIndex(['card_id'], 'deck_assigned_users_idx_c');
}

if (!$schema->hasTable('deck_board_acl')) {
Expand Down Expand Up @@ -304,7 +304,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
]);
$table->setPrimaryKey(['id']);
$table->addUniqueIndex(['board_id', 'type', 'participant'], 'deck_board_acl_uq_i');
$table->addIndex(['board_id'], 'deck_board_acl_idx_i');
//$table->addIndex(['board_id'], 'deck_board_acl_idx_i');
}
return $schema;
}
Expand Down
17 changes: 10 additions & 7 deletions lib/Migration/Version11000Date20240222115515.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,19 @@
class Version11000Date20240222115515 extends SimpleMigrationStep {
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
$schema = $schemaClosure();
$returnValue = NULL;

$assigned_users_table = $schema->getTable('deck_assigned_users');
if($assigned_users_table->hasIndex('deck_assigned_users_idx_c')) {
$assigned_users_table->dropIndex('deck_assigned_users_idx_c');
$assignedUsersTable = $schema->getTable('deck_assigned_users');
if($assignedUsersTable->hasIndex('deck_assigned_users_idx_c')) {
$assignedUsersTable->dropIndex('deck_assigned_users_idx_c');
$returnValue = $schema;
}

$board_acl_table = $schema->getTable('deck_board_acl');
if($board_acl_table->hasIndex('deck_board_acl_idx_i')) {
$board_acl_table->dropIndex('deck_board_acl_idx_i');
$boardAclTable = $schema->getTable('deck_board_acl');
if($boardAclTable->hasIndex('deck_board_acl_idx_i')) {
$boardAclTable->dropIndex('deck_board_acl_idx_i');
$returnValue = $schema;
}
return $schema;
return $returnValue;
}
}

0 comments on commit 0cdaad8

Please sign in to comment.