Add a migration to create some custom terms.

This commit is contained in:
David Valdez 2019-08-30 19:27:33 -05:00
parent e3b4a6b562
commit fd5c5f6f13
5 changed files with 52 additions and 1 deletions

View file

@ -21,6 +21,7 @@
"drupal/fixed_block_content": "^1.0",
"drupal/link_attributes": "^1.9",
"drupal/migrate_plus": "^4.2",
"drupal/migrate_source_csv": "3.1",
"drupal/migrate_tools": "^4.1",
"drupal/migrate_upgrade": "^3",
"drush/drush": "^9.0",

View file

@ -0,0 +1,4 @@
id,name,vocabulary
1,Issue,collection_type
2,Author,people_type
3,Book,collection_type
1 id name vocabulary
2 1 Issue collection_type
3 2 Author people_type
4 3 Book collection_type

View file

@ -6,3 +6,5 @@ package: Migration
dependencies:
- migrate_drupal
- migrate_plus
- migrate_source_csv
- migrate_tools

View file

@ -14,14 +14,28 @@ source:
constants:
user_id: 1
author_status: 1
# The users that have an article in the old site will have the term
# "Author" on the new site, this term was migrated from a CSV and in that
# file the ID of that term is 2 (see default_terms.csv) so we are going to
# use that source ID to get the site term id.
author_type_source_id: 2
plugin: geod7_author
process:
title: field_author_value
uid: constants/user_id
status: constants/author_status
field_people_type:
- plugin: migration_lookup
migration: upgrade_d7_taxonomy_term_custom_terms
source: constants/author_type_source_id
destination:
plugin: 'entity:node'
default_bundle: people
migration_dependencies:
required: { }
required:
- upgrade_d7_taxonomy_term_custom_terms
- upgrade_d7_node_story
- upgrade_d7_node_page
- upgrade_d7_node_gleaning
- upgrade_d7_node_blog
optional: { }

View file

@ -0,0 +1,30 @@
langcode: en
status: true
dependencies: { }
id: upgrade_d7_taxonomy_term_custom_terms
migration_tags:
- 'Drupal 7'
- Content
migration_group: migrate_drupal_7_geo
label: 'Extra Taxonomy terms'
source:
plugin: csv
path: modules/custom/geo_upgrade/default_data/default_terms.csv
ids: [id]
process:
name: name
vid: vocabulary
destination:
plugin: entity:taxonomy_term
# Run first the other migration that create terms to avoid get a tid used by other term.
migration_dependencies:
required:
- upgrade_d7_taxonomy_vocabulary
- upgrade_d7_taxonomy_term_vocabulary_1
- upgrade_d7_taxonomy_term_vocabulary_2
- upgrade_d7_taxonomy_term_vocabulary_3
- upgrade_d7_taxonomy_term_vocabulary_7
- upgrade_d7_taxonomy_term_vocabulary_10
- upgrade_d7_taxonomy_term_vocabulary_12
- upgrade_d7_taxonomy_term_vocabulary_13
optional: { }