<?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 Version20220301151104 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('DROP TABLE election_politician');
$this->addSql('ALTER TABLE election DROP type');
$this->addSql('ALTER TABLE politician ADD election_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE politician ADD CONSTRAINT FK_B39BFB49A708DAFF FOREIGN KEY (election_id) REFERENCES election (id)');
$this->addSql('CREATE INDEX IDX_B39BFB49A708DAFF ON politician (election_id)');
}
public function down(Schema $schema): void
{
// this down() 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) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, INDEX IDX_1EE22842A708DAFF (election_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE election_politician ADD CONSTRAINT FK_1EE22842A708DAFF FOREIGN KEY (election_id) REFERENCES election (id)');
$this->addSql('ALTER TABLE election ADD type VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE politician DROP FOREIGN KEY FK_B39BFB49A708DAFF');
$this->addSql('DROP INDEX IDX_B39BFB49A708DAFF ON politician');
$this->addSql('ALTER TABLE politician DROP election_id');
}
}