title: Error in mysql. Failed to add the foreign key constraint
body: <p>I have 2 tables:</p>
  <pre><code>CREATE TABLE IF NOT EXISTS blocks (
    serialSilos VARCHAR(32),
    idBlock VARCHAR(32),
  
    PRIMARY KEY (serialSilos, idBlock),
    FOREIGN KEY (serialSilos) REFERENCES silos(serialSilos) ON UPDATE CASCADE ON DELETE CASCADE
  );
  
  
  CREATE TABLE IF NOT EXISTS view_policies (
    email VARCHAR(128),
    block VARCHAR(32),
   
  
    PRIMARY KEY (email, block),
    FOREIGN KEY (email) REFERENCES users(email) ON UPDATE CASCADE ON DELETE CASCADE,
    FOREIGN KEY (block) REFERENCES blocks(idBlock) ON UPDATE CASCADE ON DELETE CASCADE
   );
  </code></pre>
  <p>and generate this errors:</p>
  <blockquote>
  <p>ERROR 1822 (HY000): Failed to add the foreign key constraint. Missing index for constraint 'view_policies_ibfk_2' in the referenced table 'blocks'</p>
  </blockquote>
  <p>there are other tables but they are irrelevant. Thank you!!!</p>