Jump to:

22977 Posts in 11667 Topics by 2827 members

General Questions

SilverStripe Forums » General Questions » How to delete or clean database table?

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: 2669 Views
  • jQuery.in.th
    Avatar
    Community Member
    7 Posts

    How to delete or clean database table? Link to this post

    I have created SamplePage.php and Build db /dev/build. I will be have new table. If I delete SamplePage.php and rebuild DB the table it not delete.

    How to auto delete or clean database table after delete SamplePage.php or something page?

    Ext:
    Step 1 : I have created 5 page controller and 5 data object files.
    Test1.php
    Test2.php
    Test3.php
    Test4.php
    Test5.php

    Step 2: I have build DB /dev/build?flush=all

    Step 3: I have deleted 5 files in folder mysite/code/ and Build DB again.
    delete Test1.php
    delete Test2.php
    delete Test3.php
    delete Test4.php
    delete Test5.php

    Step 3: I check in Database but table in database is not delete.

    Thanks.

  • ttyl
    Avatar
    Community Member
    114 Posts

    Re: How to delete or clean database table? Link to this post

    I've found it keeps old fields as well, I just remove them manually in MySQL

  • dalesaurus
    Avatar
    Community Member
    283 Posts

    Re: How to delete or clean database table? Link to this post

    This is more of an architectural thing. The idea being if you change your mind of need to roll back to old code it will still work and the data will be intact.

    You might want to search/ask in the Data Model forum on how to discretely prune your tables. Personally, I just run alter statements after I'm sure they can be deleted.

    2669 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.