Problem/Motivation

I thought I had the migration working and then I realized I was in for trouble.

The migration provided by this module (see https://community.acquia.com/acquiadam/s/article/How-to-migrate-from-Med...) does a one-to-one mapping of old media types to new media types. This one-to-one mapping is flawed, however, when the media type references both pdf and any other file types.

For example, let's imagine we set up our media per the example in this module itself:

https://git.drupalcode.org/project/media_acquiadam/-/blob/2.x/modules/me...

The acquia_dam_document media can reference pdf or docx (or other things). What do I migrate this to? The problem is that in the acquia_dam module, it's impossible to have a media type that supports both pdf and docx. Those file types are supported by separate AssetMediaSource plugins. I can't have a single media type that supports both of them.

Steps to reproduce

Try to migrate the example media_acquiadam config to acquia_dam using the tools provided in media_acquiadam.

Proposed resolution

There seem to be at least a few options:

1. Instead of a 1:1 mapping configured through the UI, use the acquia_dam media matcher service during the migration to do the mapping of source media to target media.

2. Provide a more flexible AssetMediaSource plugin that supports both pdf and docx

3. Allow a single media type to use more than one AssetMediaSource plugin

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Issue fork acquia_dam-3565073

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

danflanagan8 created an issue. See original summary.

danflanagan8’s picture

It looks like the easiest thing to do is what I labeled option 2. I can alter the plugin definition for the documents AssetMediaSource plugin such that asset_search_value is altered from office to office or pdf. I could also create a new plugin with that value. It's probably easier for the next developer to figure out whats going on if I make a new plugin. Alter hooks can be pretty mysterious.

danflanagan8’s picture

rajeshreeputra’s picture

This is a good observation, I think we can update to make it migrate the media of type pdf from document media type of old module to pdf media type of new module.

rajeshreeputra’s picture

Status: Active » Needs review

Requesting early review.

rajeshreeputra’s picture

Project: Media: Acquia DAM » Acquia DAM
Version: 2.1.2 » 1.1.x-dev

I am moving this issue from the 'media_acquiadam' queue to the 'acquia_dam' module queue to include this Drush command in the Acquia DAM module.

ankitv18’s picture

Status: Needs review » Needs work

Left few comments on the MR.

amangrover90 made their first commit to this issue’s fork.

rajeshreeputra’s picture

Status: Needs work » Fixed

Merged!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

danflanagan8’s picture

I haven't tested it yet, but I reviewed the new drush command by eye. It looks great!

I'm hoping Acquia can add the usage to the docs on th media_acquiadam -> acquia_dam migration.

But what I really like about the new command is that it will continue to be useful beyond the migration. For example, when new asset types are added to a site, the command would be perfect for migrating existing generic assets into the new asset type.

In fact, one approach I could take to my media_acquiadam->acquia_dam migration is to migrate everything (pdfs, documents, archives) into generic assets. That one-to-one mapping is supported well by the migration UI. In the future I could then create dedicated media types to support specific asset types as the need arrises (say we want to add file previews) and use the drush command to change media types as appropriate.

Status: Fixed » Closed (fixed)

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