<?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 Version20221020122411 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 answer (id INT AUTO_INCREMENT NOT NULL, question_id INT NOT NULL, text VARCHAR(255) NOT NULL, score INT NOT NULL, sort_order INT NOT NULL, status TINYINT(1) NOT NULL, date_added DATETIME NOT NULL, date_modified DATETIME NOT NULL, INDEX IDX_DADD4A251E27F6BF (question_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE participant_answer (id INT AUTO_INCREMENT NOT NULL, participant_id INT UNSIGNED NOT NULL, question_id INT NOT NULL, answer_id INT NOT NULL, status TINYINT(1) NOT NULL, date_added DATETIME NOT NULL, date_modified DATETIME NOT NULL, INDEX IDX_68A1F4A49D1C3019 (participant_id), INDEX IDX_68A1F4A41E27F6BF (question_id), INDEX IDX_68A1F4A4AA334807 (answer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE question (id INT AUTO_INCREMENT NOT NULL, text VARCHAR(400) NOT NULL, short_name VARCHAR(25) NOT NULL, type VARCHAR(255) NOT NULL, status TINYINT(1) NOT NULL, sort_order INT NOT NULL, date_added DATETIME NOT NULL, date_modified DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE answer ADD CONSTRAINT FK_DADD4A251E27F6BF FOREIGN KEY (question_id) REFERENCES question (id)');
$this->addSql('ALTER TABLE participant_answer ADD CONSTRAINT FK_68A1F4A49D1C3019 FOREIGN KEY (participant_id) REFERENCES participant (id)');
$this->addSql('ALTER TABLE participant_answer ADD CONSTRAINT FK_68A1F4A41E27F6BF FOREIGN KEY (question_id) REFERENCES question (id)');
$this->addSql('ALTER TABLE participant_answer ADD CONSTRAINT FK_68A1F4A4AA334807 FOREIGN KEY (answer_id) REFERENCES answer (id)');
$this->addSql('ALTER TABLE participant ADD vat_id VARCHAR(255) NOT NULL, ADD score INT DEFAULT 0');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE participant_answer DROP FOREIGN KEY FK_68A1F4A4AA334807');
$this->addSql('ALTER TABLE answer DROP FOREIGN KEY FK_DADD4A251E27F6BF');
$this->addSql('ALTER TABLE participant_answer DROP FOREIGN KEY FK_68A1F4A41E27F6BF');
$this->addSql('DROP TABLE answer');
$this->addSql('DROP TABLE participant_answer');
$this->addSql('DROP TABLE question');
$this->addSql('ALTER TABLE participant DROP vat_id, DROP score');
}
}