<?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 Version20221011135311 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 sport_object_equipment (sport_object_id INT NOT NULL, equipment_id INT NOT NULL, PRIMARY KEY(sport_object_id, equipment_id))');
$this->addSql('CREATE INDEX IDX_3F3297988AFAE46 ON sport_object_equipment (sport_object_id)');
$this->addSql('CREATE INDEX IDX_3F329798517FE9FE ON sport_object_equipment (equipment_id)');
$this->addSql('CREATE TABLE sport_object_sport_object_category (sport_object_id INT NOT NULL, sport_object_category_id INT NOT NULL, PRIMARY KEY(sport_object_id, sport_object_category_id))');
$this->addSql('CREATE INDEX IDX_57722FEA8AFAE46 ON sport_object_sport_object_category (sport_object_id)');
$this->addSql('CREATE INDEX IDX_57722FEA23A29ACE ON sport_object_sport_object_category (sport_object_category_id)');
$this->addSql('CREATE TABLE sport_object_sport_section (sport_object_id INT NOT NULL, sport_section_id INT NOT NULL, PRIMARY KEY(sport_object_id, sport_section_id))');
$this->addSql('CREATE INDEX IDX_2B93F9AC8AFAE46 ON sport_object_sport_section (sport_object_id)');
$this->addSql('CREATE INDEX IDX_2B93F9ACEB0B7C67 ON sport_object_sport_section (sport_section_id)');
$this->addSql('ALTER TABLE sport_object_equipment ADD CONSTRAINT FK_3F3297988AFAE46 FOREIGN KEY (sport_object_id) REFERENCES sport_object (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE sport_object_equipment ADD CONSTRAINT FK_3F329798517FE9FE FOREIGN KEY (equipment_id) REFERENCES equipment (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE sport_object_sport_object_category ADD CONSTRAINT FK_57722FEA8AFAE46 FOREIGN KEY (sport_object_id) REFERENCES sport_object (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE sport_object_sport_object_category ADD CONSTRAINT FK_57722FEA23A29ACE FOREIGN KEY (sport_object_category_id) REFERENCES sport_object_category (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE sport_object_sport_section ADD CONSTRAINT FK_2B93F9AC8AFAE46 FOREIGN KEY (sport_object_id) REFERENCES sport_object (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE sport_object_sport_section ADD CONSTRAINT FK_2B93F9ACEB0B7C67 FOREIGN KEY (sport_section_id) REFERENCES sport_section (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE sport_object_equipment DROP CONSTRAINT FK_3F3297988AFAE46');
$this->addSql('ALTER TABLE sport_object_equipment DROP CONSTRAINT FK_3F329798517FE9FE');
$this->addSql('ALTER TABLE sport_object_sport_object_category DROP CONSTRAINT FK_57722FEA8AFAE46');
$this->addSql('ALTER TABLE sport_object_sport_object_category DROP CONSTRAINT FK_57722FEA23A29ACE');
$this->addSql('ALTER TABLE sport_object_sport_section DROP CONSTRAINT FK_2B93F9AC8AFAE46');
$this->addSql('ALTER TABLE sport_object_sport_section DROP CONSTRAINT FK_2B93F9ACEB0B7C67');
$this->addSql('DROP TABLE sport_object_equipment');
$this->addSql('DROP TABLE sport_object_sport_object_category');
$this->addSql('DROP TABLE sport_object_sport_section');
}
}