1.error
#1215 - Cannot add foreign key constraint
2.old sql:
CREATE TABLE IF NOT EXISTS `pkrss_rssitem_l1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `tid` int(11) NOT NULL, `cid` int(11) NOT NULL COMMENT 'pkrss_rsscatalog.id', `lid` int(11) NOT NULL COMMENT 'pkrss_rsslocale.id', `item_pubdate` datetime DEFAULT NULL, `item_title` varchar(127) COLLATE utf8_bin NOT NULL, `item_desc` varchar(246) COLLATE utf8_bin NOT NULL, `item_link` varchar(246) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, `item_authors` varchar(64) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`), KEY `item_pubdate` (`item_pubdate`), CONSTRAINT fk_PerItems_l1 FOREIGN KEY (tid) REFERENCES pkrss_rsstable(id) on DELETE cascade ON update cascade ) DEFAULT CHARSET=utf8 COLLATE=utf8_bin
3.new sql
CREATE TABLE IF NOT EXISTS `pkrss_rssitem_l1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `tid` int(11) NOT NULL, `cid` int(11) NOT NULL COMMENT 'pkrss_rsscatalog.id', `lid` int(11) NOT NULL COMMENT 'pkrss_rsslocale.id', `item_pubdate` datetime DEFAULT NULL, `item_title` varchar(127) COLLATE utf8_bin NOT NULL, `item_desc` varchar(246) COLLATE utf8_bin NOT NULL, `item_link` varchar(246) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, `item_authors` varchar(64) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id`), KEY `item_pubdate` (`item_pubdate`), CONSTRAINT fk_PerItems_l1 FOREIGN KEY (tid) REFERENCES pkrss_rsstable(id) on DELETE cascade ON update cascade ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin
4.last
Note:
ENGINE=MyISAM
No comments:
Post a Comment