title: MySQL-error 150 solution
body: <p>I have the following MySQL scripts:</p>
  
  <pre><code>CREATE TABLE user_roles (
    id INT AUTO_INCREMENT,
    PRIMARY KEY(id),
    name TEXT NOT NULL,
    access INT NOT NULL DEFAULT '0'
  )
  CREATE TABLE users (
      id INT NOT NULL AUTO_INCREMENT,
      PRIMARY KEY (id),
      name TEXT NOT NULL,
      email TEXT NOT NULL,
      password TEXT NOT NULL,
      date_created DATETIME,
      roles VARCHAR(50) NOT NULL,
      active INT DEFAULT '1',
      FOREIGN KEY(roles) REFERENCES user_roles(id)
  )
  </code></pre>
  
  <p>It keeps giving me error 150. Maybe the database isn't well planned? Any help will be greatly appreciated.</p>