<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20221209170512 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add descriptive_id and is_default fields to the subscription_plan table - second part';
}
public function up(Schema $schema): void
{
$this->addSql('UPDATE subscription_plan SET descriptive_id="common" WHERE name="RĂ©gime commun"');
$this->addSql('UPDATE subscription_plan SET descriptive_id="prestaplus" WHERE name="Presta plus"');
$this->addSql('UPDATE subscription_plan SET descriptive_id="complete" WHERE name="Denta opti plus"');
$schema->getTable('subscription_plan')->addIndex(
['descriptive_id'],
'uniq_subscription_plan_descriptive_id'
);
$schema->getTable('subscription_plan')->getColumn('descriptive_id')->setNotnull(true);
}
public function down(Schema $schema): void
{
}
}