I am using Migrate Drupal-to-Drupal and migrating a D6 database to D7.

In D6, I have private and public files. They are in one field. In D7, I have a public file field and a private file field. Migrate d2d MigrateNode class puts the source file field info in the 'upload' field which can only be mapped to one destination field: public or private attachments.

My question is: Is there any way to conditionally check the value in the upload field in order to map the 'upload' to either the public or private field based upon that value?

1 Answer 1


I could not figure out a way to conditionally map content to public and private fields in one migration.

But, I did figure out how to resolve the issue.

  1. I migrated all d6 files, public and private, to the d7 public attachments field.

  2. I created a query that finds all the private files migrated into the public attachments field:

    SELECT * FROM migrate_map_f43b6e55cfile mm inner joinfield_data_field_attachments fa on mm.destid1 = fa.field_attachments_fid inner join file_managed fm on fa.field_attachments_fid = fm.fid where fm.uri like '%private%' and fa.entity_type = 'node' order by fm.filename

The private files can be identified because they will have 'private' in their URI.

  1. I iterate through the query results and switch the private files from the public attachments field to the private attachment field.

This process, while requiring an additional step after the actual migration, works perfectly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.