<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220331075004 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$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');
$this->addSql('ALTER TABLE testimonial_item ADD CONSTRAINT FK_F9AFD6BA1D4EC6B1 FOREIGN KEY (testimonial_id) REFERENCES testimonial (id)');
$this->addSql('ALTER TABLE testimonial_item ADD CONSTRAINT FK_F9AFD6BAC4663E4 FOREIGN KEY (page_id) REFERENCES page (id)');
$this->addSql('ALTER TABLE media__media CHANGE provider_metadata provider_metadata JSON DEFAULT NULL');
$this->addSql('ALTER TABLE testimonial DROP FOREIGN KEY FK_E6BDCDF7C4663E4');
$this->addSql('DROP INDEX IDX_E6BDCDF7C4663E4 ON testimonial');
$this->addSql('ALTER TABLE testimonial DROP page_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE testimonial_item');
$this->addSql('ALTER TABLE media__media CHANGE provider_metadata provider_metadata JSON DEFAULT NULL');
$this->addSql('ALTER TABLE testimonial ADD page_id INT NOT NULL');
$this->addSql('ALTER TABLE testimonial ADD CONSTRAINT FK_E6BDCDF7C4663E4 FOREIGN KEY (page_id) REFERENCES page (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('CREATE INDEX IDX_E6BDCDF7C4663E4 ON testimonial (page_id)');
}
}