migrations/Version20251201114029.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 Version20251201114029 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Adds boolean fields: accepted_by_deliveryman and is_auto_order to command table; adds auto_accept to restaurant_config table';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         // Add fields to command table
  15.         $this->addSql("
  16.             ALTER TABLE `command`
  17.                 ADD `accepted_by_deliveryman` TINYINT(1) DEFAULT NULL
  18.         ");
  19.         $this->addSql("
  20.             ALTER TABLE `command`
  21.                  ADD `is_auto_order` TINYINT(1) DEFAULT NULL
  22.         ");
  23.         // Add field to restaurant_config table
  24.         $this->addSql("
  25.             ALTER TABLE `restaurant_config`
  26.                 ADD `auto_accept` TINYINT(1) DEFAULT NULL
  27.         ");
  28.     }
  29.     public function down(Schema $schema): void
  30.     {
  31.         // Remove fields from command table
  32.         $this->addSql("
  33.             ALTER TABLE `command`
  34.                 DROP COLUMN `accepted_by_deliveryman`,
  35.                 DROP COLUMN `is_auto_order`
  36.         ");
  37.         // Remove field from restaurant_config table
  38.         $this->addSql("
  39.             ALTER TABLE `restaurant_config`
  40.                 DROP COLUMN `auto_accept`
  41.         ");
  42.     }
  43. }