Migrate Webforms

Created on 13 January 2023, about 2 years ago
Updated 11 June 2024, 9 months ago

Problem/Motivation

Keen to migrate Webforms from D8 to a D9 site, but first attempt has resulted in errors.

Steps to reproduce

Both sites using Webform 6.x

YAML for migration:

id: my_webform_migration
label: Migrate Webforms from legacy D8 to New D9
  
source:
  plugin: d8_entity
  scheme: public
  key: migrate
  entity_type: webform

process:
  id: id
  title: title
  status: status
  description: description
  elements: elements
  handlers: handlers
  access: access
  settings: settings 
  
destination:
  plugin: 'entity:webform'

migration_dependencies: null

Error

An error is being flagged up in the query() function in ContentEntity.php when the migration is run:

Syntax error or access violation: 1103 Incorrect table name ''

It looks like $dataTable = $entityDefinition->getDataTable(); is not returning a value and this segment of code is causing the error:

      $query = $this->select($baseTable, 'b')
        ->fields('b');
      if (!empty($this->configuration['bundle'])) {
        $query->condition("b.{$bundleKey}", $this->configuration['bundle']);
      }

$baseTable = $entityDefinition->getBaseTable(); is populated

Way Forward

Not sure if I've overthought this, or if there is a simple solution to migrate Webforms. Other entities have migrated fine with this module (Files, Media, Content, Users), but not sure if the migration YAML needs a bit of tweaking. If it's currently not possible with this module, webform migration would be a useful feature.

Fallback is manually copy each webform via YAML using single_content_sync module

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom robcarr Perthshire, Scotland

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India optimusprime619

    I am currently trying to migrate webforms from a Drupal 8 to 9 site and facing similar issues. The volume of webforms to migrate pretty much rules out export/import option in my case.

    I was of the impression that this module was meant primarily to cater to content entities only and not configuration entities like webform. After skimming the migration API Documentation, I tried creating my own source plugin to fetch from the webform table. The migration resulted in creation of empty forms without title description or any attributes other than the webform id. I assume this is because all the webform attributes are flatted as yaml and stored in config, though with my limited knowledge of the Migration API I might be completely wrong here.

    I am currently looking through the code from Webform Migrate module to check if I can repurpose any of the D7 to D8 Migration into D8->D9 migration assuming I can create a source plugin that I can use to map all the respective webform attributes.

Production build 0.71.5 2024