<?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 Version20220405151658 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 mood (id INT AUTO_INCREMENT NOT NULL, icon VARCHAR(255) NOT NULL, title VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE post ADD mood_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE post ADD CONSTRAINT FK_5A8A6C8DB889D33E FOREIGN KEY (mood_id) REFERENCES mood (id)');
$this->addSql('CREATE INDEX IDX_5A8A6C8DB889D33E ON post (mood_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE post DROP FOREIGN KEY FK_5A8A6C8DB889D33E');
$this->addSql('DROP TABLE mood');
$this->addSql('DROP INDEX IDX_5A8A6C8DB889D33E ON post');
$this->addSql('ALTER TABLE post DROP mood_id');
}
}