<?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 Version20221011130436 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 poll (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE poll_answer (id INT AUTO_INCREMENT NOT NULL, poll_id INT NOT NULL, content LONGTEXT NOT NULL, INDEX IDX_36D8097E3C947C0F (poll_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE poll_result (id INT AUTO_INCREMENT NOT NULL, poll_answer_id INT NOT NULL, INDEX IDX_FF6F824861E461F3 (poll_answer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE poll_answer ADD CONSTRAINT FK_36D8097E3C947C0F FOREIGN KEY (poll_id) REFERENCES poll (id)');
$this->addSql('ALTER TABLE poll_result ADD CONSTRAINT FK_FF6F824861E461F3 FOREIGN KEY (poll_answer_id) REFERENCES poll_answer (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE poll_answer DROP FOREIGN KEY FK_36D8097E3C947C0F');
$this->addSql('ALTER TABLE poll_result DROP FOREIGN KEY FK_FF6F824861E461F3');
$this->addSql('DROP TABLE poll');
$this->addSql('DROP TABLE poll_answer');
$this->addSql('DROP TABLE poll_result');
}
}