migrations/Version20220305161151.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20220305161151 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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');
  19.         $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');
  20.         $this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307F1BC7E6B6 FOREIGN KEY (writer_id) REFERENCES user (id)');
  21.         $this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307F54177093 FOREIGN KEY (room_id) REFERENCES room (id)');
  22.         $this->addSql('ALTER TABLE room ADD CONSTRAINT FK_729F519BA5626C52 FOREIGN KEY (caller_id) REFERENCES user (id)');
  23.         $this->addSql('ALTER TABLE room ADD CONSTRAINT FK_729F519BD0106411 FOREIGN KEY (called_id) REFERENCES user (id)');
  24.         $this->addSql('CREATE INDEX IDX_C42F7784158E0B66 ON report (target_id)');
  25.     }
  26.     public function down(Schema $schema): void
  27.     {
  28.         // this down() migration is auto-generated, please modify it to your needs
  29.         $this->addSql('ALTER TABLE message DROP FOREIGN KEY FK_B6BD307F54177093');
  30.         $this->addSql('DROP TABLE message');
  31.         $this->addSql('DROP TABLE room');
  32.         $this->addSql('DROP INDEX IDX_C42F7784158E0B66 ON report');
  33.     }
  34. }