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

[5.x]: Entries with Non-Default EntryTypes Lose Content After Migration from CraftCMS 4 to CraftCMS 5 #15150

Closed
Kristomen opened this issue Jun 5, 2024 · 4 comments
Labels

Comments

@Kristomen
Copy link

What happened?

Description

During the migration from CraftCMS 4 to CraftCMS 5, I encountered an issue with transferring entries that use an EntryType other than the default. After migration, these entries have empty titles and fields (except for NEO fields, which transfer correctly).

Steps to reproduce

  • Create an entry in CraftCMS 4 using a custom EntryType (other than the default).
  • Fill in various fields, including the title and other text fields.
  • Migrate to CraftCMS 5 following the official documentation.
  • After the migration is complete, check the entries using the custom EntryType.

Expected behavior

Entries should retain all their data, including titles and the content of all fields, regardless of the EntryType used.

Actual behavior

After migration, entries that use a custom EntryType have empty titles and other fields (except for NEO fields).

delete from {{%content}} ... done (time: 0.027s)
> [1/9] Updating Neo block 20467 ... done
> [2/9] Updating Neo block 20467 ... done
> [3/9] Updating Neo block 20467 ... done
> [4/9] Updating Neo block 20467 ... done
> [5/9] Updating Neo block 20467 ... done
> [6/9] Updating Neo block 20467 ... done
> [7/9] Updating Neo block 20467 ... done
> [8/9] Updating Neo block 20467 ... done
> [9/9] Updating Neo block 20467 ... done
> update in {{%elements}} ... done (time: 0.040s)
> update in {{%changedfields}} ... done (time: 0.008s)
> delete from {{%content}} ... done (time: 0.026s)
*** applied m240403_061537_content_refactor (time: 3.257s)

28 migrations were applied.

Migrated up successfully.

Checking for pending content migrations ...
No new migrations found. Your system is up-to-date.

|||dh grikon@web02-v1041 ~/strony/pl.grikon.cms.dev/public $ php82 craft db/convert-charset
Which character set should be used? [utf8mb4]
Which collation should be used? [utf8mb4_unicode_ci]
Converting addresses ... done
Converting announcements ... done
Converting assetindexdata ... done
Converting assetindexingsessions ... done
Converting assets ... done
Converting assets_sites ... done
Converting authenticator ... done
Converting categories ... done
Converting categorygroups ... done
Converting categorygroups_sites ... done
Converting changedattributes ... done
Converting changedfields ... done
Converting content ... done
Converting content_buddy_prompt ... done
Converting craftidtokens ... done
Converting deprecationerrors ... done
Converting drafts ... done
Converting elementactivity ... done
Converting elements ... done
Converting elements_bulkops ... done
Converting elements_owners ... done
Converting elements_sites ... done
Converting entries ... done
Converting entries_authors ... done
Converting entrytypes ... done
Converting fieldlayouts ... done
Converting fields ... done
Converting globalsets ... done
Converting gqlschemas ... done
Converting gqltokens ... done
Converting imagetransformindex ... done
Converting imagetransforms ... done
Converting info ... done
Converting migrations ... done
Converting neoblocks ... done
Converting neoblockstructures ... done
Converting neoblocktypegroups ... done
Converting neoblocktypes ... done
Converting plugins ... done
Converting projectconfig ... done
Converting queue ... done
Converting recoverycodes ... done
Converting relations ... done
Converting resourcepaths ... done
Converting revisions ... done
Converting searchindex ... done
Converting sections ... done
Converting sections_entrytypes ... done
Converting sections_sites ... done
Converting sequences ... done
Converting sessions ... done
Converting shunnedmessages ... done
Converting sitegroups ... done
Converting sites ... done
Converting structureelements ... done
Converting structures ... done
Converting systemmessages ... done
Converting taggroups ... done
Converting tags ... done
Converting tokens ... done
Converting usergroups ... done
Converting usergroups_users ... done
Converting userpermissions ... done
Converting userpermissions_usergroups ... done
Converting userpermissions_users ... done
Converting userpreferences ... done
Converting users ... done
Converting volumefolders ... done
Converting volumes ... done
Converting webauthn ... done
Converting widgets ... done
Finished converting tables to utf8mb4/utf8mb4_unicode_ci.
Screenshot

After the migration, the site functions properly, but not all content is transferred, specifically those with different entry types. The CMS operates stably and does not generate errors.

Craft CMS version

4.9.6 Pro

PHP version

8.2

Operating system and version

Linux 4.18.0-425.10.1.lve.el8.x86_64

Database type and version

MariaDB 10.3.34

Image driver and version

No response

Installed plugins and versions

PHP. 8.2.13
Linux 4.18.0-425.10.1.lve.el8.x86_64
MariaDB 10.3.34
Imagick 3.7.0 (ImageMagick 7.1.1-19)
Craft Pro 4.9.6

Amazon S3 2.2.1
Asset Rev 7.0.0
CKEditor 3.8.3
Dumper 5.0.1
fortrabbit Object Storage Volume 3.0.0
Neo 4.2.1
Twig Perversion 3.0.0

@Kristomen Kristomen added the bug label Jun 5, 2024
@Kristomen Kristomen changed the title [5.x]: [5.x]: Entries with Non-Default EntryTypes Lose Content After Migration from CraftCMS 4 to CraftCMS 5 Jun 5, 2024
@brandonkelly
Copy link
Member

I’m not able to reproduce that. Any chance you can send your Craft 4 database backup, along with the Craft 5 composer.json file, into [email protected], so we can test the upgrade with your database?

@Kristomen
Copy link
Author

I have sent the database backup and the Craft 5 composer.json file

@brandonkelly
Copy link
Member

Thanks for sending those in! I was able to reproduce with your database. The culprit was that the sections_entrytypes table (which gets created as part of the Craft 5 upgrade) was leftover in the DB from a previous upgrade attempt, but with stale data in it. And some internal code for getting each section’s entry types was checking if the table exists, to see if it’s safe to fetch the entry types based on that table, rather than the old way. So the migration would end up fetching the wrong entry types as a result, and completely sipping migrating data for the correct entry types.

Fixed for the next release.

@brandonkelly
Copy link
Member

Craft 5.1.10 is out now with that fix.

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

No branches or pull requests

2 participants