Fix unique index condition for quiz_candidate with soft deletes

- Updated condition in unique index definition of `quiz_candidate` to add parentheses for clarity.
- Adjusted related migration to reflect the revised condition.
This commit is contained in:
2026-05-24 15:58:37 +02:00
parent 246ff999d3
commit 0c95b22fa7
5 changed files with 11 additions and 3 deletions
+1
View File
@@ -166,6 +166,7 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/gedmo/doctrine-extensions" /> <excludeFolder url="file://$MODULE_DIR$/vendor/gedmo/doctrine-extensions" />
<excludeFolder url="file://$MODULE_DIR$/vendor/stof/doctrine-extensions-bundle" /> <excludeFolder url="file://$MODULE_DIR$/vendor/stof/doctrine-extensions-bundle" />
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/git-state" /> <excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/git-state" />
<excludeFolder url="file://$MODULE_DIR$/vendor/ergebnis/agent-detector" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
Generated
+1
View File
@@ -203,6 +203,7 @@
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php84" /> <path value="$PROJECT_DIR$/vendor/symfony/polyfill-php84" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php85" /> <path value="$PROJECT_DIR$/vendor/symfony/polyfill-php85" />
<path value="$PROJECT_DIR$/vendor/sebastian/git-state" /> <path value="$PROJECT_DIR$/vendor/sebastian/git-state" />
<path value="$PROJECT_DIR$/vendor/ergebnis/agent-detector" />
</include_path> </include_path>
</component> </component>
<component name="PhpInterpreters"> <component name="PhpInterpreters">
+6
View File
@@ -1309,6 +1309,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param;
* traces_sampler?: scalar|Param|null, * traces_sampler?: scalar|Param|null,
* profiles_sample_rate?: float|Param, // The sampling factor to apply to profiles. A value of 0 will deny sending any profiles, and a value of 1 will send all profiles. Profiles are sampled in relation to traces_sample_rate * profiles_sample_rate?: float|Param, // The sampling factor to apply to profiles. A value of 0 will deny sending any profiles, and a value of 1 will send all profiles. Profiles are sampled in relation to traces_sample_rate
* enable_logs?: bool|Param, * enable_logs?: bool|Param,
* log_flush_threshold?: mixed, // Default: null
* enable_metrics?: bool|Param, // Default: true * enable_metrics?: bool|Param, // Default: true
* attach_stacktrace?: bool|Param, * attach_stacktrace?: bool|Param,
* attach_metric_code_locations?: bool|Param, * attach_metric_code_locations?: bool|Param,
@@ -1318,6 +1319,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param;
* spotlight?: bool|Param, * spotlight?: bool|Param,
* spotlight_url?: scalar|Param|null, * spotlight_url?: scalar|Param|null,
* release?: scalar|Param|null, // Default: "%env(default::SENTRY_RELEASE)%" * release?: scalar|Param|null, // Default: "%env(default::SENTRY_RELEASE)%"
* org_id?: int|Param,
* server_name?: scalar|Param|null, * server_name?: scalar|Param|null,
* ignore_exceptions?: list<scalar|Param|null>, * ignore_exceptions?: list<scalar|Param|null>,
* ignore_transactions?: list<scalar|Param|null>, * ignore_transactions?: list<scalar|Param|null>,
@@ -1328,6 +1330,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param;
* before_send_log?: scalar|Param|null, * before_send_log?: scalar|Param|null,
* before_send_metric?: scalar|Param|null, * before_send_metric?: scalar|Param|null,
* trace_propagation_targets?: mixed, * trace_propagation_targets?: mixed,
* strict_trace_continuation?: bool|Param,
* tags?: array<string, scalar|Param|null>, * tags?: array<string, scalar|Param|null>,
* error_types?: scalar|Param|null, * error_types?: scalar|Param|null,
* max_breadcrumbs?: int|Param, * max_breadcrumbs?: int|Param,
@@ -1352,11 +1355,13 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param;
* enabled?: bool|Param, // Default: false * enabled?: bool|Param, // Default: false
* capture_soft_fails?: bool|Param, // Default: true * capture_soft_fails?: bool|Param, // Default: true
* isolate_breadcrumbs_by_message?: bool|Param, // Default: false * isolate_breadcrumbs_by_message?: bool|Param, // Default: false
* isolate_context_by_message?: bool|Param, // Default: false
* }, * },
* tracing?: bool|array{ * tracing?: bool|array{
* enabled?: bool|Param, // Default: true * enabled?: bool|Param, // Default: true
* dbal?: bool|array{ * dbal?: bool|array{
* enabled?: bool|Param, // Default: true * enabled?: bool|Param, // Default: true
* ignore_prepare_spans?: bool|Param, // Default: false
* connections?: list<scalar|Param|null>, * connections?: list<scalar|Param|null>,
* }, * },
* twig?: bool|array{ * twig?: bool|array{
@@ -1376,6 +1381,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param;
* @psalm-type SymfonycastsSassConfig = array{ * @psalm-type SymfonycastsSassConfig = array{
* root_sass?: list<scalar|Param|null>, * root_sass?: list<scalar|Param|null>,
* binary?: scalar|Param|null, // The Sass binary to use // Default: null * binary?: scalar|Param|null, // The Sass binary to use // Default: null
* search_for_binary?: scalar|Param|null, // Whether to search for the Sass binary in the system PATH // Default: true
* sass_options?: array{ * sass_options?: array{
* style?: "compressed"|"expanded"|Param, // The style of the generated CSS: compressed or expanded. // Default: "expanded" * style?: "compressed"|"expanded"|Param, // The style of the generated CSS: compressed or expanded. // Default: "expanded"
* charset?: bool|Param, // Whether to include the charset declaration in the generated Sass. * charset?: bool|Param, // Whether to include the charset declaration in the generated Sass.
@@ -7,7 +7,7 @@ namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration; use Doctrine\Migrations\AbstractMigration;
final class Version20260524121119 extends AbstractMigration final class Version20260524135246 extends AbstractMigration
{ {
public function getDescription(): string public function getDescription(): string
{ {
@@ -18,7 +18,7 @@ final class Version20260524121119 extends AbstractMigration
{ {
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX uniq_ced2ffa291bd8781853cd175'); $this->addSql('DROP INDEX uniq_ced2ffa291bd8781853cd175');
$this->addSql('CREATE UNIQUE INDEX UNIQ_CED2FFA291BD8781853CD175 ON quiz_candidate (candidate_id, quiz_id) WHERE deleted_at IS NULL'); $this->addSql('CREATE UNIQUE INDEX UNIQ_CED2FFA291BD8781853CD175 ON quiz_candidate (candidate_id, quiz_id) WHERE (deleted_at IS NULL)');
} }
public function down(Schema $schema): void public function down(Schema $schema): void
+1 -1
View File
@@ -14,7 +14,7 @@ use Tvdt\Repository\QuizCandidateRepository;
#[Gedmo\SoftDeleteable] #[Gedmo\SoftDeleteable]
#[ORM\Entity(repositoryClass: QuizCandidateRepository::class)] #[ORM\Entity(repositoryClass: QuizCandidateRepository::class)]
#[ORM\UniqueConstraint(columns: ['candidate_id', 'quiz_id'], options: ['where' => 'deleted_at IS NULL'])] #[ORM\UniqueConstraint(columns: ['candidate_id', 'quiz_id'], options: ['where' => '(deleted_at IS NULL)'])]
class QuizCandidate class QuizCandidate
{ {
use SoftDeleteableEntity; use SoftDeleteableEntity;