A demo module created by Mauricio Dinarte (@dinarcon) to explain migrations concepts in Drupal.
This module is part of the Understand Drupal Migrations Course which can be purchased at https://udrupal.com/get-migrations-course
The following projects are required to run this demo. The numbers indicate which version of the project was last used for testing.
- Drupal 9.1.5
- Migrate plus 8.x-5.1
- Migrate source HTML 1.0.0
- Migrate tools 8.x-5.0
- Drush 10.3.6
Although not required to run the example migrations, the following module is used in the debugging lessons:
- Migrate devel 8.x-2.0-alpha2
Drush 10.4
and later is not compatible with migrate_tools <= 5
. Until a 6.x
branch is released for migrate_tools
, Drush needs to be pinned to ^10.3.0
via Composer.
This demo includes eight migrations. All of them use a JSON file as the source.
ud_book_html_file
for importing images from HTML files. There are no dependencies on other migrations.ud_book_json_file
for importing images from HTML content embedded in a local JSON file. This migration is not detected out of the box because the file extension is.txt
instead of.yml
. The images are actually imported in theud_book_json_node
migration. This migration was added for reference only.ud_book_json_node
for importing nodes from HTML content embedded in a local JSON file. Depends onud_book_html_file
.ud_book_json_auth_node
for importing nodes from remote JSON file. There are no dependencies on other migrations.
- Install module dependencies via Composer:
composer require 'drupal/migrate_devel:^2.0@alpha' 'drupal/migrate_plus:^5.1' 'drupal/migrate_source_html:^1.0' 'drupal/migrate_tools:^5.0'
- Install the Drush 10.3.x via Composer:
composer require 'drush/drush:^10.3.0'
. After this step, you may call it via./vendor/bin/drush
. - Make sure your Drupal installation has a
/modules/custom
folder. Themodules
folder should exist, but thecustom
sub-folder might not. Create it if needed. - Download the demo module contained in this repository into the
/modules/custom
folder. You can do this by cloning this repository or downloading a ZIP file. Important: In either case, you need to rename the folder toud_book
. Otherwise, the migrations will not find the JSON file used as source data. - Enable the UD Book Example Migration (
ud_book
) module. - Run the migrations using Drush. See instructions below.
- Check out the DEVELOPMENT.md file for instructions on configuring a local development environment.
- Check out the TROUBLESHOOTING.md file for solutions to common problems.
Import all migrations using the following Drush command:
./vendor/bin/drush migrate:import --tag='UD Migrations Advanced Example'
Rollback all migrations using the following Drush command:
./vendor/bin/drush migrate:rollback --tag='UD Migrations Advanced Example'