migrations/Version20250209185625.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use App\Tools\Utils;
  5. use Doctrine\DBAL\Schema\Schema;
  6. use Doctrine\Migrations\AbstractMigration;
  7. /**
  8.  * Auto-generated Migration: Please modify to your needs!
  9.  */
  10. final class Version20250209185625 extends AbstractMigration
  11. {
  12.     public function getDescription(): string
  13.     {
  14.         return '';
  15.     }
  16.     public function up(Schema $schema): void
  17.     {
  18.         $countries $this->connection->fetchAllAssociative('SELECT id, name FROM country');
  19.         foreach ($countries as $country) {
  20.             $this->addSql('UPDATE country SET sanitized_name = ? WHERE id = ?', [
  21.                     Utils::sanitizeName($country['name']),
  22.                     $country['id']]
  23.             );
  24.         }
  25.     }
  26.     public function down(Schema $schema): void
  27.     {
  28.     }
  29. }