title: MySQL failing to create a new table using Foreign Keys
body: <p>I only get an error 150 when I run this.  The other tables are InnoDB, the types are primary key, and the data types match.  So I can't see what I'm doing wrong, (and I see no obvious syntax errors).  Any ideas?</p>
  
  <pre><code>CREATE TABLE grouptosite (
    groups_id BIGINT(20),
    usertogroup_groupID BIGINT(20),
  usertogroup_userID BIGINT(20),
    usertosite_id INT(10),
  
    gts_id INT(10) AUTO_INCREMENT NOT NULL,
    PRIMARY KEY (gts_id),
  index (gts_id),
  index (groups_id),
    index (usertogroup_groupID), 
  index (usertogroup_userID),
    index (usertosite_id), 
  
  FOREIGN KEY (groups_id)
      REFERENCES groups(id)
      ON UPDATE CASCADE ON DELETE RESTRICT,
    FOREIGN KEY (usertogroup_groupID, usertogroup_userID)
      REFERENCES usertogroup(groupID, userID)
      ON UPDATE CASCADE ON DELETE RESTRICT,
    FOREIGN KEY (usertosite_id)
      REFERENCES usertosite(id)
      ON UPDATE CASCADE ON DELETE RESTRICT  
  ) ENGINE=INNODB;
  </code></pre>