nystudio107 / craft-retour

Retour allows you to intelligently redirect legacy URLs, so that you don't lose SEO value when rebuilding & restructuring a website
https://nystudio107.com/plugins/retour
Other
39 stars 26 forks source link

Unknown column 'priority' in 'order clause' #262

Closed siffring closed 1 year ago

siffring commented 1 year ago

Describe the bug

I get this 500 error on any URL that returns a 404 after installing Retour 4.1.7 on Craft 4.3.3.

Uncaught PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'priority' in 'order clause' in /var/www/html/vendor/yiisoft/yii2/db/Command.php:1302
Stack trace:
#0 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1302): PDOStatement->execute()
#1 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1168): yii\db\Command->internalExecute('SELECT *\nFROM `...')
#2 /var/www/html/vendor/yiisoft/yii2/db/Command.php(410): yii\db\Command->queryInternal('fetchAll', NULL)
#3 /var/www/html/vendor/yiisoft/yii2/db/Query.php(249): yii\db\Command->queryAll()
#4 /var/www/html/vendor/craftcms/cms/src/db/Query.php(248): yii\db\Query->all(NULL)
#5 /var/www/html/vendor/nystudio107/craft-retour/src/services/Redirects.php(528): craft\db\Query->all()
#6 /var/www/html/vendor/nystudio107/craft-retour/src/services/Redirects.php(485): nystudio107\retour\services\Redirects->getRedirectsByMatchType(NULL, 1, 'regexmatch', true)
#7 /var/www/html/vendor/nystudio107/craft-retour/src/services/Redirects.php(332): nystudio107\retour\services\Redirects->getAllRegExRedirects(NULL, 1, true)
#8 /var/www/html/vendor/nystudio107/craft-retour/src/services/Redirects.php(232): nystudio107\retour\services\Redirects->findRedirectMatch('https://citco.d...', '/dldl')
#9 /var/www/html/vendor/nystudio107/craft-retour/src/Retour.php(484): nystudio107\retour\services\Redirects->handle404()
#10 [internal function]: nystudio107\retour\Retour::nystudio107\retour\{closure}(Object(craft\events\ExceptionEvent))
#11 /var/www/html/vendor/yiisoft/yii2/base/Event.php(312): call_user_func(Object(Closure), Object(craft\events\ExceptionEvent))
#12 /var/www/html/vendor/yiisoft/yii2/base/Component.php(642): yii\base\Event::trigger('craft\\web\\Error...', 'beforeHandleExc...', Object(craft\events\ExceptionEvent))
#13 /var/www/html/vendor/craftcms/cms/src/web/ErrorHandler.php(49): yii\base\Component->trigger('beforeHandleExc...', Object(craft\events\ExceptionEvent))
#14 [internal function]: craft\web\ErrorHandler->handleException(Object(yii\web\NotFoundHttpException))
#15 {main}

To reproduce

Steps to reproduce the behaviour:

  1. Install Retour 4.1.7 ddev craft plugin/install retour
  2. Go to any URL that returns a 404 error
  3. See error message above

Expected behaviour

See a 404 error and have it logged in Retour.

Screenshots

If applicable, add screenshots to help explain your problem.

Here are the migrations that run on install.

CleanShot 2022-12-06 at 19 38 40@2x

Versions

accarpenter commented 1 year ago

Same issue.

khalwat commented 1 year ago

Addressed in: https://github.com/nystudio107/craft-retour/commit/ae42ff4bcee1f0b4cdf37f6c7910659c0ea57f83 & https://github.com/nystudio107/craft-retour/commit/afc35c4575820da2f0b9c24024acaa7aa30ff537

Craft CMS 3:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-retour": "dev-develop as 3.2.6”,

Then do a composer clear-cache && composer update

…..

Craft CMS 4:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-retour": "dev-develop-v4 as 4.1.8”,

Then do a composer clear-cache && composer update

khalwat commented 1 year ago

Released:

Craft 3: Version 3.2.6 -> https://github.com/nystudio107/craft-retour/releases/tag/3.2.6

Craft 4: Version 4.1.8 -> https://github.com/nystudio107/craft-retour/releases/tag/4.1.8

Unfortunately you'll need to uninstall and re-install the plugin

thomEpps commented 1 year ago

Still getting this today using Retour v4.1.8 on Craft v4.3.4. Have uninstalled & removed the old plugin version & started from scratch with the same results

khalwat commented 1 year ago

@thomEpps possibly the install migration is still in the database? I will verify today

thomEpps commented 1 year ago

thanks @khalwat

khalwat commented 1 year ago

@thomEpps confirmed, and I see what the issue is. Apologies, I will have a fix out shortly.

khalwat commented 1 year ago

Released a fix:

Craft 3: Version 3.2.7 -> https://github.com/nystudio107/craft-retour/releases/tag/3.2.7

Craft 4: Version 4.1.9 -> https://github.com/nystudio107/craft-retour/releases/tag/4.1.9

thomEpps commented 1 year ago

cheers @khalwat thats fixed it for me 👍

shifuma commented 1 year ago

I'm still getting this on 4.1.10. I tried to add a redirect and got the error 'Couldn't save redirect settings because it'd create a redirect loop.' Now going to that URL (which wasn't redirected) gives the error.

Edit: Uninstall and Reinstall has fixed it; there was some old data in the database from when I had tried the plugin previously, maybe connected to that.

khalwat commented 1 year ago

Sounds like a migration wasn't run, perhaps @shifuma ?