php - 如何删除 SilverStripe 中过时的数据库列

标签 php mysql silverstripe

有没有方便的方法从数据库中删除过时的表列?我想知道是否有更多基于约定的解决方案,而不是登录到 PHPMyADMIN 并手动删除列。

例子 安装 SilverStripe-Fluent 并添加额外的语言环境(例如 nz-NZ)时,模块将拆分每个 SiteTree 记录以添加带有前缀 _nz-NZ 的额外翻译列。假设我们删除了额外的语言环境 (nz-NZ),这些列将在/dev/build 之后保留在那里。

最佳答案

有一个很棒的模块 DBPlumber对于具有此功能的 2.4 版,但我猜您使用的是更高版本!如果能升级到 V3 就好了。

模块artefact cleaner会很理想。它在 github 页面上的描述是...

Find and optionally delete disused tables and fields in a SilverStripe database.

During development of a SilverStripe application it is common to delete a data object class or remove a field from a data object. This leaves obsolete columns and tables in your database. Because these columns or tables may contain data that you still want, the SilverStripe framework doesn't delete those automatically. This task displays the obsolete columns and tables in the form of SQL DROP and ALTER commands. It also provides a way to delete them. If you do that, there is no undo, so always make a backup first.

关于php - 如何删除 SilverStripe 中过时的数据库列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39394551/

相关文章:

php - 在 WampServer 中备份 MySQL

silverstripe - 如何在 SilverStripe 中的主题文件夹内创建公共(public)文件夹

php - PHP 中的产量是什么意思?

php - 在 cookie header 之前或之后发送 HTTP header ?

php - 从mysql表中获取数据,其中一列包含字符串格式的日期并与今天的日期匹配

php - SilverStripe 覆盖 URLSegmentFilter 静态

PHP 银条 ORM : Duplicate key value violates unique constraint for DataObject write

php - cakephp:seo 友好的 url 路由 - 避免传递 url 参数

php - 交替颜色 HTML 表 PHP

mysql - 制作另一个MySQL的一个表列的行名