migrations/Version20220331075004.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 Version20220331075004 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 testimonial_item (id INT AUTO_INCREMENT NOT NULL, testimonial_id INT NOT NULL, page_id INT NOT NULL, INDEX IDX_F9AFD6BA1D4EC6B1 (testimonial_id), INDEX IDX_F9AFD6BAC4663E4 (page_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE testimonial_item ADD CONSTRAINT FK_F9AFD6BA1D4EC6B1 FOREIGN KEY (testimonial_id) REFERENCES testimonial (id)');
  20.         $this->addSql('ALTER TABLE testimonial_item ADD CONSTRAINT FK_F9AFD6BAC4663E4 FOREIGN KEY (page_id) REFERENCES page (id)');
  21.         $this->addSql('ALTER TABLE media__media CHANGE provider_metadata provider_metadata JSON DEFAULT NULL');
  22.         $this->addSql('ALTER TABLE testimonial DROP FOREIGN KEY FK_E6BDCDF7C4663E4');
  23.         $this->addSql('DROP INDEX IDX_E6BDCDF7C4663E4 ON testimonial');
  24.         $this->addSql('ALTER TABLE testimonial DROP page_id');
  25.     }
  26.     public function down(Schema $schema): void
  27.     {
  28.         // this down() migration is auto-generated, please modify it to your needs
  29.         $this->addSql('DROP TABLE testimonial_item');
  30.         $this->addSql('ALTER TABLE media__media CHANGE provider_metadata provider_metadata JSON DEFAULT NULL');
  31.         $this->addSql('ALTER TABLE testimonial ADD page_id INT NOT NULL');
  32.         $this->addSql('ALTER TABLE testimonial ADD CONSTRAINT FK_E6BDCDF7C4663E4 FOREIGN KEY (page_id) REFERENCES page (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
  33.         $this->addSql('CREATE INDEX IDX_E6BDCDF7C4663E4 ON testimonial (page_id)');
  34.     }
  35. }