Skip to content

Commit dc5dbff

Browse files
committed
fix #30: race condition in patch uniqueness check
1 parent 637373d commit dc5dbff

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

entities/Patch.php

+8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
use Doctrine\ORM\Mapping\InheritanceType;
1212
use Doctrine\ORM\Mapping\ManyToOne;
1313
use Doctrine\ORM\Mapping\ManyToMany;
14+
use Doctrine\ORM\Mapping\Table;
15+
use Doctrine\ORM\Mapping\UniqueConstraint;
1416

1517
define('PATCH_WAITING_REVIEW', 0);
1618
define('PATCH_REVIEWED', 1);
@@ -31,6 +33,12 @@
3133

3234

3335
/** @Entity
36+
* @Table(name="patches",
37+
* uniqueConstraints={
38+
* @UniqueConstraint(name="unique_issue_per_group", columns={"group_id", "issue_url"}),
39+
* @UniqueConstraint(name="unique_issue_per_group", columns={"group_id", "repo_branch"}),
40+
* }
41+
* )
3442
* @InheritanceType("SINGLE_TABLE")
3543
* @DiscriminatorColumn(name="platform", type="string")
3644
* @DiscriminatorMap({"github" = "GitHub\GitHubPatch"})

0 commit comments

Comments
 (0)