migrations/Version20251010192254.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 Version20251010192254 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Change fees field to FLOAT to store numeric values with automatic formatting (decimals < 10 = %, integers < 10 = MAD, >= 10 = MAD)';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // Change fees column from VARCHAR(255) to FLOAT using explicit cast
  18.         $this->addSql('ALTER TABLE property_visit_voucher ALTER COLUMN fees TYPE DOUBLE PRECISION USING fees::double precision');
  19.     }
  20.     public function down(Schema $schema): void
  21.     {
  22.         // Revert fees column back to VARCHAR(255)
  23.         $this->addSql('ALTER TABLE property_visit_voucher ALTER COLUMN fees TYPE VARCHAR(255)');
  24.     }
  25. }