migrations/Version20250908123530.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use App\Entity\Admin\LocaleInterface;
  5. use Doctrine\DBAL\Schema\Schema;
  6. use Doctrine\Migrations\AbstractMigration;
  7. final class Version20250908123530 extends AbstractMigration
  8. {
  9.     public function getDescription(): string
  10.     {
  11.         return 'Change the default value for the field default_language, and set to fr_FR the NULL default_languages';
  12.     }
  13.     public function up(Schema $schema): void
  14.     {
  15.         $this->addSql('ALTER TABLE user CHANGE default_language default_language VARCHAR(20) DEFAULT "' LocaleInterface::LOCALE_FR '"');
  16.         $this->addSql('UPDATE user SET default_language = "' LocaleInterface::LOCALE_FR '" WHERE default_language IS NULL');
  17.     }
  18.     public function down(Schema $schema): void
  19.     {
  20.         $this->addSql('ALTER TABLE user CHANGE default_language default_language VARCHAR(20) DEFAULT NULL');
  21.     }
  22. }