migrations/Version20251209170000.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 Version20251209170000 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Adds "Hediye Çeki" to payment_method table';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // Check if "Hediye Çeki" already exists to avoid duplicates (though name is not unique constraint usually, good practice)
  18.         $exists $this->connection->fetchOne("SELECT count(*) FROM payment_method WHERE name = 'Hediye Çeki'");
  19.         if (!$exists) {
  20.             $this->addSql("INSERT INTO payment_method (name, details) VALUES ('Hediye Çeki', 'Gift Voucher Payment')");
  21.         }
  22.     }
  23.     public function down(Schema $schema): void
  24.     {
  25.         $this->addSql("DELETE FROM payment_method WHERE name = 'Hediye Çeki'");
  26.     }
  27. }