mirror of https://github.com/zulip/zulip.git
models: Drop unique index on user/message/emoji_name.
c7d0192755
added the unique constraint on `user_profile_id,message_id,reaction_type,emoji_code`, but left the existing constraint on `user_profile_id,message_id,emoji_name`. As explained in the comment added in3cd543ee98
, `emoji_name` cannot be trusted to be unique, as it is possible to have an Unicode emoji reaction and a custom emoji with the same name on a message. Remove the overly-constraining unique index, now thatc7d0192755
has provided the correct one.
This commit is contained in:
parent
b0d9b319e3
commit
52b8a84219
|
@ -0,0 +1,20 @@
|
|||
# Generated by Django 4.1.6 on 2023-02-25 01:22
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("zerver", "0430_fix_audit_log_objects_for_group_based_stream_settings"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterUniqueTogether(
|
||||
name="archivedreaction",
|
||||
unique_together={("user_profile", "message", "reaction_type", "emoji_code")},
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name="reaction",
|
||||
unique_together={("user_profile", "message", "reaction_type", "emoji_code")},
|
||||
),
|
||||
]
|
|
@ -3169,10 +3169,7 @@ class AbstractEmoji(models.Model):
|
|||
class AbstractReaction(AbstractEmoji):
|
||||
class Meta:
|
||||
abstract = True
|
||||
unique_together = (
|
||||
("user_profile", "message", "emoji_name"),
|
||||
("user_profile", "message", "reaction_type", "emoji_code"),
|
||||
)
|
||||
unique_together = ("user_profile", "message", "reaction_type", "emoji_code")
|
||||
|
||||
|
||||
class Reaction(AbstractReaction):
|
||||
|
|
Loading…
Reference in New Issue