<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Exception;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230223162319 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE customer DROP address1, DROP address2, DROP address3, DROP address4, DROP postcode');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE customer ADD address1 VARCHAR(255) NULL, ADD address2 VARCHAR(255) DEFAULT NULL, ADD address3 VARCHAR(255) DEFAULT NULL, ADD address4 VARCHAR(255) DEFAULT NULL, ADD postcode VARCHAR(255) NULL');
$this->addSql(
'UPDATE customer SET address1 = :address1, postcode = :postcode',
[
'address1' => ' ',
'postcode' => ' ',
]
);
$this->addSql('ALTER TABLE customer MODIFY address1 VARCHAR(255) NOT NULL, MODIFY postcode VARCHAR(255) NOT NULL');
}
/**
* @throws Exception
*/
private function getData(string $sql): \Traversable
{
return $this->connection->executeQuery($sql)->iterateAssociative();
}
}