src/Migrations/Version20201119144106.php line 1
<?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 Version20201119144106 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 olympiad_organisation_relation (olympiad_id INT NOT NULL, organisation_id INT NOT NULL, INDEX IDX_8A6C50B63E1B5B3A (olympiad_id), INDEX IDX_8A6C50B69E6B1585 (organisation_id), PRIMARY KEY(olympiad_id, organisation_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE olympiad_organisation_relation ADD CONSTRAINT FK_8A6C50B63E1B5B3A FOREIGN KEY (olympiad_id) REFERENCES olympiad (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE olympiad_organisation_relation ADD CONSTRAINT FK_8A6C50B69E6B1585 FOREIGN KEY (organisation_id) REFERENCES organisation (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE olympiad DROP FOREIGN KEY FK_77700B8E9E6B1585');
$this->addSql('DROP INDEX IDX_77700B8E9E6B1585 ON olympiad');
$this->addSql('ALTER TABLE olympiad DROP organisation_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE olympiad_organisation_relation');
$this->addSql('ALTER TABLE olympiad ADD organisation_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE olympiad ADD CONSTRAINT FK_77700B8E9E6B1585 FOREIGN KEY (organisation_id) REFERENCES organisation (id)');
$this->addSql('CREATE INDEX IDX_77700B8E9E6B1585 ON olympiad (organisation_id)');
}
}