为什么 CMS 数据库不使用外键?

Why don't CMS databases use Foreign Keys?

为什么 CMS 数据库(例如 WP 和 PRESTASHOP)不在其表上使用外键?我认为表应该有外键以防止孤立行。

摘自post(显然是 WP 工作人员)在
wordpress.org WordPress › 支持 » 插件和黑客 » 黑客

The problem with MySQL is that only a few installations default to innodb. Most use MyISAM tables because they are more "beginner friendly".

Because of this WordPress, and pretty much every other PHP-based CMS that I've seen out there, has to think that it will be using the lowest common denominator, so MyISAM tables with no references are required so it can be as universal as possible.

I will add that the WP system has been set up to use the PHP code to enforce the integrity where it can. That's why it's always best to use the built-in WordPress functions rather then trying to roll your own.

只有 MySQL InnoDB 存储引擎强制执行外键声明。但它们被 MyISAM 存储引擎视为注释,所以我不知道为什么它们没有被声明。

“自定义 Prestashop 软件解决方案和共享和专用虚拟主机服务”成员在
上的帖子 prestashop.com 论坛 > 技术论坛 > 适配我的 PrestaShop > 开发

Because it is only supported when using InnoDB, and not everyone uses that.

And btw, backwards compatibility and thorough testing is not something that Prestashop is famous for.