<?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 Version20220305161151 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 message (id INT AUTO_INCREMENT NOT NULL, writer_id INT NOT NULL, room_id INT NOT NULL, content LONGTEXT NOT NULL, unseen TINYINT(1) NOT NULL, send_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_B6BD307F1BC7E6B6 (writer_id), INDEX IDX_B6BD307F54177093 (room_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE room (id INT AUTO_INCREMENT NOT NULL, caller_id INT NOT NULL, called_id INT NOT NULL, last_message VARCHAR(150) NOT NULL, last_update DATETIME NOT NULL, INDEX IDX_729F519BA5626C52 (caller_id), INDEX IDX_729F519BD0106411 (called_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307F1BC7E6B6 FOREIGN KEY (writer_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307F54177093 FOREIGN KEY (room_id) REFERENCES room (id)');
$this->addSql('ALTER TABLE room ADD CONSTRAINT FK_729F519BA5626C52 FOREIGN KEY (caller_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE room ADD CONSTRAINT FK_729F519BD0106411 FOREIGN KEY (called_id) REFERENCES user (id)');
$this->addSql('CREATE INDEX IDX_C42F7784158E0B66 ON report (target_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE message DROP FOREIGN KEY FK_B6BD307F54177093');
$this->addSql('DROP TABLE message');
$this->addSql('DROP TABLE room');
$this->addSql('DROP INDEX IDX_C42F7784158E0B66 ON report');
}
}