Skip to content

Commit

Permalink
ID-48: Remove completed command
Browse files Browse the repository at this point in the history
I anticipate this command being completed in prod in the next few hours,
and then we won't need to ever run it again.
  • Loading branch information
bdsl committed Jan 7, 2025
1 parent 7c60cb1 commit 28dca60
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 107 deletions.
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

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

0 comments on commit 28dca60

Please sign in to comment.