migrations/Version20250707042849.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 Version20250707042849 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'company_country_id > mybiz_on_boarding + on supprime les boolĂ©ans inutiles';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('ALTER TABLE mybiz_on_boarding ADD company_country_id INT DEFAULT NULL');
  19.         $this->addSql('UPDATE mybiz_on_boarding SET company_country_id = (SELECT id FROM app_country WHERE alpha2 = company_country_code)');
  20.         $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');
  21.         $this->addSql('ALTER TABLE mybiz_on_boarding ADD CONSTRAINT FK_7957ED8B44A1D7E6 FOREIGN KEY (company_country_id) REFERENCES app_country (id)');
  22.         $this->addSql('CREATE INDEX IDX_7957ED8B44A1D7E6 ON mybiz_on_boarding (company_country_id)');
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.         $this->addSql('ALTER TABLE mybiz_on_boarding DROP INDEX IDX_7957ED8B44A1D7E6');
  28.         $this->addSql('ALTER TABLE mybiz_on_boarding DROP FOREIGN KEY FK_7957ED8B44A1D7E6');
  29.         $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');
  30.     }
  31. }