How to remove obsolete database columns in SilverStripe

Is there any convenient way to remove obsolete table columns from the database? I am wondering if there are more agreement-based solutions, rather than go into PHPMyADMIN and delete columns manually.

Example When installing SilverStripe-Fluent and adding an additional locale (for example, nz-NZ), the module will split each SiteTree entry to add additional translation columns with the _nz-NZ prefix. Suppose we remove the extra locale (nz-NZ), the columns will remain there after / dev / build.

+5
source share
1 answer

there was a great DBPlumber module for version 2.4 with this feature, but I assume you are using a later version! It would be great if it were updated for V3.

An artefact cleaner module would be ideal. Its description from github page ...

Find and optionally delete unused tables and fields in the SilverStripe database.

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

+1
source

All Articles