Profile Picture Migration

Creating this separate doc here cause this bloody field took muuuch longer than expected. Turns out that I hit a major bug in migrate!

User Picture and Profile Values (picture) - Order matters!

The User Picture and Profile values of type ‘picture’ are a bit tricky when importing from D6, so we should make sure we are running these migrations in the proper order.

Specially when not running all migrations, and we run migrations by smaller “groups”.

Fail

I was expecting to be able to migrate the Profile Picture (a ‘picture’ field in profile_values table) along with the other Profile Values fields… but I couldn’t manage to do it, so I came up with this workaround. I’ve added a note in an active issue to confirm the, apparently, bug.

Sad note: I spent two entire days trying to figure out why the value didn’t imported’ 😿

Tip

When migrating files: The files files (redundance!) MUST exist on the files public directory! It seems pretty obvious, but in the middle of the migration maddness anyone can forget about this and you shall expect a nice bunch of errors.

So you can rsync -avz /source/path/docroot/sites/default/files/pictures /dest/path/docroot/sites/default/ before running migrations.

User Picture

1
2
3
4
5
drush mim upgrade_d6_user --execute-dependencies \
drush mim upgrade_d6_user_picture_file --execute-dependencies --update \
drush mim upgrade_user_picture_entity_form_display --execute-dependencies \ 
drush mim upgrade_user_picture_entity_display --execute-dependencies \
drush mim upgrade_d6_user --execute-dependencies --update # --> Re import user and update is needed so the file get's attached!

Profile Picture (field_profile_image)

User The user to attach the image.

    1. drush mim upgrade_d6_user --execute-dependencies

File This is the ‘actual’ file as stored in DB (ie: with path as value)

    2. drush mim acvo_profile_image_file --execute-dependencies

Field The field storage and entity view forms. This holds the data (name, options, description, etc…) for our field.

    3. drush mim acvo_profile_picture_entity_form_display --execute-dependencies

    4. drush mim acvo_profile_picture_entity_display

Update User Entity

    5. drush mim upgrade_d6_user --execute-dependencies --update

Tip

Re-import user and --update are needed so the file get’s attached to the entity!

UPDATE 02/01/2018

  • Import Profile Pictures (D6 core profile module) and create file entities.
  • Attach those file entities to user entities.