migrations/Version20241122095726.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 Version20241122095726 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 step (id INT AUTO_INCREMENT NOT NULL, product_id INT NOT NULL, name VARCHAR(255) NOT NULL, INDEX IDX_43B9FE3C4584665A (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE step_item (id INT AUTO_INCREMENT NOT NULL, product_id INT NOT NULL, step_id INT NOT NULL, INDEX IDX_518DB84F4584665A (product_id), INDEX IDX_518DB84F73B21E9C (step_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE step ADD CONSTRAINT FK_43B9FE3C4584665A FOREIGN KEY (product_id) REFERENCES product (id)');
  21.         $this->addSql('ALTER TABLE step_item ADD CONSTRAINT FK_518DB84F4584665A FOREIGN KEY (product_id) REFERENCES product (id)');
  22.         $this->addSql('ALTER TABLE step_item ADD CONSTRAINT FK_518DB84F73B21E9C FOREIGN KEY (step_id) REFERENCES step (id)');
  23.         $this->addSql('ALTER TABLE product_menu_product DROP FOREIGN KEY FK_9FEB1FCCD34A04AD');
  24.         $this->addSql('ALTER TABLE product_menu_product DROP FOREIGN KEY FK_9FEB1FCC7D053A93');
  25.         $this->addSql('DROP TABLE product_menu_product');
  26.         $this->addSql('ALTER TABLE product CHANGE type type VARCHAR(255) DEFAULT \'product\' NOT NULL');
  27.     }
  28.     public function down(Schema $schema): void
  29.     {
  30.         // this down() migration is auto-generated, please modify it to your needs
  31.         $this->addSql('CREATE TABLE product_menu_product (menu INT NOT NULL, product INT NOT NULL, INDEX IDX_9FEB1FCC7D053A93 (menu), INDEX IDX_9FEB1FCCD34A04AD (product), PRIMARY KEY(menu, product)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  32.         $this->addSql('ALTER TABLE product_menu_product ADD CONSTRAINT FK_9FEB1FCCD34A04AD FOREIGN KEY (product) REFERENCES product (id)');
  33.         $this->addSql('ALTER TABLE product_menu_product ADD CONSTRAINT FK_9FEB1FCC7D053A93 FOREIGN KEY (menu) REFERENCES product (id)');
  34.         $this->addSql('ALTER TABLE step DROP FOREIGN KEY FK_43B9FE3C4584665A');
  35.         $this->addSql('ALTER TABLE step_item DROP FOREIGN KEY FK_518DB84F4584665A');
  36.         $this->addSql('ALTER TABLE step_item DROP FOREIGN KEY FK_518DB84F73B21E9C');
  37.         $this->addSql('DROP TABLE step');
  38.         $this->addSql('DROP TABLE step_item');
  39.         $this->addSql('ALTER TABLE product CHANGE type type VARCHAR(255) DEFAULT \'product\'');
  40.     }
  41. }