<?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 Version20220526115751 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 voting_anonymous_passing (id INT AUTO_INCREMENT NOT NULL, voting_id INT NOT NULL, fingerprint VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_F835CC9B4254ACF8 (voting_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE voting_anonymous_passing ADD CONSTRAINT FK_F835CC9B4254ACF8 FOREIGN KEY (voting_id) REFERENCES voting (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE custom_user_answer ADD anonymous_passing_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE custom_user_answer ADD CONSTRAINT FK_89B3E4D2941913C6 FOREIGN KEY (anonymous_passing_id) REFERENCES voting_anonymous_passing (id) ON DELETE CASCADE');
$this->addSql('CREATE INDEX IDX_89B3E4D2941913C6 ON custom_user_answer (anonymous_passing_id)');
$this->addSql('ALTER TABLE user_answer ADD anonymous_passing_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE user_answer ADD CONSTRAINT FK_BF8F5118941913C6 FOREIGN KEY (anonymous_passing_id) REFERENCES voting_anonymous_passing (id) ON DELETE CASCADE');
$this->addSql('CREATE INDEX IDX_BF8F5118941913C6 ON user_answer (anonymous_passing_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE custom_user_answer DROP FOREIGN KEY FK_89B3E4D2941913C6');
$this->addSql('ALTER TABLE user_answer DROP FOREIGN KEY FK_BF8F5118941913C6');
$this->addSql('DROP TABLE voting_anonymous_passing');
$this->addSql('DROP INDEX IDX_89B3E4D2941913C6 ON custom_user_answer');
$this->addSql('ALTER TABLE custom_user_answer DROP anonymous_passing_id');
$this->addSql('DROP INDEX IDX_BF8F5118941913C6 ON user_answer');
$this->addSql('ALTER TABLE user_answer DROP anonymous_passing_id');
}
}