Problem/Motivation

As of 2022-12-27 / google_analytics-4.0.2 (there are a bunch of migrate issues!), I can confirm that this module properly migrates my Google Analytics module data from Drupal 7 to Drupal 9. Thank you very much for your hard work to make this easy for me!

But as of Drupal core 8.8.x, modules can declare their Drupal 8 (or 9) upgrade status (changelog, issue #2936365: Migrate UI - allow modules to declare the state of their migrations). Failing to do so makes it seem as if this module has no migrations and/or is not ready to be upgraded... for example, see the following image...

Screenshot of Drupal's upgrade wizard incorrectly saying that Google Analytics will not be upgraded.

... this could be a barrier preventing other people from upgrading their sites to Drupal 8/9/10+.

Steps to reproduce

  1. Set up a Drupal 7 site. Download and install google_analytics-7.x-2.6, and change some settings.
  2. Set up a Drupal 9 site with the Standard install profile. Download and install google_analytics-4.0.2. Enable core's migrate, migrate_drupal, and migrate_drupal_ui modules.
  3. As an administrator, visit /upgrade to begin the Drupal-to-Drupal migration. Proceed through the wizard to the "What will be upgraded?" step.
    • Expected behaviour: "Google Analytics" is in the "Modules that will be upgraded" section.
    • Actual behaviour: "Google Analytics" is in the "Modules that will not be upgraded" section.
  4. Click "Perform upgrade" and wait for the upgrade to finish.
  5. Check the Google Analytics settings at /admin/config/services/google-analytics - note the custom settings were migrated from D7 so the migration is working.

Proposed resolution

Declare the finished upgrade path from D6 and D7 by creating a migrations/state/google_analytics.migrate_drupal.yml and populating it appropriately.

Remaining tasks

  1. Write a patch
  2. Review and feedback
  3. RTBC and feedback
  4. Commit
  5. Release

User interface changes

None.

API changes

None.

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mparker17 created an issue. See original summary.

mparker17’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new3.07 KB

I've made my changes in merge request !20; but here's a patch for folks who prefer that method.

Setting to Needs Review to see if Testbot has any suggested improvements.

Reviews are welcome!

Status: Needs review » Needs work
mparker17’s picture

Status: Needs work » Needs review

Interesting; I was expecting the tests to automatically enable the path_alias dependency; but apparently it did not. I've pushed a commit with updated tests to the merge request; let's see if it works.

mparker17’s picture

While this patch only declares that the upgrade status is finished, and doesn't affect what actually gets migrated, I am happy to report that I was able to upgrade my Google Analytics configuration from my drupal-7.99 site running google_analytics-7.x-2.8 to a drupal-10.2.1 site running google_analytics-4.0.2 using the migration code already in the D10 version of the module.

I cannot RTBC this issue because I wrote the patch. But, hopefully, my success will help other people migrating D7 to D10.

However, now that my D7 to D10 site migration is complete, my ability to contribute further to this issue is severely limited, because the D7 site that I had been using to test has been retired. But, I'll keep an eye on this issue and try to answer questions to the best of my ability.

japerry made their first commit to this issue’s fork.

japerry’s picture

Status: Needs review » Needs work

Looks like some pieces are missing from the migration