<?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 Version20220914055909 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('ALTER TABLE history_presidential_first_round_history_presidential_canditate DROP FOREIGN KEY FK_CCF0E326B26F3D7D');
$this->addSql('ALTER TABLE history_presidential_second_round_history_presidential_canditate DROP FOREIGN KEY FK_4E92AE10B26F3D7D');
$this->addSql('CREATE TABLE history_presidential_candidate (id INT AUTO_INCREMENT NOT NULL, firstname VARCHAR(255) NOT NULL, lastname VARCHAR(255) NOT NULL, avatar VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE history_presidential_first_round_history_presidential_candidate (history_presidential_first_round_id INT NOT NULL, history_presidential_candidate_id INT NOT NULL, INDEX IDX_9CE9B4B92D65FB7B (history_presidential_first_round_id), INDEX IDX_9CE9B4B9D5B1A1B3 (history_presidential_candidate_id), PRIMARY KEY(history_presidential_first_round_id, history_presidential_candidate_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE history_presidential_second_round_history_presidential_candidate (history_presidential_second_round_id INT NOT NULL, history_presidential_candidate_id INT NOT NULL, INDEX IDX_1E8BF98F7893FD70 (history_presidential_second_round_id), INDEX IDX_1E8BF98FD5B1A1B3 (history_presidential_candidate_id), PRIMARY KEY(history_presidential_second_round_id, history_presidential_candidate_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE history_presidential_first_round_history_presidential_candidate ADD CONSTRAINT FK_9CE9B4B92D65FB7B FOREIGN KEY (history_presidential_first_round_id) REFERENCES history_presidential_first_round (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE history_presidential_first_round_history_presidential_candidate ADD CONSTRAINT FK_9CE9B4B9D5B1A1B3 FOREIGN KEY (history_presidential_candidate_id) REFERENCES history_presidential_candidate (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE history_presidential_second_round_history_presidential_candidate ADD CONSTRAINT FK_1E8BF98F7893FD70 FOREIGN KEY (history_presidential_second_round_id) REFERENCES history_presidential_second_round (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE history_presidential_second_round_history_presidential_candidate ADD CONSTRAINT FK_1E8BF98FD5B1A1B3 FOREIGN KEY (history_presidential_candidate_id) REFERENCES history_presidential_candidate (id) ON DELETE CASCADE');
$this->addSql('DROP TABLE history_presidential_canditate');
$this->addSql('DROP TABLE history_presidential_first_round_history_presidential_canditate');
$this->addSql('DROP TABLE history_presidential_second_round_history_presidential_canditate');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE history_presidential_first_round_history_presidential_candidate DROP FOREIGN KEY FK_9CE9B4B9D5B1A1B3');
$this->addSql('ALTER TABLE history_presidential_second_round_history_presidential_candidate DROP FOREIGN KEY FK_1E8BF98FD5B1A1B3');
$this->addSql('CREATE TABLE history_presidential_canditate (id INT AUTO_INCREMENT NOT NULL, firstname VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, lastname VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, avatar VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE history_presidential_first_round_history_presidential_canditate (history_presidential_first_round_id INT NOT NULL, history_presidential_canditate_id INT NOT NULL, INDEX IDX_CCF0E3262D65FB7B (history_presidential_first_round_id), INDEX IDX_CCF0E326B26F3D7D (history_presidential_canditate_id), PRIMARY KEY(history_presidential_first_round_id, history_presidential_canditate_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE history_presidential_second_round_history_presidential_canditate (history_presidential_second_round_id INT NOT NULL, history_presidential_canditate_id INT NOT NULL, INDEX IDX_4E92AE107893FD70 (history_presidential_second_round_id), INDEX IDX_4E92AE10B26F3D7D (history_presidential_canditate_id), PRIMARY KEY(history_presidential_second_round_id, history_presidential_canditate_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE history_presidential_first_round_history_presidential_canditate ADD CONSTRAINT FK_CCF0E3262D65FB7B FOREIGN KEY (history_presidential_first_round_id) REFERENCES history_presidential_first_round (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE history_presidential_first_round_history_presidential_canditate ADD CONSTRAINT FK_CCF0E326B26F3D7D FOREIGN KEY (history_presidential_canditate_id) REFERENCES history_presidential_canditate (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE history_presidential_second_round_history_presidential_canditate ADD CONSTRAINT FK_4E92AE107893FD70 FOREIGN KEY (history_presidential_second_round_id) REFERENCES history_presidential_second_round (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE history_presidential_second_round_history_presidential_canditate ADD CONSTRAINT FK_4E92AE10B26F3D7D FOREIGN KEY (history_presidential_canditate_id) REFERENCES history_presidential_canditate (id) ON DELETE CASCADE');
$this->addSql('DROP TABLE history_presidential_candidate');
$this->addSql('DROP TABLE history_presidential_first_round_history_presidential_candidate');
$this->addSql('DROP TABLE history_presidential_second_round_history_presidential_candidate');
}
}