vendor/plna-penezenka/pp-sdk-bundle/migrations/Version20220513060653_AffiliateRerefenceFlags.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace PPSDKDoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. use PlnaPenezenka\PPSDKBundle\Doctrine\Entity\AffiliateReference;
  7. final class Version20220513060653_AffiliateRerefenceFlags extends AbstractMigration
  8. {
  9.     public function getDescription(): string
  10.     {
  11.         return '';
  12.     }
  13.     public function up(Schema $schema): void
  14.     {
  15.         $this->addSql('ALTER TABLE affiliate_references ADD invalid_identifier TINYINT(1) DEFAULT 0 NOT NULL, ADD export_finished TINYINT(1) DEFAULT 0 NOT NULL, DROP message');
  16.         $this->addSql("
  17.             UPDATE affiliate_references
  18.             SET
  19.                 export_finished = 1
  20.             WHERE
  21.                 (status = :approved AND exported_approved_when IS NOT NULL) OR
  22.                 (status = :rejected AND exported_rejected_when IS NOT NULL)
  23.          ", [
  24.              'approved' => AffiliateReference::STATUS_APPROVED,
  25.              'rejected' => AffiliateReference::STATUS_REJECTED,
  26.         ]);
  27.     }
  28.     public function down(Schema $schema): void
  29.     {
  30.         $this->addSql('ALTER TABLE affiliate_references ADD message LONGTEXT NOT NULL, DROP invalid_identifier, DROP export_finished');
  31.     }
  32. }