CREATE TABLE IF NOT EXISTS `#__web_projects`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`type_website` varchar(30) COLLATE utf8_polish_ci NOT NULL,
`web_color` varchar(255) COLLATE utf8_polish_ci NOT NULL,
`web_fonts` varchar(255) COLLATE utf8_polish_ci NOT NULL,
`web_layout` text COLLATE utf8_polish_ci NOT NULL,
`web_menu` text COLLATE utf8_polish_ci NOT NULL,
`similar_web_sites` text COLLATE utf8_polish_ci NOT NULL,
`additional_info` text COLLATE utf8_polish_ci,
`about_company` text COLLATE utf8_polish_ci,
`offer` text COLLATE utf8_polish_ci,
`logo` varchar(255) COLLATE utf8_polish_ci NOT NULL,
`user_id` int(11) NOT NULL,
PRIMARY KEY(id),
FOREIGN KEY (`user_id`) REFERENCES `#__users`(id) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci
这是我在joomla中声明的表,并且总是收到无法创建此表的错误。是什么原因造成的??
最佳答案
我想提一提,您应该将user_id设为UNSIGNED!
我已经在Joomla中测试了您的SQL! 2.5,它可以完美运行(无论如何,我还是假设您的MySQL引擎是InnoDB)。没有SQL错误,恐怕没人能帮助您。
关于mysql - 无法在joomla 2.5中声明外键,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12576534/