Jump to:

23370 Posts in 18145 Topics by 2864 members

General Questions

SilverStripe Forums » General Questions » cleanup database

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

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

Page: 1
Go to End
Author Topic: 1889 Views
  • marcink
    Avatar
    Community Member
    89 Posts

    cleanup database Link to this post

    hi,

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

    thanks

  • rbquirke
    Avatar
    Community Member
    70 Posts

    Re: cleanup database Link to this post

    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!

  • BenWu
    Avatar
    Community Member
    87 Posts

    Re: cleanup database Link to this post

    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.

  • swaiba
    Avatar
    Forum Moderator
    1784 Posts

    Re: cleanup database Link to this post

    https://github.com/smindel/silverstripe-dbplumber

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

    1889 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.