Skip to content

[5.x]: Custom fields custom migrations issues #17482

Open
@uros-jankovic-wpp

Description

@uros-jankovic-wpp

What happened?

Description

We are trying to update from Craft 4.15.6.1 to Craft 5.7.1. Running locally the migrations run fine and all of the fields and the data is there but when applying the changes (php craft up) in the staging env and running the migrations, none of the data for the custom fields is there.

The data seems to be in the database but the UID in the content column of elements_sites seem to be wrong. Here is the example of one field we have on the assets called Cloudinary Id (plain text field).

{
  "2446e634-4fc3-4990-ad08-7038d7069eda": false,
  "50a4adac-d086-4703-baf9-f621a9ad185f": "wt-cms-assets-prod-copy/wt-cms-assets/2025/02/sfphtgfbftezitgbblsd",
  "66c662be-1b13-455c-a7e5-1a5b18867097": true,
  "9015278b-a18f-4f4e-996b-9591c76b1802": [],
  "d933d180-f48d-4111-a504-2c951bf9c33d": true
}

This value wt-cms-assets-prod-copy/wt-cms-assets/2025/02/sfphtgfbftezitgbblsd is the value that I am expecting to see for that asset but the UID seems to be worng. If I look at the diff for the update for the src/config/project/volumes/assets--55522029-46df-4733-a6e3-fa3cd00a5ec8.yaml the section for Cloudinary Id before the update looks like:

fieldUid: a8cceb77-fd3b-4e04-8fbd-bc7a6b4ec92c # Cloudinary ID
instructions: null
label: null
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: 50a4adac-d086-4703-baf9-f621a9ad185f
userCondition: null
warning: null
width: 100

and after

fieldUid: a8cceb77-fd3b-4e04-8fbd-bc7a6b4ec92c # Cloudinary ID
instructions: null
label: null
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: 57319922-fb5e-400d-9e67-1c8125abbe32
warning: null
width: 100

If I update the UID in the DB to the new value will show up for that asset but I am trying to figure out why the migration is not doing this. This is happening for just about all the custom fields, not just for assets but for Entries as well.

Any help would be much appreciated.

Craft CMS version

5.7.1

PHP version

8.2

Operating system and version

No response

Database type and version

PostgreSQL (ver. 15.10)

Image driver and version

No response

Installed plugins and versions

    "cloudinary/cloudinary_php": "^1.13",
    "clubstudioltd/craft-asset-rev": "^8.0.0",
    "craftcms/aws-s3": "2.2.2",
    "craftcms/ckeditor": "^4.9.0",
    "craftcms/cms": "5.7.10",
    "firebase/php-jwt": "^5.2",
    "google/analytics-data": "^0.9.4",
    "google/apiclient": "^2.0.0",
    "ip2location/ip2location-php": "^8.0",
    "spicyweb/craft-neo": "5.4.4",
    "vlucas/phpdotenv": "^3.3.3",

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions