migrations/Version20230227234347.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 Version20230227234347 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('ALTER TABLE image ADD id_menu INT DEFAULT NULL, ADD id_restaurant INT DEFAULT NULL');
  19.         $this->addSql('ALTER TABLE image ADD CONSTRAINT FK_C53D045FF6252691 FOREIGN KEY (id_menu) REFERENCES menu (id)');
  20.         $this->addSql('ALTER TABLE image ADD CONSTRAINT FK_C53D045F4E1F92E8 FOREIGN KEY (id_restaurant) REFERENCES restaurante (id)');
  21.         $this->addSql('CREATE INDEX IDX_C53D045FF6252691 ON image (id_menu)');
  22.         $this->addSql('CREATE INDEX IDX_C53D045F4E1F92E8 ON image (id_restaurant)');
  23.         $this->addSql('ALTER TABLE menu DROP images');
  24.         $this->addSql('ALTER TABLE restaurante CHANGE logo logo INT DEFAULT NULL');
  25.         $this->addSql('ALTER TABLE restaurante ADD CONSTRAINT FK_5957C275E48E9A13 FOREIGN KEY (logo) REFERENCES image (id)');
  26.         $this->addSql('CREATE UNIQUE INDEX UNIQ_5957C275E48E9A13 ON restaurante (logo)');
  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('ALTER TABLE menu ADD images LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\'');
  32.         $this->addSql('ALTER TABLE restaurante DROP FOREIGN KEY FK_5957C275E48E9A13');
  33.         $this->addSql('DROP INDEX UNIQ_5957C275E48E9A13 ON restaurante');
  34.         $this->addSql('ALTER TABLE restaurante CHANGE logo logo VARCHAR(255) DEFAULT NULL');
  35.         $this->addSql('ALTER TABLE image DROP FOREIGN KEY FK_C53D045FF6252691');
  36.         $this->addSql('ALTER TABLE image DROP FOREIGN KEY FK_C53D045F4E1F92E8');
  37.         $this->addSql('DROP INDEX IDX_C53D045FF6252691 ON image');
  38.         $this->addSql('DROP INDEX IDX_C53D045F4E1F92E8 ON image');
  39.         $this->addSql('ALTER TABLE image DROP id_menu, DROP id_restaurant');
  40.     }
  41. }