<?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 Version20210929084219 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('ALTER TABLE chat_message ADD resource_id INT DEFAULT NULL, CHANGE date sent_at DATETIME NOT NULL, CHANGE `read` is_read TINYINT(1) DEFAULT \'0\' NOT NULL');
$this->addSql('ALTER TABLE chat_message ADD CONSTRAINT FK_FAB3FC1689329D25 FOREIGN KEY (resource_id) REFERENCES resource (id)');
$this->addSql('ALTER TABLE chat_message ADD CONSTRAINT FK_FAB3FC16E04E49DF FOREIGN KEY (scenario_id) REFERENCES scenario (id)');
$this->addSql('CREATE INDEX IDX_FAB3FC1689329D25 ON chat_message (resource_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE chat_message DROP FOREIGN KEY FK_FAB3FC1689329D25');
$this->addSql('ALTER TABLE chat_message DROP FOREIGN KEY FK_FAB3FC16E04E49DF');
$this->addSql('DROP INDEX IDX_FAB3FC1689329D25 ON chat_message');
$this->addSql('ALTER TABLE chat_message DROP resource_id, CHANGE sent_at date DATETIME NOT NULL, CHANGE is_read `read` TINYINT(1) DEFAULT \'0\' NOT NULL');
}
}