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

[Craft 3] One of retours migrations failed #296

Closed
alexr8 opened this issue Mar 16, 2024 · 4 comments
Closed

[Craft 3] One of retours migrations failed #296

alexr8 opened this issue Mar 16, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@alexr8
Copy link

alexr8 commented Mar 16, 2024

Describe the bug

I'm updating an old site to latest craft 3 with a view to updating to craft 4 eventually. I ended up nuking my vendor folder/composer.lock due to a problem with another plugin when running composer update, and instead ran composer install which appeared to go ok, but one of the retour migrations fails when i hit 'finish up' in my admin.

Versions

  • Plugin version: 3.1.40 -> 3.2.13
  • Craft version: 3.4.27 -> 3.5.19.1

`ArgumentCountError: Too few arguments to function craft\db\Connection::getIndexName(), 0 passed in /var/www/html/vendor/nystudio107/craft-retour/src/migrations/m230627_141440_add_redirectMatchType_index.php on line 38 and at least 2 expected

Migration: nystudio107\retour\migrations\m230627_141440_add_redirectMatchType_index

Output:

Exception: Too few arguments to function craft\db\Connection::getIndexName(), 0 passed in /var/www/html/vendor/nystudio107/craft-retour/src/migrations/m230627_141440_add_redirectMatchType_index.php on line 38 and at least 2 expected (/var/www/html/vendor/craftcms/cms/src/db/Connection.php:450)
#0 /var/www/html/vendor/nystudio107/craft-retour/src/migrations/m230627_141440_add_redirectMatchType_index.php(38): craft\db\Connection->getIndexName()
#1 /var/www/html/vendor/nystudio107/craft-retour/src/migrations/m230627_141440_add_redirectMatchType_index.php(17): nystudio107\retour\migrations\m230627_141440_add_redirectMatchType_index->createIndexes()
#2 /var/www/html/vendor/craftcms/cms/src/db/Migration.php(52): nystudio107\retour\migrations\m230627_141440_add_redirectMatchType_index->safeUp()
#3 /var/www/html/vendor/craftcms/cms/src/db/MigrationManager.php(232): craft\db\Migration->up(true)
#4 /var/www/html/vendor/craftcms/cms/src/db/MigrationManager.php(148): craft\db\MigrationManager->migrateUp(Object(nystudio107\retour\migrations\m230627_141440_add_redirectMatchType_index))
#5 /var/www/html/vendor/craftcms/cms/src/services/Updates.php(257): craft\db\MigrationManager->up()
#6 /var/www/html/vendor/craftcms/cms/src/controllers/BaseUpdaterController.php(509): craft\services\Updates->runMigrations(Array)
#7 /var/www/html/vendor/craftcms/cms/src/controllers/UpdaterController.php(203): craft\controllers\BaseUpdaterController->runMigrations(Array, 'restore-db')
#8 [internal function]: craft\controllers\UpdaterController->actionMigrate()
#9 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#10 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction->runWithParams(Array)
#11 /var/www/html/vendor/craftcms/cms/src/web/Controller.php(190): yii\base\Controller->runAction('migrate', Array)
#12 /var/www/html/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('migrate', Array)
#13 /var/www/html/vendor/craftcms/cms/src/web/Application.php(274): yii\base\Module->runAction('updater/migrate', Array)
#14 /var/www/html/vendor/craftcms/cms/src/web/Application.php(665): craft\web\Application->runAction('updater/migrate')
#15 /var/www/html/vendor/craftcms/cms/src/web/Application.php(212): craft\web\Application->_processUpdateLogic(Object(craft\web\Request))
#16 /var/www/html/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#17 /var/www/html/public/index.php(24): yii\base\Application->run()
#18 {main}`

I've gone back to square one with earlier copy of my database, original copy of composer.json, nuked vendor/composer.lock, composer install etc. and keep hitting this point. anything i can do to tackle it?

@alexr8 alexr8 added the bug Something isn't working label Mar 16, 2024
@khalwat
Copy link
Contributor

khalwat commented Mar 19, 2024

Something doesn't sound right -- that Craft method doesn't take any arguments:

    /**
     * Generates an index name.
     *
     * @return string
     */
    public function getIndexName(): string
    {
        return $this->_objectName('idx');
    }

https://github.com/craftcms/cms/blob/v3/src/db/Connection.php#L450

So I'm guessing you're not actually running the latest version of Craft 3 at this point. That or maybe OPcache is involved somehow, and it's running old code that's no longer there?

Looking at the commit history of that file, the method signature hasn't been changed anywhere in the 3.x branch that I can see?

https://github.com/craftcms/cms/commits/v3/src/db/Connection.php

@khalwat khalwat closed this as completed Mar 19, 2024
@alexr8
Copy link
Author

alexr8 commented Mar 19, 2024

Yeah it was during an upgrade from an early version of craft 3 (3.4.27), updating all packages. I ended up locking the version of retour to 3.1.40 and updating everything else just to get updated and on the latest 3.x version. I've yet to try just updating retour but hopefully it'll go through ok with everything else being the latest now.

@khalwat
Copy link
Contributor

khalwat commented Mar 19, 2024

Let me know if you run into any issues!

@alexr8
Copy link
Author

alexr8 commented Mar 19, 2024

Will do - I appreciate this is a bit of a niche error and on a very old version of the plugin too so thanks for taking the time to investigate earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants