Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

cleanup database

Go to End

4 Posts   3834 Views


Community Member, 89 Posts

25 April 2009 at 11:07pm


is there a way to cleanup the database from unused fields?



Community Member, 70 Posts

27 April 2009 at 11:26am

It is a fair question and as a developer who has been known to change column names etc during development, I know it can be a pain sometimes!

As far as I know, there is no code available to clean up unused fields. Any code would be dangerous anyway as it would have to assume that any columns not mentioned in the code db declaration is fair game to be removed - there may be reasons why extra columns are manually added to tables however (say for 3rd party data etc).

What I generally do is just manually delete unused columns from tables using a database admin tool like phpMyAdmin.
I don't mind having my development environment a bit messy anyway as I use separate sites for testing & live, so by the time I upload code to live, the column names are settled and few redundant columns show on the live database.

The other point to bear in mind is that in general, a couple of redundant columns on a table will not adversely affect performance to any appreciable level.

That said, I don't like having them in there either!


Community Member, 97 Posts

21 April 2012 at 2:10am

Sometimes I just remove the whole table and then run /dev/build to rebuild the database.

however, you only do that in the development mode and you don't have any live data in the database.


Forum Moderator, 1899 Posts

21 April 2012 at 6:44am

it has an awesome "remove artifcats" fucntion that'll clean up your unsude DB fields and tables