Skip to content

Commit

Permalink
fixup! fix(caldav): automatically delete outdated scheduling objects
Browse files Browse the repository at this point in the history
  • Loading branch information
miaulalala committed Jun 3, 2024
1 parent a152fb9 commit f4b3f7b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions core/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ function (GenericEvent $event) use ($container) {
if (!$table->hasIndex('schedulobj_principuri_index')) {
$subject->addHintForMissingSubject($table->getName(), 'schedulobj_principuri_index');
}
$table = $schema->getTable('schedulingobjects');
if (!$table->hasIndex('schedulobj_lastmodified_idx')) {
$subject->addHintForMissingSubject($table->getName(), 'schedulobj_lastmodified_idx');
}
}

if ($schema->hasTable('properties')) {
Expand Down
12 changes: 11 additions & 1 deletion core/Command/Db/AddMissingIndices.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,18 @@ private function addCoreIndexes(OutputInterface $output, bool $dryRun): void {
$output->writeln($sqlQueries);
}
$updated = true;
$output->writeln('<info>schedulingobjects table updated successfully.</info>');
}
if (!$table->hasIndex('schedulobj_lastmodified_idx')) {
$output->writeln('<info>Adding schedulobj_lastmodified_idx index to the schedulingobjects table, this can take some time...</info>');

$table->addIndex(['lastmodified'], 'schedulobj_lastmodified_idx');
$sqlQueries = $this->connection->migrateToSchema($schema->getWrappedSchema(), $dryRun);
if ($dryRun && $sqlQueries !== null) {
$output->writeln($sqlQueries);
}
$updated = true;
}
$output->writeln('<info>schedulingobjects table updated successfully.</info>');
}

$output->writeln('<info>Check indices of the oc_properties table.</info>');
Expand Down

0 comments on commit f4b3f7b

Please sign in to comment.