dev/build is not updating database after upgrade to SS 4.

Silverstripe Version:

I’ve finally decided to take the plunge and upgrade to SS 4. I can’t say that it’s been a smooth experience at all, and it has been rather frustrating to put it politely. I’ve gotten to the point where I think I’ve made the minimum changes necessary to get the site upgraded and running, but whenever I navigate to the website I get this error:

[Emergency] Uncaught SilverStripe\ORM\Connect\DatabaseException: Couldn’t run query: SELECT DISTINCT “SiteTree_Live”.“ClassName”, “SiteTree_Live”.“LastEdited”, “SiteTree_Live”.“Created”, “SiteTree_Live”.“URLSegment”, “SiteTree_Live”.“Title”, “SiteTree_Live”.“MenuTitle”, “SiteTree_Live”.“Content”, “SiteTree_Live”.“MetaDescription”, “SiteTree_Live”.“ExtraMeta”, “SiteTree_Live”.“ShowInMenus”, “SiteTree_Live”.“ShowInSearch”, “SiteTree_Live”.“Sort”, “SiteTree_Live”.“HasBrokenFile”, “SiteTree_Live”.“HasBrokenLink”, “SiteTree_Live”.“ReportClass”, “SiteTree_Live”.“Version”, “SiteTree_Live”.“CanViewType”, “SiteTree_Live”.“CanEditType”, “SiteTree_Live”.“ProvideComments”, “SiteTree_Live”.“ModerationRequired”, “SiteTree_Live”.“CommentsRequireLogin”, “SiteTree_Live”.“ParentID”, “SiteTree_Live”.“SubsiteID”, “SiteTree_Live”.“ID”, CASE WHEN “SiteTree_Live”.“ClassName” IS NOT NULL THEN “SiteTree_Live”.“ClassName” ELSE ‘SilverStripe\CMS\Model\SiteTree’ END AS “RecordClassName” FROM “SiteTree_Live” WHERE (“SiteTree_Live”.“URLSegment” = ?) AND (“SiteTree_Live”.“ParentID” = ?) AND (“SiteTree_Live”.“SubsiteID” IN (0)) ORDER BY “SiteTree_Live”.“Sort” ASC LIMIT 1 42S22-1054: Unknown column ‘SiteTree_Live.ProvideComments’ in 'field list’

Running dev/build has been an exercise in futility:

[vagrant@localhost]$ ./vendor/bin/sake dev/build | grep ProvideComments
  + Field SiteTree.ProvideComments: created as tinyint(1) unsigned not null default '0'
  + Field SiteTree_Live.ProvideComments: created as tinyint(1) unsigned not null default '0'
  + Field SiteTree_Versions.ProvideComments: created as tinyint(1) unsigned not null default '0'

It indicates that it has created the column each and every time I run it, but it is not actually doing anything. When I go to verify that the column exists in the database afterwards, it has not in fact created the column. When I tail the Silverstripe and Apache logs during dev/build nothing shows up to indicate what is going wrong. There are also quite a few other updates in addition to the SiteTree_Live.ProvideComments column that aren’t getting committed to the database, which indicates to me that dev/build is failing for some unknown reason.

I’m about to lose all hope of ever upgrading to SS 4 at this point and was wondering if there is possibly something that I am missing, or if there is anything I can do to troubleshoot dev/build to find out where it is failing?

As usual, I figured it out myself. Perhaps some other misfortunate developers tasked with engaging in this brutal upgrade process to SS 4 will find this illuminating.

  1. ) I had to convert all of my form validations to use Silverware instead of ZenValidator, which has yet to support SS 4 and doesn’t seem likely to at all. After that conversion I finally got meaningful error messages from dev/build.

2.) Please update the upgrade process documentation. I discovered that indexes are declared differently in the Model classes for SS 4, which was what was actually preventing the DB updates from happening in my case. There is a pretty opaque reference deep in the changelog for 4.0.0, but it’s not obvious what has changed from SS 3 without looking at the developer documentation.

1 Like

At the bottom of the documentation page, you’ll see a button titled, “Edit this page”. If you click that, you can make documentation change suggestions directly.

1 Like

A post was split to a new topic: Dev/build problem after upgrade