migrations/Version20230329204647.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 Version20230329204647 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 DROP FOREIGN KEY FK_C53D045F4E1F92E8');
  19.         $this->addSql('DROP INDEX IDX_C53D045F4E1F92E8 ON image');
  20.         $this->addSql('ALTER TABLE image CHANGE id_restaurant id_restaurante INT DEFAULT NULL');
  21.         $this->addSql('ALTER TABLE image ADD CONSTRAINT FK_C53D045F41450F82 FOREIGN KEY (id_restaurante) REFERENCES restaurante (id)');
  22.         $this->addSql('CREATE INDEX IDX_C53D045F41450F82 ON image (id_restaurante)');
  23.         $this->addSql('ALTER TABLE restaurante DROP FOREIGN KEY FK_5957C275E48E9A13');
  24.         $this->addSql('DROP INDEX UNIQ_5957C275E48E9A13 ON restaurante');
  25.         $this->addSql('ALTER TABLE restaurante DROP logo');
  26.     }
  27.     public function down(Schema $schema): void
  28.     {
  29.         // this down() migration is auto-generated, please modify it to your needs
  30.         $this->addSql('ALTER TABLE restaurante ADD logo INT DEFAULT NULL');
  31.         $this->addSql('ALTER TABLE restaurante ADD CONSTRAINT FK_5957C275E48E9A13 FOREIGN KEY (logo) REFERENCES image (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
  32.         $this->addSql('CREATE UNIQUE INDEX UNIQ_5957C275E48E9A13 ON restaurante (logo)');
  33.         $this->addSql('ALTER TABLE image DROP FOREIGN KEY FK_C53D045F41450F82');
  34.         $this->addSql('DROP INDEX IDX_C53D045F41450F82 ON image');
  35.         $this->addSql('ALTER TABLE image CHANGE id_restaurante id_restaurant INT DEFAULT NULL');
  36.         $this->addSql('ALTER TABLE image ADD CONSTRAINT FK_C53D045F4E1F92E8 FOREIGN KEY (id_restaurant) REFERENCES restaurante (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
  37.         $this->addSql('CREATE INDEX IDX_C53D045F4E1F92E8 ON image (id_restaurant)');
  38.     }
  39. }