Files
myep-team/migrations/Version20261111100000.php
T

37 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Written by hand from the diff, keeping only questionnaire_response: doctrine:migrations:diff
* also sweeps in the pre-existing drift of the dev database.
*/
final class Version20261111100000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Let a questionnaire response be about a travel, for the house manager questionnaire';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE questionnaire_response ADD destination_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE questionnaire_response ADD CONSTRAINT FK_A0400276816C6140 FOREIGN KEY (destination_id) REFERENCES destination (id) ON DELETE CASCADE');
$this->addSql('CREATE INDEX IDX_A0400276816C6140 ON questionnaire_response (destination_id)');
$this->addSql('CREATE UNIQUE INDEX questionnaire_destination ON questionnaire_response (questionnaire, destination_id)');
}
public function down(Schema $schema): void
{
$this->addSql('DROP INDEX questionnaire_destination ON questionnaire_response');
$this->addSql('ALTER TABLE questionnaire_response DROP FOREIGN KEY FK_A0400276816C6140');
$this->addSql('DROP INDEX IDX_A0400276816C6140 ON questionnaire_response');
$this->addSql('ALTER TABLE questionnaire_response DROP destination_id');
}
}