Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x]: craft utils/prune-provisional-drafts: Unknown column 'sourceId' #11548

Closed
d--j opened this issue Jul 5, 2022 · 1 comment
Closed

[4.x]: craft utils/prune-provisional-drafts: Unknown column 'sourceId' #11548

d--j opened this issue Jul 5, 2022 · 1 comment

Comments

@d--j
Copy link
Contributor

d--j commented Jul 5, 2022

What happened?

Description

Looks like the utils/prune-provisional-drafts console command uses the old column name sourceId instead of the new name canonicalId.

Steps to reproduce

  1. Execute craft utils/prune-provisional-drafts in a terminal

Expected behavior

provisional drafts get pruned

Actual behavior

The following exception gets thrown:

Finding elements with multiple provisional drafts per user ... Exception 'yii\db\Exception' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sourceId' in 'field list'
The SQL being executed was: SELECT `s`.`sourceId` AS `id`, `s`.`creatorId`, `s`.`count`, (SELECT `type`
FROM `elements`
WHERE `id` = `s`.`sourceId`) AS `type`
FROM (SELECT `sourceId`, `creatorId`, COUNT(*) AS `count`
FROM `drafts`
WHERE `provisional`=TRUE
GROUP BY `sourceId`, `creatorId`
HAVING COUNT(*) > 1) `s`'

in /app/app/vendor/yiisoft/yii2/db/Schema.php:676

Error Info:
Array
(
    [0] => 42S22
    [1] => 1054
    [2] => Unknown column 'sourceId' in 'field list'
)

Caused by: Exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sourceId' in 'field list''

in /app/app/vendor/yiisoft/yii2/db/Command.php:1302

Stack trace:
#0 /app/app/vendor/yiisoft/yii2/db/Command.php(1302): PDOStatement->execute()
#1 /app/app/vendor/yiisoft/yii2/db/Command.php(1168): yii\db\Command->internalExecute('SELECT `s`.`sou...')
#2 /app/app/vendor/yiisoft/yii2/db/Command.php(410): yii\db\Command->queryInternal('fetchAll', NULL)
#3 /app/app/vendor/yiisoft/yii2/db/Query.php(249): yii\db\Command->queryAll()
#4 /app/app/vendor/craftcms/cms/src/db/Query.php(153): yii\db\Query->all(NULL)
#5 /app/app/vendor/craftcms/cms/src/console/controllers/utils/PruneProvisionalDraftsController.php(68): craft\db\Query->all()
#6 [internal function]: craft\console\controllers\utils\PruneProvisionalDraftsController->actionIndex()
#7 /app/app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#8 /app/app/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#9 /app/app/vendor/yiisoft/yii2/console/Controller.php(182): yii\base\Controller->runAction('', Array)
#10 /app/app/vendor/craftcms/cms/src/console/Controller.php(224): yii\console\Controller->runAction('', Array)
#11 /app/app/vendor/yiisoft/yii2/base/Module.php(552): craft\console\Controller->runAction('', Array)
#12 /app/app/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('utils/prune-pro...', Array)
#13 /app/app/vendor/craftcms/cms/src/console/Application.php(90): yii\console\Application->runAction('utils/prune-pro...', Array)
#14 /app/app/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('utils/prune-pro...', Array)
#15 /app/app/vendor/craftcms/cms/src/console/Application.php(121): yii\console\Application->handleRequest(Object(craft\console\Request))
#16 /app/app/vendor/yiisoft/yii2/base/Application.php(384): craft\console\Application->handleRequest(Object(craft\console\Request))
#17 /app/app/craft(13): yii\base\Application->run()
#18 {main}

Craft CMS version

4.1.0.2

PHP version

8.0.13

Operating system and version

Linux 5.10.104-linuxkit

Database type and version

MySQL 8.0.29

Image driver and version

Imagick @PACKAGE_VERSION@ (ImageMagick 7.0.11-14)

Installed plugins and versions

  • KeyChain 4.0.0
  • Minify 4.0.0-beta.2
  • Navigation 2.0.3
  • SAML Service Provider 4.0.0
  • SEOmatic 4.0.6
  • Typed link field 2.1.3-rc
@brandonkelly
Copy link
Member

Thanks for reporting that! Craft 4.1.1 is out now with a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants