<?php
declare(strict_types=1);
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20211028081714 extends AbstractMigration
{
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE uses_questionnaire ADD CONSTRAINT FK_50D33B1712469DE2 FOREIGN KEY (category_id) REFERENCES substance_category (id)');
$this->addSql('ALTER TABLE uses_questionnaire ADD CONSTRAINT FK_50D33B1781257D5D FOREIGN KEY (entity_id) REFERENCES legal_entity (id)');
$this->addSql('CREATE INDEX IDX_50D33B1712469DE2 ON uses_questionnaire (category_id)');
$this->addSql('CREATE INDEX IDX_50D33B1781257D5D ON uses_questionnaire (entity_id)');
$this->addSql('CREATE TABLE export_questionnaires (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:carbondatetime)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:carbondatetime)\', INDEX IDX_7978427EA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE export_questionnaires ADD CONSTRAINT FK_7978427EA76ED395 FOREIGN KEY (user_id) REFERENCES security_user (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE uses_questionnaire DROP FOREIGN KEY FK_50D33B1712469DE2');
$this->addSql('ALTER TABLE uses_questionnaire DROP FOREIGN KEY FK_50D33B1781257D5D');
$this->addSql('DROP INDEX IDX_50D33B1712469DE2 ON uses_questionnaire');
$this->addSql('DROP INDEX IDX_50D33B1781257D5D ON uses_questionnaire');
$this->addSql('DROP TABLE export_questionnaires');
}
}