Skip to content

poll migrate support

NaheemSays requested to merge issue/poll-2638406:2638406-poll-migrate into 8.x-1.x

The migration involves multiple steps: Migrations

  1. Importing the configuration. Done in 4 steps :
  • poll_field_storage_config to create the Field storage.
  • poll_field_instance to attach the entity to the poll node.
  • poll_field_instance_display for the default view mode display
  • poll_field_instance_form_display for the form display.
  1. Import poll choices. Done in the Poll_choice migration
  2. Create a poll entity for each poll. Created in poll_question migration
  3. Create a reference on the poll node to the poll question. Done in poll_reference migration
  4. import the votes. Done in the poll_vote migration Tests

For the tests, migrate fixtures are included. The test uses MigrateDrupal7TestBase which already imports the standard drupal7 fixtures from core. Only the additional fixtures for poll are needed to be added on top of that.

I followed the guide at https://www.drupal.org/docs/drupal-apis/migrate-api/generating-database-fixtures-for-migration-tests to create the fixtures:

  1. I used existing fixtures to set up a drupal 7 website.
  2. After importing the Drupal 7 fixtures I logged in and created the polls via the UI, with relevant options and then I voted on them via the UI.
  3. I used the script to create a dump of the foixtures. Following this I deleted all previous data that is in the core drupal 7 fixtures, only leaving the additions.
  4. This would work until there was a change to core fixtures which required bumping the nid and vid to greater than what was added to core, but causedAs this caused nid and vid collisions whenever new data was added to the coredrupal 7 fixtures
  5. I manually modified the poll fixtures for the nid and vid to start at arbitrarily high numbers (101 on each).
  6. I manually added a fixture to update system table and mark poll module as enabled.

Closes #2638406

Edited by NaheemSays

Merge request reports