<?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 Version20220615115421 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, titre VARCHAR(255) NOT NULL, description LONGTEXT NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE docteur ADD question_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE docteur ADD CONSTRAINT FK_83A7A4391E27F6BF FOREIGN KEY (question_id) REFERENCES question (id)');
$this->addSql('CREATE INDEX IDX_83A7A4391E27F6BF ON docteur (question_id)');
$this->addSql('ALTER TABLE patient ADD question_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE patient ADD CONSTRAINT FK_1ADAD7EB1E27F6BF FOREIGN KEY (question_id) REFERENCES question (id)');
$this->addSql('CREATE INDEX IDX_1ADAD7EB1E27F6BF ON patient (question_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE docteur DROP FOREIGN KEY FK_83A7A4391E27F6BF');
$this->addSql('ALTER TABLE patient DROP FOREIGN KEY FK_1ADAD7EB1E27F6BF');
$this->addSql('DROP TABLE question');
$this->addSql('DROP INDEX IDX_83A7A4391E27F6BF ON docteur');
$this->addSql('ALTER TABLE docteur DROP question_id');
$this->addSql('DROP INDEX IDX_1ADAD7EB1E27F6BF ON patient');
$this->addSql('ALTER TABLE patient DROP question_id');
}
}