<?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 Version20230621072550 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 shop_translation (id INT AUTO_INCREMENT NOT NULL, shop_id INT NOT NULL, locale_id INT NOT NULL, description LONGTEXT DEFAULT NULL, INDEX IDX_661EB37F4D16C4DD (shop_id), INDEX IDX_661EB37FE559DFD1 (locale_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE shop_translation ADD CONSTRAINT FK_661EB37F4D16C4DD FOREIGN KEY (shop_id) REFERENCES shop (id)');
$this->addSql('ALTER TABLE shop_translation ADD CONSTRAINT FK_661EB37FE559DFD1 FOREIGN KEY (locale_id) REFERENCES locale (id)');
$this->addSql('INSERT INTO shop_translation (locale_id, shop_id, description) SELECT 1, id, description FROM shop');
$this->addSql('ALTER TABLE shop DROP description');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE shop_translation DROP FOREIGN KEY FK_661EB37F4D16C4DD');
$this->addSql('ALTER TABLE shop_translation DROP FOREIGN KEY FK_661EB37FE559DFD1');
$this->addSql('DROP TABLE shop_translation');
$this->addSql('ALTER TABLE shop ADD description LONGTEXT DEFAULT NULL');
}
}