migrations/Version20221011135311.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20221011135311 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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))');
  19.         $this->addSql('CREATE INDEX IDX_3F3297988AFAE46 ON sport_object_equipment (sport_object_id)');
  20.         $this->addSql('CREATE INDEX IDX_3F329798517FE9FE ON sport_object_equipment (equipment_id)');
  21.         $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))');
  22.         $this->addSql('CREATE INDEX IDX_57722FEA8AFAE46 ON sport_object_sport_object_category (sport_object_id)');
  23.         $this->addSql('CREATE INDEX IDX_57722FEA23A29ACE ON sport_object_sport_object_category (sport_object_category_id)');
  24.         $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))');
  25.         $this->addSql('CREATE INDEX IDX_2B93F9AC8AFAE46 ON sport_object_sport_section (sport_object_id)');
  26.         $this->addSql('CREATE INDEX IDX_2B93F9ACEB0B7C67 ON sport_object_sport_section (sport_section_id)');
  27.         $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');
  28.         $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');
  29.         $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');
  30.         $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');
  31.         $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');
  32.         $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');
  33.     }
  34.     public function down(Schema $schema): void
  35.     {
  36.         // this down() migration is auto-generated, please modify it to your needs
  37.         $this->addSql('ALTER TABLE sport_object_equipment DROP CONSTRAINT FK_3F3297988AFAE46');
  38.         $this->addSql('ALTER TABLE sport_object_equipment DROP CONSTRAINT FK_3F329798517FE9FE');
  39.         $this->addSql('ALTER TABLE sport_object_sport_object_category DROP CONSTRAINT FK_57722FEA8AFAE46');
  40.         $this->addSql('ALTER TABLE sport_object_sport_object_category DROP CONSTRAINT FK_57722FEA23A29ACE');
  41.         $this->addSql('ALTER TABLE sport_object_sport_section DROP CONSTRAINT FK_2B93F9AC8AFAE46');
  42.         $this->addSql('ALTER TABLE sport_object_sport_section DROP CONSTRAINT FK_2B93F9ACEB0B7C67');
  43.         $this->addSql('DROP TABLE sport_object_equipment');
  44.         $this->addSql('DROP TABLE sport_object_sport_object_category');
  45.         $this->addSql('DROP TABLE sport_object_sport_section');
  46.     }
  47. }