app/DoctrineMigrations/Version20250730044307.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 Version20250730044307 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Add sync_date field to dtb_order table for API synchronization tracking';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $table $schema->getTable('dtb_order');
  15.         if (!$table->hasColumn('sync_date')) {
  16.             $this->addSql("ALTER TABLE dtb_order ADD sync_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL");
  17.             $this->addSql("COMMENT ON COLUMN dtb_order.sync_date IS 'API synchronization date'");
  18.         }
  19.     }
  20.     public function down(Schema $schema): void
  21.     {
  22.         $table $schema->getTable('dtb_order');
  23.         if ($table->hasColumn('sync_date')) {
  24.             $this->addSql("ALTER TABLE dtb_order DROP COLUMN sync_date");
  25.         }
  26.     }
  27. }