有没有方便的方法从数据库中删除过时的表列?我想知道是否有更多基于约定的解决方案,而不是登录到 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/