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.

Archive /

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

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

db/build?flush=1


Reply


5 Posts   4465 Views

Avatar
cardinale

Community Member, 23 Posts

10 December 2008 at 5:54am

Edited: 10/12/2008 5:56am

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?

Avatar
JGC

Community Member, 25 Posts

10 December 2008 at 6:46am

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.

Avatar
cardinale

Community Member, 23 Posts

10 December 2008 at 9:22am

It doesn't work, I did everything :-(

Avatar
jam13

121 Posts

10 December 2008 at 9:31am

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.

Avatar
JGC

Community Member, 25 Posts

10 December 2008 at 11:55am

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'
);