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 4 upgrade issues with decode #248

Open
rosskenney opened this issue Jan 4, 2023 · 6 comments
Open

Craft 4 upgrade issues with decode #248

rosskenney opened this issue Jan 4, 2023 · 6 comments

Comments

@rosskenney
Copy link

Hi,

I looked through some of the other bug items and I did not see the same issue. For some reason the migration is failing with the following message.

*** applying m190417_202153_migrateDataToTable
    > create table {{%lenz_linkfield}} ... done (time: 0.003s)
    > create unique index craft_idx_exuxitlreqlravmedvrgqekbjetbqvkvqzyn on {{%lenz_linkfield}} (elementId,siteId,fieldId) ... done (time: 0.002s)
    > create index craft_idx_vhxtfrljiosqubmpdgbnwglbylwzuamfupap on {{%lenz_linkfield}} (fieldId) ... done (time: 0.002s)
    > create index craft_idx_gqlgmfjcethtadeisyzrscwltefxwldldrfr on {{%lenz_linkfield}} (siteId) ... done (time: 0.002s)
    > add foreign key craft_fk_pcreterntabybhfdwubgkuukdrxqbexlblui: {{%lenz_linkfield}} (elementId) references {{%elements}} (id) ... done (time: 0.007s)
    > add foreign key craft_fk_lggympzbocjgalrhikmifyvuwejqtawwgrlp: {{%lenz_linkfield}} (fieldId) references {{%fields}} (id) ... done (time: 0.007s)
    > add foreign key craft_fk_swveplxifggnppwgipxrfzkvnjwxrpjpgpmq: {{%lenz_linkfield}} (linkedId) references {{%elements}} (id) ... done (time: 0.008s)
    > add foreign key craft_fk_dluwlytroltnzaqaaiscyppjpexodnjotlmx: {{%lenz_linkfield}} (linkedSiteId) references {{%sites}} (id) ... done (time: 0.007s)
    > update in {{%fields}} ... done (time: 0.001s)
    > update in {{%fields}} ... done (time: 0.000s)
    > update in {{%fields}} ... done (time: 0.000s)
Exception: Syntax error (/var/www/html/vendor/yiisoft/yii2/helpers/BaseJson.php:147)
#0 /var/www/html/vendor/yiisoft/yii2/helpers/BaseJson.php(128): yii\helpers\BaseJson::handleJsonError(4)
#1 /var/www/html/vendor/sebastianlenz/linkfield/src/migrations/m190417_202153_migrateDataToTable.php(143): yii\helpers\BaseJson::decode('https://www1.ny/...')
#2 /var/www/html/vendor/sebastianlenz/linkfield/src/migrations/m190417_202153_migrateDataToTable.php(91): lenz\linkfield\migrations\m190417_202153_migrateDataToTable->updateLinkField(Object(lenz\linkfield\fields\LinkField), '{{%content}}', '')
#3 /var/www/html/vendor/sebastianlenz/linkfield/src/migrations/m190417_202153_migrateDataToTable.php(55): lenz\linkfield\migrations\m190417_202153_migrateDataToTable->updateField(Object(lenz\linkfield\fields\LinkField), '{{%content}}')
#4 /var/www/html/vendor/sebastianlenz/linkfield/src/migrations/m190417_202153_migrateDataToTable.php(31): lenz\linkfield\migrations\m190417_202153_migrateDataToTable->updateAllFields()
#5 /var/www/html/vendor/craftcms/cms/src/db/Migration.php(49): lenz\linkfield\migrations\m190417_202153_migrateDataToTable->safeUp()
#6 /var/www/html/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(758): craft\db\Migration->up()
#7 /var/www/html/vendor/craftcms/cms/src/console/controllers/MigrateController.php(360): yii\console\controllers\BaseMigrateController->migrateUp('m190417_202153_...')
#8 [internal function]: craft\console\controllers\MigrateController->actionAll()
#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(178): yii\base\InlineAction->runWithParams(Array)
#11 /var/www/html/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction('all', Array)
#12 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\console\Controller->runAction('all', Array)
#13 /var/www/html/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('migrate/all', Array)
#14 /var/www/html/vendor/craftcms/cms/src/console/Application.php(90): yii\console\Application->runAction('migrate/all', Array)
#15 /var/www/html/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('migrate/all', Array)
#16 /var/www/html/vendor/craftcms/cms/src/console/Application.php(121): yii\console\Application->handleRequest(Object(craft\console\Request))
#17 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\console\Application->handleRequest(Object(craft\console\Request))
#18 /var/www/html/craft(22): yii\base\Application->run()
#19 {main}
*** failed to apply m190417_202153_migrateDataToTable (time: 0.121s)
@bpurtoncc
Copy link

I am getting this same thing when attempting to upgrade from Craft 3.7 to Craft 4

@xswirelab
Copy link

Same here

@xswirelab
Copy link

@rosskenney @bpurtoncc
I solved it by updating the linkfield first, then run the migrations. Then update the supertable plugin and run its migrations.
After that just continue as usual.

@mateostabio
Copy link

@xswirelab Can you explain with further details please. What did you exactly. I've been on this problem for months.
#230

@xswirelab
Copy link

@mateostabio I noticed that the order of migrations is important.

So I made sure that I ran the update of the linkfield first. Than ran the migrations.

After that I just added(composer require) all other packages, ran migrations and that made sure I was able to update to Craft4 without any errors or data loss.

Tldr;
If you have the supertable plugin and linkfield plugin installed, make sure you update linkfield first before supertable.

@saml0us
Copy link

saml0us commented Dec 4, 2023

Same problem here.

Tried what xswirelab suggested, unfortunately without result.

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

No branches or pull requests

5 participants