Open gregorydavidjenkins opened 2 months ago
Hmm, this is a tricky one. Looks like the Matrix field has an Assets field which is relying on sessions. Hyper's migrations are going to re-save a field that a Typed Link field exists in, which for the most part would be fine, but looks like this is one case that re-saving your Matrix field on the console might cause an issue.
Because this is coming from Craft native fields themselves, I'm not sure I can do much about it.
How about running the migrations through the UI in Settings > Hyper? Considering this is only migrating the field settings (not the content) this only needs to be done once in a dev environment.
That seems to do the trick! Thanks.
I didn't know about the UI counterpart to the console commands. I knew that there were purpose-built migrations but the convenient utility in the CP is great.
I'd suggest adding a tab to the docs that simply explains where to find them (and the two step process, etc.)
I see it in the v1 docs now, I think I was referencing v2 docs.
Describe the bug
When running hyper/migrate/typed-link-field I get the following stack trace.
`Preparing to migrate field “callToAction” (e1c5b53d-39c1-4bcd-b22b-7050c7e05741). Exception: Session does not exist in a console request. (/var/www/vendor/craftcms/cms/src/console/Application.php:144)
0 /var/www/vendor/craftcms/cms/src/fields/Assets.php(710): craft\console\Application->getSession()
1 /var/www/vendor/craftcms/cms/src/fields/Assets.php(268): craft\fields\Assets->getInputSources()
2 /var/www/vendor/yiisoft/yii2/validators/InlineValidator.php(77): craft\fields\Assets->validateNotTempVolume('sources', NULL, Object(yii\validators\InlineValidator), Array)
3 /var/www/vendor/yiisoft/yii2/validators/Validator.php(260): yii\validators\InlineValidator->validateAttribute(Object(craft\fields\Assets), 'sources')
4 /var/www/vendor/yiisoft/yii2/base/Model.php(368): yii\validators\Validator->validateAttributes(Object(craft\fields\Assets), Array)
5 /var/www/vendor/craftcms/cms/src/services/Matrix.php(171): yii\base\Model->validate()
6 /var/www/vendor/craftcms/cms/src/services/Matrix.php(494): craft\services\Matrix->validateBlockType(Object(craft\models\MatrixBlockType))
7 /var/www/vendor/craftcms/cms/src/fields/Matrix.php(374): craft\services\Matrix->validateFieldSettings(Object(craft\fields\Matrix))
8 /var/www/vendor/craftcms/cms/src/services/Fields.php(837): craft\fields\Matrix->validate()
9 /var/www/vendor/verbb/hyper/src/migrations/MigrateTypedLinkField.php(153): craft\services\Fields->saveField(Object(craft\fields\Matrix))
10 /var/www/vendor/verbb/hyper/src/migrations/PluginFieldMigration.php(46): verbb\hyper\migrations\MigrateTypedLinkField->processFieldSettings()
11 /var/www/vendor/craftcms/cms/src/db/Migration.php(50): verbb\hyper\migrations\PluginFieldMigration->safeUp()
12 /var/www/vendor/verbb/hyper/src/console/controllers/MigrateController.php(110): craft\db\Migration->up()
13 /var/www/vendor/verbb/hyper/src/console/controllers/MigrateController.php(65): verbb\hyper\console\controllers\MigrateController->_migrate('verbb\hyper\mig...')
14 [internal function]: verbb\hyper\console\controllers\MigrateController->actionTypedLinkField()
15 /var/www/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
16 /var/www/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
17 /var/www/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction('typed-link-fiel...', Array)
18 /var/www/vendor/yiisoft/yii2/base/Module.php(552): yii\console\Controller->runAction('typed-link-fiel...', Array)
19 /var/www/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('hyper/migrate/t...', Array)
20 /var/www/vendor/craftcms/cms/src/console/Application.php(91): yii\console\Application->runAction('hyper/migrate/t...', Array)
21 /var/www/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('hyper/migrate/t...', Array)
22 /var/www/vendor/craftcms/cms/src/console/Application.php(122): yii\console\Application->handleRequest(Object(craft\console\Request))
23 /var/www/vendor/yiisoft/yii2/base/Application.php(384): craft\console\Application->handleRequest(Object(craft\console\Request))
24 /var/www/craft(13): yii\base\Application->run()
25 {main}`
Steps to reproduce
Run hyper/migrate/typed-link-field
Craft CMS version
4.11.3
Plugin version
1.2.1
Multi-site?
Yes
Additional context
No response