Open bob-pixeldeluxe opened 3 years ago
Now i found the following line in the logs: yii\db\Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'drafts.saved' in 'where clause'
There should be a stack trace that follows this error. Can you please post it?
Also, please run this SQL query. Does it return a result?
SELECT * FROM `migrations` WHERE `name` = 'm210214_202731_track_saved_drafts'
Hi Brandon,
Thanks for taking a look!
The sql query returns the following:
#1146 - Table 'cbe_live.migrations' doesn't exist
There is no table called migrations or anything like that at this moment.
The stack trace:
2021-04-12 11:46:11 [-][1341][-][error][yii\db\Exception] PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'drafts.saved' in 'where clause' in /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/yiisoft/yii2/db/Command.php:1299
Stack trace:
#0 /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/yiisoft/yii2/db/Command.php(1299): PDOStatement->execute()
#1 /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/yiisoft/yii2/db/Command.php(1165): yii\db\Command->internalExecute()
#2 /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/yiisoft/yii2/db/Command.php(407): yii\db\Command->queryInternal()
#3 /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/yiisoft/yii2/db/Query.php(249): yii\db\Command->queryAll()
#4 /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/craftcms/cms/src/db/Query.php(152): yii\db\Query->all()
#5 /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1547): craft\db\Query->all()
#6 /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/craftcms/cms/src/base/Element.php(737): craft\elements\db\ElementQuery->all()
#7 /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/craftcms/cms/src/controllers/ElementIndexesController.php(520): craft\base\Element::indexHtml()
#8 /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/craftcms/cms/src/controllers/ElementIndexesController.php(135): craft\controllers\ElementIndexesController->elementResponseData()
#9 [internal function]: craft\controllers\ElementIndexesController->actionGetElements()
#10 /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#11 /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams()
#12 /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/craftcms/cms/src/web/Controller.php(190): yii\base\Controller->runAction()
#13 /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/yiisoft/yii2/base/Module.php(534): craft\web\Controller->runAction()
#14 /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/craftcms/cms/src/web/Application.php(274): yii\base\Module->runAction()
#15 /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/craftcms/cms/src/web/Application.php(577): craft\web\Application->runAction()
#16 /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/craftcms/cms/src/web/Application.php(253): craft\web\Application->_processActionRequest()
#17 /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/yiisoft/yii2/base/Application.php(392): craft\web\Application->handleRequest()
#18 /var/www/vhosts/cbelanguages.nl/httpdocs/public_html/index.php(21): yii\base\Application->run()
#19 {main}
Next yii\db\Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'drafts.saved' in 'where clause'
The SQL being executed was: SELECT `elements`.`id`, `elements`.`fieldLayoutId`, `elements`.`uid`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_sites`.`id` AS `siteSettingsId`, `elements_sites`.`slug`, `elements_sites`.`siteId`, `elements_sites`.`uri`, `elements_sites`.`enabled` AS `enabledForSite`, `entries`.`sectionId`, `entries`.`typeId`, `entries`.`authorId`, `entries`.`postDate`, `entries`.`expiryDate`, `content`.`id` AS `contentId`, `content`.`title`, `content`.`field_hostOptions`, `content`.`field_afterLeveltestText`, `content`.`field_appointmentThroughGoogleForm`, `content`.`field_body`, `content`.`field_courseLanguage`, `content`.`field_description`, `content`.`field_endDate`, `content`.`field_endDateTime`, `content`.`field_endTime`, `content`.`field_facebook`, `content`.`field_format`, `content`.`field_helpMeChoose`, `content`.`field_howDidYouFindUs`, `content`.`field_instagram`, `content`.`field_interestedInLearning`, `content`.`field_introduction`, `content`.`field_levelDifficulty`, `content`.`field_levelTestScore`, `content`.`field_leveltestText`, `content`.`field_caption`, `content`.`field_orderButtonText`, `content`.`field_phone`, `content`.`field_privateCourseLink`, `content`.`field_productOrder`, `content`.`field_publicRegistration`, `content`.`field_rating`, `content`.`field_seo`, `content`.`field_seoNew`, `content`.`field_startDate`, `content`.`field_startDateTime`, `content`.`field_startTime`, `content`.`field_table`, `content`.`field_testResultDutch`, `content`.`field_testResultEnglish`, `content`.`field_twitter`, `content`.`field_canBuyCourses`, `content`.`field_video`, `content`.`field_payingForCourse`, `content`.`field_zohoId`, `structureelements`.`root`, `structureelements`.`lft`, `structureelements`.`rgt`, `structureelements`.`level`, `elements`.`draftId`, `drafts`.`sourceId` AS `draftSourceId`, `drafts`.`creatorId` AS `draftCreatorId`, `drafts`.`name` AS `draftName`, `drafts`.`notes` AS `draftNotes`, `drafts`.`trackChanges` AS `draftTrackChanges`, `drafts`.`dateLastMerged` AS `draftDateLastMerged`
FROM (SELECT `elements`.`id` AS `elementsId`, `elements_sites`.`id` AS `elementsSitesId`, `content`.`id` AS `contentId`
FROM `craft_elements` `elements`
INNER JOIN `craft_entries` `entries` ON `entries`.`id` = `elements`.`id`
INNER JOIN `craft_elements_sites` `elements_sites` ON `elements_sites`.`elementId` = `elements`.`id`
INNER JOIN `craft_content` `content` ON (`content`.`elementId` = `elements`.`id`) AND (`content`.`siteId` = `elements_sites`.`siteId`)
INNER JOIN `craft_structureelements` `structureelements` ON (`structureelements`.`elementId` = `elements`.`id`) AND (`structureelements`.`structureId`=7)
LEFT JOIN `craft_drafts` `drafts` ON `drafts`.`id` = `elements`.`draftId`
WHERE (`entries`.`sectionId` IN ('4', '3', '9', '12', '1', '17', '16', '10', '8', '13', '18')) AND (`entries`.`sectionId`='9') AND (`elements_sites`.`siteId`=1) AND (`elements`.`archived`=FALSE) AND (`elements`.`dateDeleted` IS NULL) AND (`drafts`.`sourceId` IS NULL) AND ((`elements`.`draftId` IS NULL) OR (NOT (`drafts`.`sourceId` IS NULL)) OR (`drafts`.`saved`=TRUE)) AND (`elements`.`revisionId` IS NULL)
ORDER BY `lft`
LIMIT 100) `subquery`
INNER JOIN `craft_entries` `entries` ON `entries`.`id` = `subquery`.`elementsId`
INNER JOIN `craft_elements` `elements` ON `elements`.`id` = `subquery`.`elementsId`
INNER JOIN `craft_elements_sites` `elements_sites` ON `elements_sites`.`id` = `subquery`.`elementsSitesId`
INNER JOIN `craft_content` `content` ON `content`.`id` = `subquery`.`contentId`
INNER JOIN `craft_structureelements` `structureelements` ON (`structureelements`.`elementId` = `subquery`.`elementsId`) AND (`structureelements`.`structureId`=7)
LEFT JOIN `craft_drafts` `drafts` ON `drafts`.`id` = `elements`.`draftId`
ORDER BY `lft` in /var/www/vhosts/cbelanguages.nl/httpdocs/vendor/yiisoft/yii2/db/Schema.php:678
The sql query returns the following:
#1146 - Table 'cbe_live.migrations' doesn't exist
There is no table called migrations or anything like that at this moment.
Sorry, i forgot you said this started as a Craft 2 site. So you probably have a craft
table prefix. Please run the same query, but with that applied:
SELECT * FROM `craft_migrations` WHERE `name` = 'm210214_202731_track_saved_drafts'
Hi Brandon,
No problem! This query returns: MySQL returned an empty result set (i.e. zero rows). (Query took 0.0011 seconds.) There is no table that includes migrations in the name at this moment.
Hm, so for whatever reason the new migrations didn’t get applied.
Try SSHing into your server and running this commond:
php craft migrate/up --track=craft
Description
So after an update we cannot see the entries normally in the cms. We get an flash error at the top a server error occured. Now i found the following line in the logs: yii\db\Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'drafts.saved' in 'where clause' Also if i change this filter to lets say drafts and then back to live i do get to see the entries till i refresh. Nothing changed serverside except that we updated craft,
Steps to reproduce
Additional info