title: Unable to add foreign key constraint after changing char set
body: <p>I have a table that I'm using to store text messages in an app. I wanted to add the ability to use emojis but they kept showing up as ? ? ? ? etc... in the db. I learned that I needed to changes the character set of my table so I ran the command</p>
  
  <p><code>ALTER TABLE posts CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin</code></p>
  
  <p>but I got this error: <code>Error Code: 1832. Cannot change column 'user_id': used in a foreign key constraint 'posts_ibfk_2'</code></p>
  
  <p>so I dropped the FK and then ran the command and everything worked great. However now, when I try to readd the FK I keep getting a 1215 error that I can't add FK constraint.</p>
  
  <pre><code>ALTER TABLE posts
  ADD FOREIGN KEY (user_id)
  REFERENCES users(id);
  </code></pre>
  
  <p>I tried converting the char set back to what it was originally and am still unable to add the FK. How can I add it back?</p>