Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rachellawson/dab02bce5366d381ede200ba947a67c5 to your computer and use it in GitHub Desktop.
Save rachellawson/dab02bce5366d381ede200ba947a67c5 to your computer and use it in GitHub Desktop.
a collection of migrations - i this case to make some groups, group_content and content entities from a csv and a json. The json is read twice; once to create the content entities and then again to create the group_content entities joining them to the right group
uuid: xxx
langcode: en
status: true
dependencies: { }
_core:
default_config_hash: wQBGyxU9I0xkvmhVOYPTI8xAPDRmQqHJRGcumgEen0w
id: csv_migrate_story
migration_tags:
- CSV
migration_group: mt_stories
label: 'CSV file to Travel Stories'
source:
plugin: csv
path: 'public://csv/stories.csv'
header_row_count: 0
constants:
uid: 1
body: 'A Travel Story by '
keys:
- mt_id
column_names:
-
id: id
-
mt_id: mt_id
-
name: name
-
email: email
-
desc: desc
-
url: url
process:
type:
plugin: default_value
default_value: travel_story
field_mt_id: mt_id
field_mt_user: name
field_mt_email: email
field_mt_url: url
label: desc
uid: constants/uid
field_description:
plugin: concat
source:
- constants/body
- name
destination:
plugin: 'entity:group'
migration_dependencies:
required: { }
optional: { }
uuid: xxx
langcode: en
status: true
dependencies: { }
_core:
default_config_hash: wQBGyxU9I0xkvmhVOYPTI8xAPDRmQqHJRGcumgEen0w
id: json_travel_story_entry
migration_tags: null
migration_group: mt_stories
label: 'JSON feed of Travel Story Entries'
source:
plugin: url
data_fetcher_plugin: http
data_parser_plugin: json
urls: 'http://path.to.json'
constants:
uid: 1
divider: ' '
fields:
-
name: entryid
label: 'Entry ID'
selector: entryid
-
name: mt_id
label: 'MoveableType ID'
selector: blogid
-
name: title
label: Title
selector: title
-
name: date
label: Date
selector: date
-
name: body
label: 'Body text'
selector: body
-
name: body_more
label: body_more
selector: body_more
-
name: teaser
label: 'Excerpt - sometimes empty'
selector: excerpt
ids:
entryid:
type: integer
process:
type:
plugin: default_value
default_value: travel_story_update
mt_id: mt_id
title:
plugin: default_value
default_value: Update
source: title
field_date_of_update:
plugin: process_mt_date
source: date
body/value:
plugin: concat
source:
- teaser
- body
- body_more
body/format:
plugin: default_value
default_value: rich_text
field_entryid: entryid
uid: constants/uid
destination:
plugin: 'entity:node'
migration_dependencies:
required:
- csv_migrate_story
uuid: xxx
langcode: en
status: true
dependencies: { }
_core:
default_config_hash: wQBGyxU9I0xkvmhVOYPTI8xAPDRmQqHJRGcumgEen0w
id: json_travel_story_entry_groupcontent
migration_tags: null
migration_group: mt_stories
label: 'JSON feed of Travel Story Entries - to create groupcontent'
source:
plugin: url
data_fetcher_plugin: http
data_parser_plugin: json
urls: 'http://path.to.json'
constants:
uid: 1
fields:
-
name: entryid
label: 'Entry ID'
selector: entryid
-
name: mt_id
label: 'MoveableType ID'
selector: blogid
-
name: title
label: Title
selector: title
-
name: date
label: Date
selector: date
-
name: body
label: 'Body text'
selector: body
-
name: excerpt
label: 'Exceprt - sometimes empty'
selector: excerpt
ids:
entryid:
type: integer
process:
type:
plugin: default_value
default_value: group_content_type_040b636e0ec2b
gid:
plugin: migration
migration: csv_migrate_story
no_stub: true
source: mt_id
entity_id:
plugin: migration
migration: json_travel_story_entry
no_stub: true
source: entryid
label: title
uid: constants/uid
destination:
plugin: 'entity:group_content'
migration_dependencies:
required:
- json_travel_story_entry
- csv_migrate_story
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment