title: Foreign constraint On Delete Cascade not working
body: <p>I have a custom table created which has a foreign constraint on the <code>core_website</code> table.  However, the <code>on delete cascade</code> isn't working.</p>
  
  <p>I did a search and found this <a href="https://stackoverflow.com/questions/7320236/in-mysql-on-delete-cascade-not-working">relevant thread</a>, which notes that the data types between the two columns have to be the same.  Both data types are <code>smallint(5)</code>.  </p>
  
  <p>I did notice one minor discrepancy in the column definition, which is that in core_website, Allow Null is <em>not</em> set, and Default is not set to zero, whereas in the account table, Allow Null <em>is</em> set and Default is zero.  I didn't think changing these would have any effect, but I went ahead and changed them on the account table to match, but that didn't help.</p>
  
  <pre><code>CREATE TABLE `account` (
    `account_id` smallint(11) unsigned NOT NULL AUTO_INCREMENT,
    `website_id` smallint(5) unsigned DEFAULT '0',
    `code` varchar(64) NOT NULL DEFAULT '',
    PRIMARY KEY (`account_id`),
    UNIQUE KEY `code` (`code`),
    KEY `FK_WEBSITE_ID` (`website_id`),
    CONSTRAINT `FK_WEBSITE_ID` FOREIGN KEY (`website_id`) REFERENCES `core_website` (`website_id`) ON DELETE CASCADE ON UPDATE CASCADE
  ) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=utf8
  </code></pre>