<?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 Version20230504073148 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 key_type (id INT AUTO_INCREMENT NOT NULL, type_name VARCHAR(100) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE key_value (id INT AUTO_INCREMENT NOT NULL, key_type_id INT DEFAULT NULL, key_name VARCHAR(100) NOT NULL, entry_value VARCHAR(100) DEFAULT NULL, INDEX IDX_FF4925FBA79AA8AD (key_type_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE key_value ADD CONSTRAINT FK_FF4925FBA79AA8AD FOREIGN KEY (key_type_id) REFERENCES key_type (id)');
$this->addSql('ALTER TABLE job_daily_routine_entry DROP FOREIGN KEY FK_23161BE47B8DD49A');
$this->addSql('ALTER TABLE job_daily_routine_entry DROP FOREIGN KEY FK_23161BE474552888');
$this->addSql('ALTER TABLE job_daily_routine_entry DROP FOREIGN KEY FK_23161BE45BF64687');
$this->addSql('DROP INDEX IDX_23161BE47B8DD49A ON job_daily_routine_entry');
$this->addSql('DROP INDEX IDX_23161BE474552888 ON job_daily_routine_entry');
$this->addSql('DROP INDEX IDX_23161BE45BF64687 ON job_daily_routine_entry');
$this->addSql('ALTER TABLE job_daily_routine_entry ADD layout_id INT DEFAULT NULL, ADD theme_id INT DEFAULT NULL, ADD image_position_id INT DEFAULT NULL, DROP media_top_id, DROP media_right_id, DROP media_bottom_id');
$this->addSql('ALTER TABLE job_daily_routine_entry ADD CONSTRAINT FK_23161BE48C22AA1A FOREIGN KEY (layout_id) REFERENCES key_value (id)');
$this->addSql('ALTER TABLE job_daily_routine_entry ADD CONSTRAINT FK_23161BE459027487 FOREIGN KEY (theme_id) REFERENCES key_value (id)');
$this->addSql('ALTER TABLE job_daily_routine_entry ADD CONSTRAINT FK_23161BE4125265C8 FOREIGN KEY (image_position_id) REFERENCES key_value (id)');
$this->addSql('CREATE INDEX IDX_23161BE48C22AA1A ON job_daily_routine_entry (layout_id)');
$this->addSql('CREATE INDEX IDX_23161BE459027487 ON job_daily_routine_entry (theme_id)');
$this->addSql('CREATE INDEX IDX_23161BE4125265C8 ON job_daily_routine_entry (image_position_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE key_value DROP FOREIGN KEY FK_FF4925FBA79AA8AD');
$this->addSql('ALTER TABLE job_daily_routine_entry DROP FOREIGN KEY FK_23161BE48C22AA1A');
$this->addSql('ALTER TABLE job_daily_routine_entry DROP FOREIGN KEY FK_23161BE459027487');
$this->addSql('ALTER TABLE job_daily_routine_entry DROP FOREIGN KEY FK_23161BE4125265C8');
$this->addSql('DROP TABLE key_type');
$this->addSql('DROP TABLE key_value');
$this->addSql('DROP INDEX IDX_23161BE48C22AA1A ON job_daily_routine_entry');
$this->addSql('DROP INDEX IDX_23161BE459027487 ON job_daily_routine_entry');
$this->addSql('DROP INDEX IDX_23161BE4125265C8 ON job_daily_routine_entry');
$this->addSql('ALTER TABLE job_daily_routine_entry ADD media_top_id INT DEFAULT NULL, ADD media_right_id INT DEFAULT NULL, ADD media_bottom_id INT DEFAULT NULL, DROP layout_id, DROP theme_id, DROP image_position_id');
$this->addSql('ALTER TABLE job_daily_routine_entry ADD CONSTRAINT FK_23161BE47B8DD49A FOREIGN KEY (media_bottom_id) REFERENCES media__media (id)');
$this->addSql('ALTER TABLE job_daily_routine_entry ADD CONSTRAINT FK_23161BE474552888 FOREIGN KEY (media_top_id) REFERENCES media__media (id)');
$this->addSql('ALTER TABLE job_daily_routine_entry ADD CONSTRAINT FK_23161BE45BF64687 FOREIGN KEY (media_right_id) REFERENCES media__media (id)');
$this->addSql('CREATE INDEX IDX_23161BE47B8DD49A ON job_daily_routine_entry (media_bottom_id)');
$this->addSql('CREATE INDEX IDX_23161BE474552888 ON job_daily_routine_entry (media_top_id)');
$this->addSql('CREATE INDEX IDX_23161BE45BF64687 ON job_daily_routine_entry (media_right_id)');
}
}