<?php
declare(strict_types=1);
namespace PPSDKDoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use PlnaPenezenka\PPSDKBundle\Doctrine\Entity\AffiliateReference;
final class Version20220513060653_AffiliateRerefenceFlags extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$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');
$this->addSql("
UPDATE affiliate_references
SET
export_finished = 1
WHERE
(status = :approved AND exported_approved_when IS NOT NULL) OR
(status = :rejected AND exported_rejected_when IS NOT NULL)
", [
'approved' => AffiliateReference::STATUS_APPROVED,
'rejected' => AffiliateReference::STATUS_REJECTED,
]);
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE affiliate_references ADD message LONGTEXT NOT NULL, DROP invalid_identifier, DROP export_finished');
}
}