Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ID-48: Remove completed command #191

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions identity
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@

declare(strict_types=1);

use BigGive\Identity\Application\Commands\CopyExistingPersonRecordsToMatchbot;
use BigGive\Identity\Application\Commands\DeleteUnusablePersonRecords;
use BigGive\Identity\Application\Commands\PopulateUsers;
use BigGive\Identity\Repository\PersonRepository;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;

Expand All @@ -30,7 +28,6 @@ $commands = [
$personRepository,
),
new DeleteUnusablePersonRecords($connection, $now),
$psr11App->get(CopyExistingPersonRecordsToMatchbot::class),
];

foreach ($commands as $command) {
Expand Down
76 changes: 0 additions & 76 deletions src/Application/Commands/CopyExistingPersonRecordsToMatchbot.php

This file was deleted.

1 change: 0 additions & 1 deletion src/Migrations/Version20250106114223.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public function up(Schema $schema): void
WHERE `key` = 'PersonRecordsSentToMatchBotTo' LIMIT 1;
SQL
);

}

public function down(Schema $schema): void
Expand Down
31 changes: 31 additions & 0 deletions src/Migrations/Version20250107182806.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
Copy link
Contributor Author

@bdsl bdsl Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically this migration should be deployed after the other changes in this PR, but in practice it doesn't matter if its a few seconds earlier.


declare(strict_types=1);

namespace BigGive\Identity\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20250107182806 extends AbstractMigration
{
public function getDescription(): string
{
return 'remove unused key-value pair';
}

public function up(Schema $schema): void
{
$this->addSql(<<<'SQL'
DELETE FROM KeyValue
WHERE `key` = 'PersonRecordsSentToMatchBotTo' LIMIT 1;
SQL
);
}


public function down(Schema $schema): void
{
// no-un-patch
}
}
27 changes: 0 additions & 27 deletions src/Repository/PersonRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,6 @@ class PersonRepository extends EntityRepository
private Mailer $mailerClient;
private ?RoutableMessageBus $bus = null;

/**
* @psalm-suppress MixedInferredReturnType
* @psalm-suppress LessSpecificReturnStatement
* @psalm-suppress MoreSpecificReturnType
*
* @return list<Person>
*/
public function findOldestPersonRecordsRequiringSyncToMatchbot(\DateTimeImmutable $alreadyDoneUpTo): array
{
// I'm assuming persons updated after the hard-coded date below won't need to be synced via this
// process as their records will have been synced at the time of update

$query = $this->getEntityManager()->createQuery(<<<'DQL'
SELECT p from BigGive\Identity\Domain\Person p
WHERE p.password IS NOT NULL
AND p.updated_at >= :alreadyDoneUpTO
AND p.updated_at < '2025-01-10'
ORDER BY p.updated_at ASC
DQL
);

$query->setParameter('alreadyDoneUpTO', $alreadyDoneUpTo);
$query->setMaxResults(1_000);

return $query->getResult();
}

public function findPasswordEnabledPersonByEmailAddress(string $emailAddress): ?Person
{
$qb = new QueryBuilder($this->getEntityManager());
Expand Down