|
|
|
@ -140,6 +140,87 @@ class AddMissingIndices extends Command { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$output->writeln('<info>Check indices of the login_flow_v2 table.</info>'); |
|
|
|
if ($schema->hasTable('login_flow_v2')) { |
|
|
|
$table = $schema->getTable('login_flow_v2'); |
|
|
|
if (!$table->hasIndex('poll_token')) { |
|
|
|
$output->writeln('<info>Adding additional indeces to the login_flow_v2 table, this can take some time...</info>'); |
|
|
|
|
|
|
|
foreach ($table->getIndexes() as $index) { |
|
|
|
$columns = $index->getColumns(); |
|
|
|
if ($columns === ['poll_token'] || |
|
|
|
$columns === ['login_token'] || |
|
|
|
$columns === ['timestamp']) { |
|
|
|
$table->dropIndex($index->getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$table->addUniqueIndex(['poll_token'], 'poll_token'); |
|
|
|
$table->addUniqueIndex(['login_token'], 'login_token'); |
|
|
|
$table->addIndex(['timestamp'], 'timestamp'); |
|
|
|
$this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
|
|
$updated = true; |
|
|
|
$output->writeln('<info>login_flow_v2 table updated successfully.</info>'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$output->writeln('<info>Check indices of the whats_new table.</info>'); |
|
|
|
if ($schema->hasTable('whats_new')) { |
|
|
|
$table = $schema->getTable('whats_new'); |
|
|
|
if (!$table->hasIndex('version')) { |
|
|
|
$output->writeln('<info>Adding version index to the whats_new table, this can take some time...</info>'); |
|
|
|
|
|
|
|
foreach ($table->getIndexes() as $index) { |
|
|
|
if ($index->getColumns() === ['version']) { |
|
|
|
$table->dropIndex($index->getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$table->addUniqueIndex(['version'], 'version'); |
|
|
|
$this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
|
|
$updated = true; |
|
|
|
$output->writeln('<info>whats_new table updated successfully.</info>'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$output->writeln('<info>Check indices of the cards table.</info>'); |
|
|
|
if ($schema->hasTable('cards')) { |
|
|
|
$table = $schema->getTable('cards'); |
|
|
|
if (!$table->hasIndex('cards_abid')) { |
|
|
|
$output->writeln('<info>Adding cards_abid index to the cards table, this can take some time...</info>'); |
|
|
|
|
|
|
|
foreach ($table->getIndexes() as $index) { |
|
|
|
if ($index->getColumns() === ['addressbookid']) { |
|
|
|
$table->dropIndex($index->getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$table->addIndex(['addressbookid'], 'cards_abid'); |
|
|
|
$this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
|
|
$updated = true; |
|
|
|
$output->writeln('<info>cards table updated successfully.</info>'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$output->writeln('<info>Check indices of the cards_properties table.</info>'); |
|
|
|
if ($schema->hasTable('cards_properties')) { |
|
|
|
$table = $schema->getTable('cards_properties'); |
|
|
|
if (!$table->hasIndex('cards_prop_abid')) { |
|
|
|
$output->writeln('<info>Adding cards_prop_abid index to the cards_properties table, this can take some time...</info>'); |
|
|
|
|
|
|
|
foreach ($table->getIndexes() as $index) { |
|
|
|
if ($index->getColumns() === ['addressbookid']) { |
|
|
|
$table->dropIndex($index->getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$table->addIndex(['addressbookid'], 'cards_prop_abid'); |
|
|
|
$this->connection->migrateToSchema($schema->getWrappedSchema()); |
|
|
|
$updated = true; |
|
|
|
$output->writeln('<info>cards_properties table updated successfully.</info>'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!$updated) { |
|
|
|
$output->writeln('<info>Done.</info>'); |
|
|
|
} |
|
|
|
|