<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use App\Entity\Admin\LocaleInterface;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20250908123530 extends AbstractMigration
{
public function getDescription(): string
{
return 'Change the default value for the field default_language, and set to fr_FR the NULL default_languages';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE user CHANGE default_language default_language VARCHAR(20) DEFAULT "' . LocaleInterface::LOCALE_FR . '"');
$this->addSql('UPDATE user SET default_language = "' . LocaleInterface::LOCALE_FR . '" WHERE default_language IS NULL');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE user CHANGE default_language default_language VARCHAR(20) DEFAULT NULL');
}
}