mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Add database-level uniqueness constraint for check-ins
We measured that this creates a ~10% performance loss on MySQL, but believe that correctness is more important. Also, in case on concurrent check-ins on MySQL with default transaction isolation level, this might lead to Internal Server Errors on all but one check-ins, which is still better than to show green.
This commit is contained in:
@@ -167,6 +167,9 @@ class Checkin(models.Model):
|
||||
'pretixbase.CheckinList', related_name='checkins', on_delete=models.PROTECT,
|
||||
)
|
||||
|
||||
class Meta:
|
||||
unique_together = (('list', 'position'),)
|
||||
|
||||
def __repr__(self):
|
||||
return "<Checkin: pos {} on list '{}' at {}>".format(
|
||||
self.position, self.list, self.datetime
|
||||
|
||||
Reference in New Issue
Block a user