migrations/Version20241118121950.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. final class Version20241118121950 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Update product entity to manage menu cross selling products';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->addSql('ALTER TABLE product ADD menu_id INT DEFAULT NULL');
  15.         $this->addSql('ALTER TABLE product ADD CONSTRAINT FK_D34A04ADCCD7E912 FOREIGN KEY (menu_id) REFERENCES menu (id)');
  16.         $this->addSql('CREATE INDEX IDX_D34A04ADCCD7E912 ON product (menu_id)');
  17.     }
  18.     public function down(Schema $schema): void
  19.     {
  20.         $this->addSql('ALTER TABLE product DROP FOREIGN KEY FK_D34A04ADCCD7E912');
  21.         $this->addSql('DROP INDEX IDX_D34A04ADCCD7E912 ON product');
  22.         $this->addSql('ALTER TABLE product DROP menu_id');
  23.     }
  24. }