Closed bossanova808 closed 1 year ago
If I run this query, the errors stop:
UPDATE craft_fieldlayouttabs
SET
elements = REPLACE(elements,
'craft\\\\fieldlayoutelements\\\\EntryTitleField',
'craft\\\\fieldlayoutelements\\\\entries\\\\EntryTitleField');
Hi, thanks for reaching out. I can only reproduce this behaviour under the following conditions:
composer.json
, run composer update
, run php craft migrate/all
)fieldlayouttabs
table - all is updated as expectedcomposer.json
, run composer update
)fieldlayouttabs
table - the settings
column is NULL
and elements
still refers to the “old” namespace for the EntryTitleField
If, after step 7, I was to rebuild my project config based on what’s in the database (Utilities > Project Config > Rebuild the Config), the second update would have correctly updated the fieldlayouttabs
.
In other words, you will encounter this issue if the project config files are already updated to Craft 4, but the database is for Craft 3.
Hope this helps!
Well, sort of helps I suppose. But I find it a bit confusing.
So - if I am working on a big, complex Craft 3 -> Craft 4 upgrade, I need to regularly do test migrations of the latest production DB along the way.
(In the meantime, I am checking in PC etc as normal in the Craft 4 branch, and I never downgrade to Craft 3 in composer).
Of course, when I do those test migrations, I import my Craft 3 DB in my Craft 4 environment. After I have re-run the migration (i.e. both the Craft and Commerce upgrades) - on this 'fresh' DB from production, I rebuild the PC.
I thought this is what I am supposed to do - but it seems I am making a mistake? Am I supposed to nuke the PC before the upgrade or something?
Help would be appreciated!
This is the process I actually follow:
db
, then re-create empty db
craft3-production*
to \\wsl.localhost\Ubuntu\home\jeremy\ddev-projects\c4-dev\dbdump
cd4; ./dbdump/ddev-import-dbs.sh
- this imports latest Craft 3 DB in DDEV - (10 mins)ddev composer update
(1 min)ddev craft up
(5 minsddev craft db/convert-charset
(2 mins)ddev craft commerce/upgrade
- accept all the default field-names for the new custom fields (addressAttention
etc) - takes ~ 1 hour if devMode is off, over 2 hours if inddev craft project-config/rebuild
Right, that’s a simpler and more “real” scenario, but the same thing will happen as your DB and project config are out of sync after the import. If you import your Craft 3 DB to your Craft 4 environment, you should also copy the Craft 3 config/project directory that matches that Craft 3 DB to the Craft 4 environment too.
Right, I thought it was enough to just re-build it at the end from the migrated DB.
Thanks so much, I will try that in full tomorrow (hopefully my last test migration before I do the actual upgrade on Sunday, all going to plan).
Not a problem at all :)
Came here to say the same thing :)
All migrations that make project config changes will start by making sure that the “incoming” project config YAML hasn’t already had the same migration applied. Otherwise the additional set of changes would end up overwriting the incoming changes. (Explained in more detail here.)
The migration that renames EntryTitleField
is no exception:
So if you ever need to re-run an update on dev, it’s best to discard your config/project/
folder as a starting point, so migrations don’t see that the YAML files have newer schema versions, indicating that the project config data shouldn’t be touched.
What happened?
Description
Following my latest test migration from C3 to C4 (latest of both), I am seeing 34 of these for each page load:
The
fieldlayouttabs
table seems to have data missing the full namespace:If I re-save field layouts that have a
Title
field, then the number of errors per page drops for each one I save. I presume that means thefieldlayouttabs
table is being updated. But obviously I'd prefer not to have to manually save 34 field layouts with every migration!(conversation here: https://discord.com/channels/456442477667418113/456442477667418115/1115873349281779742)
Craft CMS version
4.4.13
PHP version
8.2
Operating system and version
DDEV
Database type and version
MySQL 8
Image driver and version
ImageMagick
Installed plugins and versions