<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230427140453 extends AbstractMigration
{
public function getDescription(): string
{
return 'Placeholder country, id 1000 code zz';
}
public function up(Schema $schema): void
{
// Add placeholder country with ID 1000 and code "ZZ" to the countries table
$this->addSql("INSERT INTO country (id, name, iso_code, sms_enabled) VALUES (1000, 'Not Available', 'zz', 1)");
// Set default value for the country field in the users table
$this->addSql("ALTER TABLE creator ALTER country_id SET DEFAULT 1000");
// To update existing users without a country, run the command:
// php bin/console app:update-default-country
}
public function down(Schema $schema): void
{
// Set default value for the country field in the users table
$this->addSql("ALTER TABLE creator ALTER country_id SET DEFAULT NULL");
// Full rollback is more complex and if a complete rollback on production is required, a separate command needs to be written
}
}