migrations/Version20231121133017.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20231121133017 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('UPDATE user u
  19.             SET deleted = true,
  20.             deleted_at = (SELECT deleted_at FROM shop s WHERE u.shop_id = s.id),
  21.             email = concat("deleted-", FLOOR(1 + RAND() * 60 ), "-", email),
  22.             username = concat("deleted-", FLOOR(1 + RAND() * 60 ), "-", username),
  23.             phone = null
  24.             WHERE shop_id IN (
  25.                 SELECT s.id
  26.                 FROM shop s
  27.                 WHERE s.deleted = true AND s.deleted_at IS NOT NULL
  28.             )
  29.             AND u.deleted = false AND u.deleted_at IS NULL
  30.         ');
  31.     }
  32.     public function down(Schema $schema): void
  33.     {
  34.         // this down() migration is auto-generated, please modify it to your needs
  35.     }
  36. }