<?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 Version20220224072039 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 publication_image (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(191) NOT NULL, path VARCHAR(191) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE publication ADD publication_image_id INT DEFAULT NULL, DROP image');
$this->addSql('ALTER TABLE publication ADD CONSTRAINT FK_AF3C677912C2D03C FOREIGN KEY (publication_image_id) REFERENCES publication_image (id)');
$this->addSql('CREATE INDEX IDX_AF3C677912C2D03C ON publication (publication_image_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE publication DROP FOREIGN KEY FK_AF3C677912C2D03C');
$this->addSql('DROP TABLE publication_image');
$this->addSql('DROP INDEX IDX_AF3C677912C2D03C ON publication');
$this->addSql('ALTER TABLE publication ADD image VARCHAR(191) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, DROP publication_image_id');
}
}