<?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 Version20230428142235 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 aliment_translation (id INT AUTO_INCREMENT NOT NULL, aliment_id INT NOT NULL, locale_id INT NOT NULL, name VARCHAR(255) NOT NULL, description VARCHAR(255) DEFAULT NULL, INDEX IDX_62BF7871415B9F11 (aliment_id), INDEX IDX_62BF7871E559DFD1 (locale_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE aliment_translation ADD CONSTRAINT FK_62BF7871415B9F11 FOREIGN KEY (aliment_id) REFERENCES aliment (id)');
$this->addSql('ALTER TABLE aliment_translation ADD CONSTRAINT FK_62BF7871E559DFD1 FOREIGN KEY (locale_id) REFERENCES locale (id)');
$this->addSql('INSERT INTO aliment_translation (locale_id, aliment_id, name, description) SELECT 1, id, name, description FROM aliment');
$this->addSql('ALTER TABLE aliment DROP name, DROP description');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE aliment_translation DROP FOREIGN KEY FK_62BF7871415B9F11');
$this->addSql('ALTER TABLE aliment_translation DROP FOREIGN KEY FK_62BF7871E559DFD1');
$this->addSql('DROP TABLE aliment_translation');
$this->addSql('ALTER TABLE aliment ADD name VARCHAR(50) DEFAULT NULL, ADD description VARCHAR(255) DEFAULT NULL');
}
}