Remove DB unique index on composants.name and add Symfony UniqueEntity validation on reference field with explicit error message. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
27 lines
694 B
PHP
27 lines
694 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DoctrineMigrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
final class Version20260325214500 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return 'Remove unique constraint on composants.name (uniqueness on reference is now enforced at application level via UniqueEntity)';
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
$this->addSql('DROP INDEX IF EXISTS uniq_f95a31995e237e06');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$this->addSql('CREATE UNIQUE INDEX IF NOT EXISTS uniq_f95a31995e237e06 ON composants (name)');
|
|
}
|
|
}
|