<?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 Version20221205143345 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 question (id INT AUTO_INCREMENT NOT NULL, survey_id INT NOT NULL, INDEX IDX_B6F7494EB3FE509D (survey_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE question_keyword (question_id INT NOT NULL, keyword_id INT NOT NULL, INDEX IDX_544FA4261E27F6BF (question_id), INDEX IDX_544FA426115D4552 (keyword_id), PRIMARY KEY(question_id, keyword_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE result (id INT AUTO_INCREMENT NOT NULL, survey_id INT NOT NULL, UNIQUE INDEX UNIQ_136AC113B3FE509D (survey_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE score (id INT AUTO_INCREMENT NOT NULL, emotion_id INT DEFAULT NULL, collection_id INT DEFAULT NULL, result_id INT NOT NULL, value INT NOT NULL, INDEX IDX_329937511EE4A582 (emotion_id), INDEX IDX_32993751514956FD (collection_id), INDEX IDX_329937517A7B643 (result_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE `survey` (id INT AUTO_INCREMENT NOT NULL, customer_id INT NOT NULL, age INT NOT NULL, gender VARCHAR(255) NOT NULL, INDEX IDX_AD5F9BFC9395C3F3 (customer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE question ADD CONSTRAINT FK_B6F7494EB3FE509D FOREIGN KEY (survey_id) REFERENCES `survey` (id)');
$this->addSql('ALTER TABLE question_keyword ADD CONSTRAINT FK_544FA4261E27F6BF FOREIGN KEY (question_id) REFERENCES question (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE question_keyword ADD CONSTRAINT FK_544FA426115D4552 FOREIGN KEY (keyword_id) REFERENCES keyword (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE result ADD CONSTRAINT FK_136AC113B3FE509D FOREIGN KEY (survey_id) REFERENCES `survey` (id)');
$this->addSql('ALTER TABLE score ADD CONSTRAINT FK_329937511EE4A582 FOREIGN KEY (emotion_id) REFERENCES emotion (id)');
$this->addSql('ALTER TABLE score ADD CONSTRAINT FK_32993751514956FD FOREIGN KEY (collection_id) REFERENCES collection (id)');
$this->addSql('ALTER TABLE score ADD CONSTRAINT FK_329937517A7B643 FOREIGN KEY (result_id) REFERENCES result (id)');
$this->addSql('ALTER TABLE `survey` ADD CONSTRAINT FK_AD5F9BFC9395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE question_keyword DROP FOREIGN KEY FK_544FA4261E27F6BF');
$this->addSql('ALTER TABLE score DROP FOREIGN KEY FK_329937517A7B643');
$this->addSql('ALTER TABLE question DROP FOREIGN KEY FK_B6F7494EB3FE509D');
$this->addSql('ALTER TABLE result DROP FOREIGN KEY FK_136AC113B3FE509D');
$this->addSql('DROP TABLE question');
$this->addSql('DROP TABLE question_keyword');
$this->addSql('DROP TABLE result');
$this->addSql('DROP TABLE score');
$this->addSql('DROP TABLE `survey`');
}
}