title: Django: UniqueConstraint Not Enforced
body: <p>I'm trying to use a UniqueConstraint as follows:</p>
  <pre><code>class CitationVote(models.Model):
      user_who_voted = models.ForeignKey('User', on_delete=models.CASCADE)
      vote = models.IntegerField(choices = [(-1, &quot;down&quot;), (1, &quot;up&quot;)])
      timestamp_voted = models.DateTimeField()
      citation_id = models.ForeignKey('Citation', on_delete=models.CASCADE)
      class meta:
          constraints = [models.UniqueConstraint(fields=['user_who_voted', 'citation_id'], name='one_vote_pp')]
  </code></pre>
  <p>Although the Django 3.0 docs do not mention any restriction on using UniqueConstraint with a Foreign Key (or Unique_Together, neither of which work in this example), the restriction is certainly not enforced in testing. I don't see anything in migrations either that indicate the constraint being enforced in Postgres.</p>
  <p>For kicks, I changed the code to:</p>
  <pre><code>class CitationVote(models.Model):
      user_who_voted = models.ForeignKey('User', on_delete=models.CASCADE)
      vote = models.IntegerField(choices = [(-1, &quot;down&quot;), (1, &quot;up&quot;)])
      timestamp_voted = models.DateTimeField()
      citation_id = models.ForeignKey('Citation', on_delete=models.CASCADE)
      class meta:
          constraints = [models.UniqueConstraint(fields=['vote', 'timestamp_voted'], name='one_vote_pp')]
  </code></pre>
  <p>Alas, the same thing occurs (and yes, I drop the entire DB and recreate it fresh each time)-- no constraint enforced, nothing in migrations to suggest it would be after applying them.</p>
  <p>Am I doing something obviously wrong here?</p>