fix(composant) : replace unique constraint from name to reference validation

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>
This commit is contained in:
2026-03-25 22:12:19 +01:00
parent 66fa0a506c
commit 3a75269323
2 changed files with 29 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
<?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)');
}
}