Enhance your testing experience with the Migrate Default Content module

Ramon Vilar - rvilar

About me

Ramon Vilar - rvilar

CEO & Drupal developer

The origins

Why we need this?

Our development process

  • Install the project as our development workflow
  • For that reason, we can't back up in a DB for content.
  • But we need content for testing and QA

Installed site with no content

Installed site with content

The requirements

Easy to use, easy to maintain

Easy to use

  • Developer oriented solution
  • Use of Migrate API as our base
  • Easy to create content
    drush migrate-import <content>
  • Easy to remove content
    drush migrate-rollback <content>

Easy to maintain

  • Plain text files for content (CSV and YAML atm)
  • A new use case for a content is a new line in our text file
  • New content for a new entity is a new file

Our module

Migrate default content

History - Past

  • On D7:
    • Bunch of YAML files for entity and field definitions
    • One CSV file for every YAML entity definition
    • Integration with:
      • Node, Comment, Menu, User
      • Organic Groups
      • Field Collection
      • EntityReference

History - Present

  • On D8:
    • Content is on YAML files (or CSV atm)
    • Entity definitions are no longer necessary
    • Integration with all entities
    • Multilingual support

Architecture

  • Based on Migrate API
  • Data source files in a folder out of docroot (recommended)
  • Attachments in /files folder
  • Auto discovery fields for entities based on labels
  • entity.bundle.yml

Examples

Show me the code!

Simple example

node.page.yml

-
  title: Lorem ipsum
  uid: editor_test
  body:
    value: "

And this is all the lorem ipsum dolor text.

" summary: This is a summary format: basic_html field_attached_documents: - image1.png - doc2.pdf status: 1

Entity reference

node.article.yml

-
  title: This is an entity reference example
  uid: editor_test
  field_related:
    - Lorem ipsum
    - Another example
  field_keywords:
    - news
    - sports
  status: 1

Multilingual example

node.page.ca.yml

-
  title: Lorem ipsum CA text
  body:
    value: "

And this is all the catalan content lorem ipsum dolor text.

" summary: This is our CA summary format: basic_html translation_origin: Lorem ipsum

Future

Show me the roadmap

Roadmap

  • Lightweight core
  • JSON data source
  • Paragraph integration
  • UI

THANKS!