0

I created a plaintext field called 'researchYear' that was add to a section called 'research'.

I added a record to the section.

I went back to the field, renamed it to 'researchDate' and made it a date field.

Craft crashed immediately after. The website no longer worked. The CP no longer worked. The error below was displayed for the CP and website. completely.

Trying to search the database to delete the entry I had originally added to the 'research' section.

This message appears everywhere:

Database Exception – yii\db\Exception
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'content.field_researchYear' in 'field list'
The SQL being executed was: SELECT `users`.`password`, `elements`.`id`, `elements`.`fieldLayoutId`, `elements`.`uid`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_sites`.`slug`, `elements_sites`.`siteId`, `elements_sites`.`uri`, `elements_sites`.`enabled` AS `enabledForSite`, `users`.`username`, `users`.`firstName`, `users`.`lastName`, `users`.`email`, `users`.`admin`, `users`.`locked`, `users`.`pending`, `users`.`suspended`, `users`.`lastLoginDate`, `users`.`lockoutDate`, `users`.`photoId`, `users`.`hasDashboard`, `content`.`id` AS `contentId`, `content`.`field_researchAbstract`, `content`.`field_researchAuthors`, `content`.`field_researchBeverageCategories`, `content`.`field_researchCropCategories`, `content`.`field_footerDisclaimer`, `content`.`field_pageDisplayMenu`, `content`.`field_footerEmail`, `content`.`field_footerFacebookUrl`, `content`.`field_footerInstagramUrl`, `content`.`field_researchKeywords`, `content`.`field_footerMdardUrl`, `content`.`field_headMetaDescription`, `content`.`field_headMissionStatement`, `content`.`field_pageLayout`, `content`.`field_footerPhone`, `content`.`field_researchPriorities`, `content`.`field_footerPrivacyUrl`, `content`.`field_headTitle`, `content`.`field_footerSitemapUrl`, `content`.`field_researchTitle`, `content`.`field_footerTwitterUrl`, `content`.`field_researchVideo`, `content`.`field_researchYear`
FROM (SELECT `elements`.`id` AS `elementsId`, `elements_sites`.`id` AS `elementsSitesId`, `content`.`id` AS `contentId`
FROM `elements` `elements`
INNER JOIN `users` `users` ON `users`.`id` = `elements`.`id`
INNER JOIN `elements_sites` `elements_sites` ON `elements_sites`.`elementId` = `elements`.`id`
INNER JOIN `content` `content` ON (`content`.`elementId` = `elements`.`id`) AND (`content`.`siteId` = `elements_sites`.`siteId`)
WHERE (`elements_sites`.`siteId`='1') AND (`elements`.`id`='1') AND (`elements`.`archived`=FALSE) AND (`elements`.`dateDeleted` IS NULL) AND (`elements`.`draftId` IS NULL) AND (`elements`.`revisionId` IS NULL)
ORDER BY `users`.`username`
LIMIT 1) `subquery`
INNER JOIN `users` `users` ON `users`.`id` = `subquery`.`elementsId`
INNER JOIN `elements` `elements` ON `elements`.`id` = `subquery`.`elementsId`
INNER JOIN `elements_sites` `elements_sites` ON `elements_sites`.`id` = `subquery`.`elementsSitesId`
INNER JOIN `content` `content` ON `content`.`id` = `subquery`.`contentId`
ORDER BY `users`.`username`
Error Info: Array
(
    [0] => 42S22
    [1] => 1054
    [2] => Unknown column 'content.field_researchYear' in 'field list'
)
↵
Caused by: PDOException
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'content.field_researchYear' in 'field list'
in /home/michigancraftbeverages/vendor/yiisoft/yii2/db/Command.php at line 1290
  • I had also renamed 'researchYear' to 'researchDate'. To fix this, I went to the database and renamed 'researchDate' back to 'researchYear' (this query must get cached somewhere even though I renamed the field?). Craft worked again. To be safe, I deleted the 'researchYear' field while inside the Craft CP. Then created the new field that I wanted. – BrianMc Aug 22 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.