<?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 Version20210611215920 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 color (id INT AUTO_INCREMENT NOT NULL, code VARCHAR(255) NOT NULL, deleted TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE image (id INT AUTO_INCREMENT NOT NULL, path VARCHAR(255) NOT NULL, deleted TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE category ADD image_id INT DEFAULT NULL, ADD color_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE category ADD CONSTRAINT FK_64C19C13DA5256D FOREIGN KEY (image_id) REFERENCES image (id)');
$this->addSql('ALTER TABLE category ADD CONSTRAINT FK_64C19C17ADA1FB5 FOREIGN KEY (color_id) REFERENCES color (id)');
$this->addSql('CREATE INDEX IDX_64C19C13DA5256D ON category (image_id)');
$this->addSql('CREATE INDEX IDX_64C19C17ADA1FB5 ON category (color_id)');
$this->addSql('ALTER TABLE message_notification ADD image_id INT DEFAULT NULL, ADD color_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE message_notification ADD CONSTRAINT FK_7B55432C3DA5256D FOREIGN KEY (image_id) REFERENCES image (id)');
$this->addSql('ALTER TABLE message_notification ADD CONSTRAINT FK_7B55432C7ADA1FB5 FOREIGN KEY (color_id) REFERENCES color (id)');
$this->addSql('CREATE INDEX IDX_7B55432C3DA5256D ON message_notification (image_id)');
$this->addSql('CREATE INDEX IDX_7B55432C7ADA1FB5 ON message_notification (color_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE category DROP FOREIGN KEY FK_64C19C17ADA1FB5');
$this->addSql('ALTER TABLE message_notification DROP FOREIGN KEY FK_7B55432C7ADA1FB5');
$this->addSql('ALTER TABLE category DROP FOREIGN KEY FK_64C19C13DA5256D');
$this->addSql('ALTER TABLE message_notification DROP FOREIGN KEY FK_7B55432C3DA5256D');
$this->addSql('DROP TABLE color');
$this->addSql('DROP TABLE image');
$this->addSql('DROP INDEX IDX_64C19C13DA5256D ON category');
$this->addSql('DROP INDEX IDX_64C19C17ADA1FB5 ON category');
$this->addSql('ALTER TABLE category DROP image_id, DROP color_id');
$this->addSql('DROP INDEX IDX_7B55432C3DA5256D ON message_notification');
$this->addSql('DROP INDEX IDX_7B55432C7ADA1FB5 ON message_notification');
$this->addSql('ALTER TABLE message_notification DROP image_id, DROP color_id');
}
}