I'm migrating D6 to D7 and have a specific node type with attachments.

I've imported all of the attachment files using a dedicated file migration. The files are in place and have corresponding entries in file_managed table.

The node migration runs without errors or messages and creates the destination nodes, but does not attach the files. From what I've read, nominating MigrateFileFid is the way to go on this, but that seems to cause warnings when the migration config is saved (whether or not the specified fields are set to DNM):

"field_attachment:destination_dir" was used as destination field in "" mapping but is not in list of destination fields
"field_attachment:destination_file" was used as destination field in "" mapping but is not in list of destination fields
"field_attachment:file_replace" was used as destination field in "" mapping but is not in list of destination fields
"field_attachment:source_dir" was used as destination field in "" mapping but is not in list of destination fields
"field_attachment:urlencode" was used as destination field in "" mapping but is not in list of destination fields

Any pointers would be very welcome.

(Edited to actually include the attachment)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

thekenshow’s picture

thekenshow’s picture

Working on this more, it looks like fid is not available for mapping when using migrated2dwizard to set up the migration. So although [field_attachment:file_class] option appears on the mapping form generated by migrated2dwizard, there's no way that MigrateFileFid can work.

If I'm right, then this recommendation below only applies when coding a custom migration, not when using migrated2dwizard:

The simplest and most efficient way to get your files imported is to use the distinct file migration class, rather than try to map them directly in the referencing classes

If that is the case, is it possible to hook into/extend what migrated2dwizard already provides to add fid to the node migration while leaving everything else (users, taxonomies, files) as is? I'm looking at migrate_d2d_example but it appears to register a completely separate migration instead.

thekenshow’s picture

Picking this up again, I decided to revisit my original, successful node migration.
First, I rolled back the separate file migration, ensured all the destination files were deleted.

Next, I re-ran the Import from Drupal wizard and when prompted, I provided a file spec (the source is on the same server):

/var/www/vhosts/example.com/httpdocs/live/sites/default/files

Then I added only the following mapping (the rest of my original mapping was preserved). Note that the source nodes are using standard Drupal file attachments, not CCK.

Attachment (file) [field_attachment] --> Upload [upload]

Finally, I ran the migration from drush. All nodes were migrated, but no file attachments and Messages log was filled with:

734         The specified file <em class="placeholder">2445</em> could not be copied to <em class="placeholder">private://example-resource-media/2445</em>. 
 989         The specified file <em class="placeholder">2446</em> could not be copied to <em class="placeholder">private://example-resource-media/2446</em>. 
 530         The specified file <em class="placeholder">2486</em> could not be copied to <em class="placeholder">private://example-resource-media/2486</em>. 
 506         The specified file <em class="placeholder">2509</em> could not be copied to <em class="placeholder">private://example-resource-media/2509</em>. 

The values correspond to nids and fids but clearly the migration isn't handling them properly. Feels like this is exactly what the UI should handle - am I missing something?

seanr’s picture

Has anyone figured this out? I've got the exact same issue.

bmx269’s picture

I am stuck with this as well, can anyone share their success please.

-Trent

mikeryan’s picture

Status: Active » Postponed (maintainer needs more info)

First off, the messages you see when setting the file_class default value to MigrateDestinationFid are notices, not errors, and can be safely ignored - the issue here is that those subfields are not available (because not necessary) for MigrateFileFid, but we don't have a good way to remove them from the form, so we get the complaints.

Could you be more specific about "fid is not available for mapping when using migrated2dwizard to set up the migration"? The source field for the file field mapping should be the file field value from the source, which should contain a fid.

"The specified file 2445 could not be copied to private://example-resource-media/2445" says to me you're not using MigrateFileFid - the incoming value is a fid, but without specifying MigrateFileFid it's being interpreted as a filespec.

mikeryan’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)
joep.hendrix’s picture

Status: Closed (works as designed) » Active
FileSize
10.81 KB
23.19 KB

Am I allowed to reopen this issue?
I am not able to migratie node file references through th UI.

Import setting

Setting

Result

result

Any clues?

mikeryan’s picture

Status: Active » Fixed

You have to set the default value of the file_class subfield (immediately below the file field mapping itself) to MigrateFileFid.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Louis Delacretaz’s picture

Ran migrate_d2d files OK and can see that the files arrived in the private:// directory.

Importing creates the nodes without errors but there is no files attached.
Is there a log anywhere I can inspect to see whats going on?
My file attachment setup is attached as Im Ive misunderstood the config.

niner94949’s picture

@Louis Delacretaz - Did you ever find a solution? I'm running into the same problem.

Ran migrate_d2d files OK and can see that the files arrived in the private:// directory.

Importing creates the nodes without errors but there is no files attached.
Is there a log anywhere I can inspect to see whats going on?
My file attachment setup is attached as Im Ive misunderstood the config.

sw_msnd’s picture

Can someone help me with getting started with migrate_d2d? I am having issues connecting to the remote database where my old drupal db is installed in step one: credentials. The database is sitting on a different apache webserver, and I am able to connect to it remotely using mysql workbench from my local machine. Below is the error I get when trying to connect via the wizard
"Failed to connect to source database, message returned: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: YES)" Can I actually do this? Or do I have to copy the entire db to the new webserver?