Skip to content

Instantly share code, notes, and snippets.

@dinarcon
Last active May 16, 2020 03:51
Show Gist options
  • Save dinarcon/7bd01cc139c6992e4ac67d32b24d4c77 to your computer and use it in GitHub Desktop.
Save dinarcon/7bd01cc139c6992e4ac67d32b24d4c77 to your computer and use it in GitHub Desktop.
source:
plugin: content_entity:node
bundle: article
include_translations: false
source:
plugin: csv
path: modules/custom/ud_migrations/ud_migrations_csv_source/sources/udm_photos.csv
ids: [photo_id]
header_offset: null
fields:
- name: photo_id
label: 'Photo ID'
- name: photo_url
label: 'Photo URL'
source:
plugin: d8_config
key: migrate
skip_count: true
source:
plugin: embedded_data
data_rows:
-
unique_id: 1
creative_title: 'The versatility of Drupal fields'
engaging_content: 'Fields are Drupal''s atomic data storage mechanism...'
-
unique_id: 2
creative_title: 'What is a view in Drupal? How do they work?'
engaging_content: 'In Drupal, a view is a listing of information. It can a list of nodes, users, comments, taxonomy terms, files, etc...'
ids:
unique_id:
type: integer
source:
plugin: empty
constants:
entity_type: node
field_name: body
# List of migrate source plugin definitions.
$ drush php:eval "print_r(\Drupal::service('plugin.manager.migrate.source')->getDefinitions());"
# List of migrate source plugin ids.
$ drush php:eval "print_r(array_keys(\Drupal::service('plugin.manager.migrate.source')->getDefinitions()));"
<?php
$databases['default']['default'] = [
'database' => 'drupal-8-or-9-database-name',
'username' => 'drupal-8-or-9-database-username',
'password' => 'drupal-8-or-9-database-password',
'host' => 'drupal-8-or-9-database-server',
'port' => '3306',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
];
$databases['migrate']['default'] = [
'database' => 'drupal-6-or-7-database-name',
'username' => 'drupal-6-or-7-database-username',
'password' => 'drupal-6-or-7-database-password',
'host' => 'drupal-6-or-7-database-server',
'port' => '3306',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
];
source:
plugin: spreadsheet
file: modules/custom/ud_migrations/ud_migrations_sheets_sources/sources/udm_book_paragraph.ods
worksheet: 'UD Example Sheet'
header_row: 1
origin: A2
columns:
- book_id
- book_title
- 'Book author'
row_index_column: 'Document Row Index'
keys:
book_id:
type: string
source:
plugin: url
data_fetcher_plugin: file
data_parser_plugin: json
urls:
- modules/custom/ud_migrations/ud_migrations_json_source/sources/udm_data.json
item_selector: /data/udm_people
fields:
- name: src_unique_id
label: 'Unique ID'
selector: unique_id
- name: src_name
label: 'Name'
selector: name
- name: src_photo_file
label: 'Photo ID'
selector: photo_file
- name: src_book_ref
label: 'Book paragraph ID'
selector: book_ref
ids:
src_unique_id:
type: integer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment