migrations/Version20260116103058.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. final class Version20260116103058 extends AbstractMigration
  7. {
  8. public function getDescription(): string
  9. {
  10. return '';
  11. }
  12. public function up(Schema $schema): void
  13. {
  14. // this up() migration is auto-generated, please modify it to your needs
  15. $this->addSql('CREATE TABLE message (id INT AUTO_INCREMENT NOT NULL, sender_id INT NOT NULL, recipient_id INT NOT NULL, content LONGTEXT NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_B6BD307FF624B39D (sender_id), INDEX IDX_B6BD307FE92F8F78 (recipient_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  16. $this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307FF624B39D FOREIGN KEY (sender_id) REFERENCES user (id) ON DELETE CASCADE');
  17. $this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307FE92F8F78 FOREIGN KEY (recipient_id) REFERENCES user (id) ON DELETE CASCADE');
  18. }
  19. public function down(Schema $schema): void
  20. {
  21. // this down() migration is auto-generated, please modify it to your needs
  22. $this->addSql('ALTER TABLE message DROP FOREIGN KEY FK_B6BD307FF624B39D');
  23. $this->addSql('ALTER TABLE message DROP FOREIGN KEY FK_B6BD307FE92F8F78');
  24. $this->addSql('DROP TABLE message');
  25. }
  26. }