<?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 Version20220913200603 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 history_presidential_canditate (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 (id INT AUTO_INCREMENT NOT NULL, year VARCHAR(4) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$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');
$this->addSql('CREATE TABLE history_presidential_second_round (id INT AUTO_INCREMENT NOT NULL, year VARCHAR(4) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$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');
$this->addSql('CREATE TABLE history_vote (id INT AUTO_INCREMENT NOT NULL, citizen_id INT NOT NULL, year VARCHAR(4) NOT NULL, second_round VARCHAR(255) NOT NULL, first_round VARCHAR(255) NOT NULL, INDEX IDX_5125F518A63C3C2E (citizen_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$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('ALTER TABLE history_vote ADD CONSTRAINT FK_5125F518A63C3C2E FOREIGN KEY (citizen_id) REFERENCES citizen (id)');
}
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_canditate DROP FOREIGN KEY FK_CCF0E326B26F3D7D');
$this->addSql('ALTER TABLE history_presidential_second_round_history_presidential_canditate DROP FOREIGN KEY FK_4E92AE10B26F3D7D');
$this->addSql('ALTER TABLE history_presidential_first_round_history_presidential_canditate DROP FOREIGN KEY FK_CCF0E3262D65FB7B');
$this->addSql('ALTER TABLE history_presidential_second_round_history_presidential_canditate DROP FOREIGN KEY FK_4E92AE107893FD70');
$this->addSql('DROP TABLE history_presidential_canditate');
$this->addSql('DROP TABLE history_presidential_first_round');
$this->addSql('DROP TABLE history_presidential_first_round_history_presidential_canditate');
$this->addSql('DROP TABLE history_presidential_second_round');
$this->addSql('DROP TABLE history_presidential_second_round_history_presidential_canditate');
$this->addSql('DROP TABLE history_vote');
}
}