<?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 Version20250707042849 extends AbstractMigration
{
public function getDescription(): string
{
return 'company_country_id > mybiz_on_boarding + on supprime les booléans inutiles';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE mybiz_on_boarding ADD company_country_id INT DEFAULT NULL');
$this->addSql('UPDATE mybiz_on_boarding SET company_country_id = (SELECT id FROM app_country WHERE alpha2 = company_country_code)');
$this->addSql('ALTER TABLE mybiz_on_boarding DROP has_completed_contract, DROP has_completed_kyc, DROP has_completed_siret, DROP has_completed_immatriculation, DROP has_completed_declaration, DROP has_completed_vigilance, DROP company_country_code');
$this->addSql('ALTER TABLE mybiz_on_boarding ADD CONSTRAINT FK_7957ED8B44A1D7E6 FOREIGN KEY (company_country_id) REFERENCES app_country (id)');
$this->addSql('CREATE INDEX IDX_7957ED8B44A1D7E6 ON mybiz_on_boarding (company_country_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE mybiz_on_boarding DROP INDEX IDX_7957ED8B44A1D7E6');
$this->addSql('ALTER TABLE mybiz_on_boarding DROP FOREIGN KEY FK_7957ED8B44A1D7E6');
$this->addSql('ALTER TABLE mybiz_on_boarding DROP company_country_id, ADD has_completed_contract BOOLEAN NOT NULL, ADD has_completed_kyc BOOLEAN NOT NULL, ADD has_completed_siret BOOLEAN NOT NULL, ADD has_completed_immatriculation BOOLEAN NOT NULL, ADD has_completed_declaration BOOLEAN NOT NULL, ADD has_completed_vigilance BOOLEAN NOT NULL, ADD company_country_code VARCHAR(2) DEFAULT NULL');
}
}