migrations/Version20260430123000.php line 1

  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. final class Version20260430123000 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Add per-manager flag to manage event requests and registrations';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->abortIf(
  15.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySQL57Platform,
  16.             "Migration can only be executed safely on '\\Doctrine\\DBAL\\Platforms\\MySQL57Platform'."
  17.         );
  18.         $this->addSql('ALTER TABLE `user` ADD can_manage_event_requests_and_registrations TINYINT(1) NOT NULL DEFAULT 0');
  19.         $this->addSql('UPDATE `user` SET can_manage_event_requests_and_registrations = 0');
  20.     }
  21.     public function down(Schema $schema): void
  22.     {
  23.         $this->abortIf(
  24.             !$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySQL57Platform,
  25.             "Migration can only be executed safely on '\\Doctrine\\DBAL\\Platforms\\MySQL57Platform'."
  26.         );
  27.         $this->addSql('ALTER TABLE `user` DROP COLUMN can_manage_event_requests_and_registrations');
  28.     }
  29. }