MySql FOREIGN KEY Constraints, error 1005
===

I can [see][1] that there are constraints problems, but what would be the correct way to create a foreign key here?


    mysql> 
    mysql> show tables;
    +----------------+
    | Tables_in_nntp |
    +----------------+
    | articles       |
    | newsgroups     |
    +----------------+
    2 rows in set (0.01 sec)
    
    mysql> 
    mysql> describe newsgroups;
    +-----------+---------+------+-----+---------+----------------+
    | Field     | Type    | Null | Key | Default | Extra          |
    +-----------+---------+------+-----+---------+----------------+
    | id        | int(11) | NO   | PRI | NULL    | auto_increment |
    | newsgroup | text    | NO   |     | NULL    |                |
    +-----------+---------+------+-----+---------+----------------+
    2 rows in set (0.00 sec)
    
    mysql> 
    mysql> describe articles;
    +--------------+---------+------+-----+---------+----------------+
    | Field        | Type    | Null | Key | Default | Extra          |
    +--------------+---------+------+-----+---------+----------------+
    | id           | int(11) | NO   | PRI | NULL    | auto_increment |
    | subject      | text    | NO   |     | NULL    |                |
    | content      | text    | NO   |     | NULL    |                |
    | number       | text    | NO   |     | NULL    |                |
    | sent         | date    | NO   |     | NULL    |                |
    | header_id    | text    | NO   |     | NULL    |                |
    | newsgroup_id | int(11) | NO   |     | NULL    |                |
    +--------------+---------+------+-----+---------+----------------+
    7 rows in set (0.00 sec)
    
    mysql> 
    mysql> ALTER TABLE articles ADD FOREIGN KEY (newsgroup_id) REFERENCES newsgroup(id);
    ERROR 1005 (HY000): Can't create table 'nntp.#sql-3bf_9a' (errno: 150)
    mysql> 



Both tables use innodb.

  [1]: http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html