migrate_source_example is a module that contains a set of sub-modules that provide content migrations from different
sources.
Currently the project features migrations from following sources:
- External (non-Drupal) database tables.
- CSV files;
- XML files;
- JSON resources.
- Install Drupal 8 compatible
drush. - Install Drupal 8 using
Standardprofile. - Download
migrate_toolscontrib module intomodules/contrib/migrate_tools(see instructions). - Download
migrate_pluscontrib module intomodules/contrib/migrate_plus(see instructions). - Enable
migrate_source_examplemodule (drush en migrate_source_example).
- Enable
migrate_source_example_dbmodule (drush en migrate_source_example_db).
- Download
migrate_source_csvcontrib module intomodules/contrib/migrate_source_csv(see instructions). - Enable
migrate_source_example_csvmodule (drush en migrate_source_example_csv).
- Enable
migrate_source_example_xmlmodule (drush en migrate_source_example_xml).
- Enable
migrate_source_example_jsonmodule (drush en migrate_source_example_json).
- Download
migrate_drushcontrib module intomodules/contrib/migrate_drush(see instructions). - Enable
migrate_source_example_spreadsheetmodule (drush en migrate_source_example_spreadsheet).
- Run
drush msto see all migrations. - Run
drush mi --group=[GROUP]to import content from specific example group.
JSON migration source plugin requires an absolute URL of a JSON resource to be set in migration .yml file due to an assumption that JSON resources are remote. It means that for JSON migration to work, a base url of the site needs to be provided to migration system.
Run drush mi --group=migrate_source_example_json --uri=[BASE_URL], where [BASE_URL] is an absolute path to your
site.
Spreadsheet migrations are created as plugin migrations, therefore they cannot be interacted with using commands
provided by migrate_tools modules. migrate_drush provides migrate_drush_run drush command, which can import
or rollback each migration individually one-by-one.
Run the following commands to import data:
drush migrate_drush_run migrate_source_example_spreadsheet_user --method=importto import users;
Run the following commands to rollback data:
drush migrate_drush_run migrate_source_example_spreadsheet_user --method=rollbackto rollback user migration;
Example content is synced with a Google Spreadsheet.