Problem/Motivation

D6 and D7 sites will be migrated to D8 via Migrate API. Would be nice to have a migration template that would migrate core files/file entities to media.

Optionally we could also provide migration for Scald atom entities.

Proposed resolution

Create default migration templates. Add test coverage.

Comments

berdir’s picture

Do we need any special handling here?

Based on how migrate works, I'd expect more that we have to provide sources and processors to convert the data to the right format, but there's not really something special about the destination at the moment?

slashrsm’s picture

Issue tags: -sprint +D8Media
stborchert’s picture

It is very easy, indeed. You do not need an additional migration, Entity does the job.

In my migrate.migration.{migration_id}.yml I simply added this processing and everything works :)

process:
  # Media bundle.
  bundle:
    plugin: default_value
    default_value: image
  # Use image title as media name.
  name: title
  status:
    plugin: default_value
    default_value: 1
  # Add description.
  field_description: caption
  'field_description/format':
    plugin: default_value
    default_value: 'basic_html'
  # Add image to media entity.
  'field_image/target_id':
    plugin: migration
    migration: article_images
    source: filename
  'field_image/title': title
  'field_image/alt': alt
destination:
  plugin: entity:media
slashrsm’s picture

Title: Create Migrate destination plugin » Create default migration templates
Issue summary: View changes

Re-purposing the ticket.

andrewmacpherson’s picture

Related: I wrote a Scald Atom source for a custom migration project, so I contributed it over at #2772129: Scald Atom migrate source.

gábor hojtsy’s picture

Issue tags: -Media Initiative
manu-manu’s picture

@stBorchert, would you mind telling witch Migrate source plugin did you used?

stborchert’s picture

@manu manu: We used a custom source plugin for Yaml files (https://www.drupal.org/sandbox/stborchert/2808617).
Note that the source shouldn't matter here (as long as it provides the correct values ;) ).

manu-manu’s picture

Thanks @stBorchert :-)

heddn’s picture