Upgrade from 3.4.1 to 4.9

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

Silverstripe Version: 4.9

Question:

I have recently upgraded a legacy site from 3.4.1 to 4.9 with the upgrade-code and am unable to run dev/build to upgrade the database.

I used the upgrade-code all command to do the upgrade.

# [Emergency] Uncaught SilverStripe\ORM\Connect\DatabaseException: Couldn't run query: SELECT DISTINCT "SiteTree_Versions"."ClassName", "SiteTree_Versions"."LastEdited", "SiteTree_Versions"."Created", "SiteTree_Versions"."ProvideComments", "SiteTree_Versions"."ModerationRequired", "SiteTree_Versions"."CommentsRequireLogin", "SiteTree_Versions"."CanViewType", "SiteTree_Versions"."CanEditType", "SiteTree_Versions"."Version", "SiteTree_Versions"."URLSegment", "SiteTree_Versions"."Title", "SiteTree_Versions"."MenuTitle", "SiteTree_Versions"."Content", "SiteTree_Versions"."MetaDescription", "SiteTree_Versions"."ExtraMeta", "SiteTree_Versions"."ShowInMenus", "SiteTree_Versions"."ShowInSearch", "SiteTree_Versions"."Sort", "SiteTree_Versions"."HasBrokenFile", "SiteTree_Versions"."HasBrokenLink", "SiteTree_Versions"."ReportClass", "SiteTree_Versions"."ParentID", "SiteTree_Versions"."RecordID" AS "ID", CASE WHEN "SiteTree_Versions"."ClassName" IS NOT NULL THEN "SiteTree_Versions"."ClassName" ELSE 'SilverStripe\\CMS\\Model\\SiteTree' END AS "RecordClassName", "SiteTree_Versions"."RecordID", "SiteTree_Versions"."WasPublished", "SiteTree_Versions"."WasDeleted", "SiteTree_Versions"."WasDraft", "SiteTree_Versions"."AuthorID", "SiteTree_Versions"."PublisherID" FROM "SiteTree_Versions" WHERE ("SiteTree_Versions"."URLSegment" = ?) AND ("SiteTree_Versions"."ParentID" = ?) AND ("WasPublished" = ?) ORDER BY "SiteTree_Versions"."LastEdited" DESC, "SiteTree_Versions"."Version" ASC LIMIT 1 Unknown column 'SiteTree_Versions.WasDeleted' in 'field list'

### GET /public/index.php