title: Mysql - make unique constraints on both fields
body: <p>I'm using mysql (mariadb).
  I have one table &quot;events_ratings&quot;, which contains 4 columns</p>
  <pre><code>CREATE TABLE `event_ratings` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `id_event` int(11) NOT NULL,
    `rating` int(1) NOT NULL,
    `id_user` char(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL
    PRIMARY KEY `id`,
    ADD CONSTRAINT `idevent` FOREIGN KEY (`id_event`) REFERENCES `events_fb` (`id`) ON UPDATE CASCADE,
    ADD CONSTRAINT `iduser` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`) ON UPDATE CASCADE;
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
    
  
  </code></pre>
  <p>The aim of this table is to provide user rating, so :</p>
  <ul>
  <li>Each user can rate an event (based on his unique &quot;id_user&quot;). The user could rates many events as he wants but never the same one.</li>
  </ul>
  <p>So basically id_user AND id_event should never have duplicated values.
  I know how to make a column unique but how to make a constraint based on two fields ?</p>
  <p>thanks</p>