Problem/Motivation

Splitting the parent issue into smaller tasks.

This is about adding a new section explaining how to write migrations for custom/contrib modules.

Writing migrations for custom/contributed modules (new)

Use core modules as examples, including source plugins, tests, etc… (a bit of a start here: https://www.drupal.org/node/2342695) (new)
Examples (new)
When to use templates (new)
Link to API docs (new)

Proposed resolution

As above created a new section about migrate for custom/contrib modules.

Decide where to put this documentation in the handbook

Remaining tasks

Decide where to put the documentation in the handbook.
Write the documentation!

Comments

quietone created an issue. See original summary.

masipila’s picture

Assigned: Unassigned » masipila

This comment was posted to wrong issue.

masipila’s picture

Assigned: masipila » Unassigned
masipila’s picture

I was thinking the content of this page a bit.

1. First of all, we need to decide if we want to place this doc page to the Upgrade to Drupal 8 guide or the Migrate API guide.

After giving this a bit of thinking I would vote to place it in the Migrate API guide, reason being that the primary audience of the 'Upgrade to Drupal 8' is site builders whereas the API documentation is written for developers. We can of course have a cross references from the 'Upgrade to Drupal 8' guide to the Migrate API guide but the page needs to have one home.

Any comments on this?

2. About the content of this documentation page.

I was thinking that we could open up a couple of core module migrations and explain them step by step, starting from the most simple migration and then adding more complex examples.

2.1 We could start for example from d7_dblog_settings.

Here we would explain that
- dblog module provides a migration template
- we have a source plugin
- we have the process for mapping and doing transformations where needed
- we have the destination which is a configuration entity in this example

2.2 Then we could provide another example where we have multiple rows of source data, for example d7_user.
- Here we would then have a closer look at source plugins
- And process plugins

2.3 What else would we need to cover in this documentation page?

Cheers,
Markus

quietone’s picture

1. I like putting in the Migrate API guide.
2. Using d7_dblog_setttings make sense since contrib may need to migrate variables. I think examples of field migration and a migration that uses a deriver should be added.

masipila’s picture

Hi,

Half way there, see https://docs.google.com/document/d/1_K3Z4c-0R6Bi0pf4SpQivgmw2BYyITNXV-0v...

The file is world writable so feel free to make any improvements as you see fit.

Regarding the field example. I was planning to use the D7-D8 filefield as an example. However, I've not been doing field migrations by myself earlier and I noticed that we have two different field plugins here:

The first FileField class extends D6FileField which implements MigrateFieldInterface

and the second FileField class extends CckFieldPluginBase

I'm having a small whiskey-tango-foxtrot moment here (which also indicates that I should go to bed) but could someone help me understand how the things are hanging together here so that I can continue writing this part?

Cheers,
Markus

quietone’s picture

Just read the google doc. Looks and reads wonderfully. Do you want to move that to the handbook now or something else?

For FileField use the one that implement MigrateFieldInterface. Everything Cck has been deprecated, they are still around for BC and just point to the corresponding Field structures anyway.

masipila’s picture

Re: #7

I'll still add the filefield and deriver examples before creating the page to Migrate API guide. Thanks for the clarification quietone!

Markus

masipila’s picture

Status: Active » Needs review

The page has now been created, see https://www.drupal.org/docs/8/api/migrate-api/writing-migrations-for-con...

Setting for NR so that somebody will take the time to read through the article. If there are any inaccuracies, just fix them directly to the article and mark this as fixed.

Cheers,
Markus

masipila’s picture

masipila’s picture

Next steps for peer review:

  • Please read thorugh the page at https://www.drupal.org/docs/8/api/migrate-api/writing-migrations-for-con...
  • If it's OK, please update this task to Fixed
  • If minor improvements are needed, please do those directly to the article and mark this task as Fixed.
  • If the page is full of crap but you don't have time to fix it right away, please change the doc page status to 'Incomplete', provide your feedback here and change this task to 'Needs work'

Cheers,
Markus

quietone’s picture

masipila’s picture

I just added an example on contrib / custom field type migration:
https://www.drupal.org/docs/8/api/migrate-api/writing-migrations-for-con...

Markus

quietone’s picture

Status: Needs review » Fixed

I just read the page from start to finish. Wonderful! I really like the conversational style of writing and the way the various migrations are stepped through. It is clear what is happening at each stage, and provides enough information to get started. And the links for further reading are great. I think a lot of care went into what migrations to use and what processes to explain. And yes, it covers exactly what is in the title, writing migration for contrib and custom modules.

Setting to fixed!

@masipila, great job!

Status: Fixed » Closed (fixed)

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