<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220301143644 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE election_politician (id INT AUTO_INCREMENT NOT NULL, election_id INT DEFAULT NULL, place VARCHAR(255) NOT NULL, INDEX IDX_1EE22842A708DAFF (election_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE election_politician ADD CONSTRAINT FK_1EE22842A708DAFF FOREIGN KEY (election_id) REFERENCES election (id)');
$this->addSql('ALTER TABLE election CHANGE first_round_at first_round_at DATETIME NOT NULL, CHANGE second_round_at second_round_at DATETIME DEFAULT NULL');
$this->addSql('CREATE UNIQUE INDEX UNIQ_DCA038002B36786B ON election (title)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE election_politician');
$this->addSql('DROP INDEX UNIQ_DCA038002B36786B ON election');
$this->addSql('ALTER TABLE election CHANGE first_round_at first_round_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE second_round_at second_round_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
}
}