- π³π±Netherlands Summit
Hi, did you solve this please? I also have two MYSQL database tables which I want to migrate.
Thanks for your reply in advance, greetings,
Hello,
I'm migrating projects from a custom SQL database to a new project content type which contains paragraph fields.
I can import projects and paragraphs but I stumble on the way to link them together.
Using Drupal 8.5.2, Migrate Plus 4.0-beta3 and Migrate Tools 4.0-beta3.
I have 2 following SQL tables as a source:
Project table
+----------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| client_id | int(11) | NO | MUL | NULL | |
| name | varchar(100) | NO | | NULL | |
| comment | longtext | YES | | NULL | |
| contact | longtext | YES | | NULL | |
| updatedAt | datetime | NO | | NULL | |
+----------------+--------------+------+-----+---------+----------------+
Service table
+------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| project_id | int(11) | YES | MUL | NULL | |
| title | varchar(255) | YES | | NULL | |
| url | varchar(255) | YES | | NULL | |
| comment | longtext | YES | | NULL | |
+------------+--------------+------+-----+---------+----------------+
Here is the service migration:
id: service
label: Service Providers
source:
plugin: service
keys:
- 'id'
ids:
id:
type: string
process:
field_name: title
field_url: url
field_comments: comment
uid:
plugin: default_value
default_value: 1
status:
plugin: default_value
default_value: 1
destination:
plugin: 'entity_reference_revisions:paragraph'
default_bundle: service_provider
And my project migration:
id: project
label: Projects
source:
plugin: project
keys:
- 'id'
ids:
id:
type: string
process:
type:
plugin: default_value
default_value: project
title: name
field_client:
plugin: migration_lookup
migration: client
source: client_id
field_service_providers:
plugin: iterator
source: service
process:
temporary_ids:
plugin: migration_lookup
migration: service
source: project_id
target_id:
plugin: extract
source: '@temporary_ids'
index:
- '0'
target_revision_id:
plugin: extract
source: '@temporary_ids'
index:
- 1
body: comment
[...]
destination:
plugin: 'entity:node'
migration_dependencies:
required:
- user
- client
- service
Unfortunately field_service_providers
doesn't get populated.
Yesterday I spent the whole afternoon to google and try dozens of examples without any luck.
Any help would be greatly appreciated! :)
Active
API
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Hi, did you solve this please? I also have two MYSQL database tables which I want to migrate.
Thanks for your reply in advance, greetings,