migrations/Version20220914055909.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20220914055909 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('ALTER TABLE history_presidential_first_round_history_presidential_canditate DROP FOREIGN KEY FK_CCF0E326B26F3D7D');
  19.         $this->addSql('ALTER TABLE history_presidential_second_round_history_presidential_canditate DROP FOREIGN KEY FK_4E92AE10B26F3D7D');
  20.         $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');
  21.         $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');
  22.         $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');
  23.         $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');
  24.         $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');
  25.         $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');
  26.         $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');
  27.         $this->addSql('DROP TABLE history_presidential_canditate');
  28.         $this->addSql('DROP TABLE history_presidential_first_round_history_presidential_canditate');
  29.         $this->addSql('DROP TABLE history_presidential_second_round_history_presidential_canditate');
  30.     }
  31.     public function down(Schema $schema): void
  32.     {
  33.         // this down() migration is auto-generated, please modify it to your needs
  34.         $this->addSql('ALTER TABLE history_presidential_first_round_history_presidential_candidate DROP FOREIGN KEY FK_9CE9B4B9D5B1A1B3');
  35.         $this->addSql('ALTER TABLE history_presidential_second_round_history_presidential_candidate DROP FOREIGN KEY FK_1E8BF98FD5B1A1B3');
  36.         $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 = \'\' ');
  37.         $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 = \'\' ');
  38.         $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 = \'\' ');
  39.         $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');
  40.         $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');
  41.         $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');
  42.         $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');
  43.         $this->addSql('DROP TABLE history_presidential_candidate');
  44.         $this->addSql('DROP TABLE history_presidential_first_round_history_presidential_candidate');
  45.         $this->addSql('DROP TABLE history_presidential_second_round_history_presidential_candidate');
  46.     }
  47. }