Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » db/build?flush=1

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 4403 Views
  • cardinale
    Avatar
    Community Member
    23 Posts

    db/build?flush=1 Link to this post

    Hello,
    I have SilverStripe CMS - 2.2.3 running on OS x 1.3.9 with Mamp 1.4.1.

    I created HomePage.php in mysite/code/ with:

    <?php
    /**
    * Defines the HomePage page type
    */
    class HomePage extends Page {
       static $db = array();
       static $has_one = array();
    }
    class HomePage_Controller extends Page_Controller {
    }
    ?>

    I run db/build?flush=1 and it updated the db, perfect!!!

    Than I created PilderPage.php in mysite/code/ with:

    <?php
    /**
    * Defines the PilderPage page type
    */

    class PilderPage extends Page {
       static $db = array(
       );
       static $has_one = array(
       );

    }

    class PilderPage_Controller extends Page_Controller {
       
    }
    ?>


    When I run db/build?flush=1 the db is not updated??? What's wrong?

  • JGC
    Avatar
    Community Member
    25 Posts

    Re: db/build?flush=1 Link to this post

    Occasionally your browser caches the flush page. The ?flush=1 tells the server not to cache it, but if your browser has the page cached, it doesn't ever get as far as the server. Try doing F5 and if that fails, Ctrl-F5. Should fix it.

  • cardinale
    Avatar
    Community Member
    23 Posts

    Re: db/build?flush=1 Link to this post

    It doesn't work, I did everything

  • jam13
    Avatar
    121 Posts

    Re: db/build?flush=1 Link to this post

    A few things to check:

    1) Are the class name and controller name are correct - it's common to copy another class and forget to change the name.

    2) Always put the class braces on the same line as the class definition, otherwise manifestbuilder will ignore it (I think this has been fixed in 2.3).

    3) Are you sure it hasn't worked? If your new page type has no extra fields or relationships, then the only part of the database that will change is the ClassName field in the SiteTree tables.

  • JGC
    Avatar
    Community Member
    25 Posts

    Re: db/build?flush=1 Link to this post

    Just expanding a little on jam's last point; if it shows some stuff in blue text at the top of the db/build?flush=1 page and mentions an enum and some page types (Page, Redirector Page, etc) then it IS affecting it, but it's the lack of new fields causing it to look almost the same as if it wasn't changing.

    Alternatively, try swapping this into your $db line and see if it outputs anything in green to signify new fields being added:

    static $db = array(
    'UniqueName' => 'Text',
    'DeleteMe' => 'Date'
    );

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