Hi all,
I'm trying to create migration with uniqueness of 2 fields: uid, source. *Django 2.2.9* class Users(models.Model): uid = models.CharField(...) source = models.ForeignKey(*...*) class Meta: constraints = [models.UniqueConstraint(fields=['uid', 'source'], name='users_uniqueness')] indexes = [models.Index(fields=('uid', 'source'), name='users_indexes')] When I start makemigrations command in manage.py it rises *fields.E310 <https://docs.djangoproject.com/en/2.2/ref/checks/#related-fields>* error app_name.Users.field: (fields.E310) No subset of the fields 'uid', 'source' on model 'Users' is unique. HINT: Add unique=True on any of those fields or add at least a subset of them to a unique_together constraint. When I change Meta options to unique_together constraint it works ok. Migrations passes with no errors ... class Meta: unique_together = [['uid', 'source']] As mentioned in docs <https://docs.djangoproject.com/en/2.2/ref/models/options/#unique-together> unique_together may be deprecated in the future so I wanted to avoid this kind of issue. *Thanks,* *Pavel* -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5ea7b380-152c-47d0-960b-dfe6c1fbedf6%40googlegroups.com.