<?php declare (strict_types = 1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20180326145319 extends AbstractMigration
{
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE user_survey_answer DROP FOREIGN KEY FK_1C5D2F1957CA8F96');
$this->addSql('CREATE TABLE membership_survey (`id` INT AUTO_INCREMENT NOT NULL, `start_date` DATETIME DEFAULT NULL, `end_date` DATETIME DEFAULT NULL, `creation_user` VARCHAR(50) NOT NULL, `creation_date` DATETIME NOT NULL, `modified_user` VARCHAR(50) DEFAULT NULL, `modified_date` DATETIME DEFAULT NULL, `membership_id` INT NOT NULL, `survey_id` INT NOT NULL, INDEX IDX_D3E22A653E2CBC4F (`membership_id`), INDEX IDX_D3E22A65C964D0DE (`survey_id`), PRIMARY KEY(`id`)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE membership_survey_answer (`id` INT AUTO_INCREMENT NOT NULL, `value` VARCHAR(5000) DEFAULT NULL, `membershipSurvey_id` INT NOT NULL, `surveyDetail_id` INT NOT NULL, INDEX IDX_3AA26A7C8448D857 (`membershipSurvey_id`), INDEX IDX_3AA26A7C32FD39D4 (`surveyDetail_id`), PRIMARY KEY(`id`)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE membership_survey ADD CONSTRAINT FK_D3E22A653E2CBC4F FOREIGN KEY (`membership_id`) REFERENCES membership (`id`)');
$this->addSql('ALTER TABLE membership_survey ADD CONSTRAINT FK_D3E22A65C964D0DE FOREIGN KEY (`survey_id`) REFERENCES survey (`id`)');
$this->addSql('ALTER TABLE membership_survey_answer ADD CONSTRAINT FK_3AA26A7C8448D857 FOREIGN KEY (`membershipSurvey_id`) REFERENCES membership_survey (`id`)');
$this->addSql('ALTER TABLE membership_survey_answer ADD CONSTRAINT FK_3AA26A7C32FD39D4 FOREIGN KEY (`surveyDetail_id`) REFERENCES survey_detail (`id`)');
$this->addSql('DROP TABLE user_survey');
$this->addSql('DROP TABLE user_survey_answer');
$this->addSql('ALTER TABLE membership ADD `status` VARCHAR(255) NOT NULL COMMENT \'(DC2Type:membership_status)\', DROP state');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE membership_survey_answer DROP FOREIGN KEY FK_3AA26A7C8448D857');
$this->addSql('CREATE TABLE user_survey (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, survey_id INT NOT NULL, start_date DATETIME DEFAULT NULL, end_date DATETIME DEFAULT NULL, creation_user VARCHAR(50) NOT NULL COLLATE utf8_unicode_ci, creation_date DATETIME NOT NULL, modified_user VARCHAR(50) DEFAULT NULL COLLATE utf8_unicode_ci, modified_date DATETIME DEFAULT NULL, INDEX IDX_C80D80C1C03ACDAE (user_id), INDEX IDX_C80D80C1C964D0DE (survey_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_survey_answer (id INT AUTO_INCREMENT NOT NULL, value VARCHAR(5000) DEFAULT NULL COLLATE utf8_unicode_ci, userSurvey_id INT NOT NULL, surveyDetail_id INT NOT NULL, INDEX IDX_1C5D2F1957CA8F96 (userSurvey_id), INDEX IDX_1C5D2F1932FD39D4 (surveyDetail_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE user_survey ADD CONSTRAINT FK_C80D80C1C03ACDAE FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE user_survey ADD CONSTRAINT FK_C80D80C1C964D0DE FOREIGN KEY (survey_id) REFERENCES survey (id)');
$this->addSql('ALTER TABLE user_survey_answer ADD CONSTRAINT FK_1C5D2F1932FD39D4 FOREIGN KEY (surveyDetail_id) REFERENCES survey_detail (id)');
$this->addSql('ALTER TABLE user_survey_answer ADD CONSTRAINT FK_1C5D2F1957CA8F96 FOREIGN KEY (userSurvey_id) REFERENCES user_survey (id)');
$this->addSql('DROP TABLE membership_survey');
$this->addSql('DROP TABLE membership_survey_answer');
$this->addSql('ALTER TABLE membership ADD state VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci COMMENT \'(DC2Type:membership_state)\', DROP `status`');
}
}