Poll migrate support

Created on 20 December 2015, almost 9 years ago
Updated 1 April 2023, over 1 year ago

Issue for developing Poll migration.

It is currently for Drupal 7 and not universal because it relies on migration_lookup to look up values from d7_node_complete:poll and d7_user.

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.
2. Import poll choices. Done in the Poll_choice migration
3. Create a poll entity for each poll. Created in poll_question migration
4. Create a reference on the poll node to the poll question. Done in poll_reference migration
5. 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/8/api/migrate-api/generating-database-fixtur... 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.
2. 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.
3. 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
4. I manually modified the poll fixtures for the nid and vid to start at arbitrarily high numbers (101 on each).
5. I manually added a fixture to update system table and mark poll module as enabled.

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom naheemsays

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.

  • 🇨🇭Switzerland berdir Switzerland

    The test is failing on D10.

  • Status changed to Needs review over 1 year ago
  • 🇬🇧United Kingdom naheemsays

    It should be passing again.

    The commits on the merge request are a bit of a mess but my attempt to rebase them was... less than adequate so when merging please make sure to squash into one. Thanks!

  • @naheemsays opened merge request.
  • Status changed to RTBC over 1 year ago
  • 🇬🇧United Kingdom naheemsays

    I have moved the code into a new merge request to avoid the previous messy commit history.

    It is the same code as before plus a fix to a coding standards error (which is separate commit).

    I would be grateful to get this done as I want to work on another feature for poll (multiple poll types), but I dont want to touch that until this is in place to ensure that nothing is broken by that work

  • Status changed to Fixed over 1 year ago
  • 🇨🇭Switzerland berdir Switzerland

    I didn't test this myself nor review in depth, but I see it has been tested a bit and it shouldn't interfere with regular functionality of the module, so merged.

    And don't worry about clean commits, merge requests are always squashed when using the d.o tools

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024