migrations/Version20251114154500.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 Version20251114154500 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Create app_user_event table';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         $this->addSql('CREATE TABLE mybiz_user_event (
  18.             id INT AUTO_INCREMENT NOT NULL,
  19.             member_id INT NOT NULL,
  20.             title VARCHAR(255) NOT NULL,
  21.             description TEXT DEFAULT NULL,
  22.             datetime DATETIME NOT NULL,
  23.             created_at DATETIME NOT NULL,
  24.             INDEX IDX_USER_EVENT_MEMBER (member_id),
  25.             PRIMARY KEY(id)
  26.         ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  27.         
  28.         $this->addSql('ALTER TABLE mybiz_user_event ADD CONSTRAINT FK_USER_EVENT_MEMBER FOREIGN KEY (member_id) REFERENCES app_member (id)');
  29.     }
  30.     public function down(Schema $schema): void
  31.     {
  32.         $this->addSql('ALTER TABLE mybiz_user_event DROP FOREIGN KEY FK_USER_EVENT_MEMBER');
  33.         $this->addSql('DROP TABLE mybiz_user_event');
  34.     }
  35. }