My “Drupal 6 to Drupal 8 migration/upgrade” notes

Today is a day off for me, so I don’t want to take much time here, but ... these are my latest notes on how to upgrade/migrate a Drupal 6 website to Drupal 8:

TO-DO: Remaining Problems
-------------------------
* i had these as "To-Do" items, but just got them fixed on May 22, 2016
* need to port meta-description fields from D6 to D8
    * install Metatag module (done)
    * write SQL to port meta-description and maybe meta-keywords (done)
* D8 emits some dumb <link> fields in the <head> that are bad for SEO
  (they create 403 errors). this project aims to get rid of those, but it has bugs:
  https://github.com/enjoyiacm/unset_html_head_link
    * get this module working with D8.1.1 (done)


Drupal 8.1.1 Installation
-------------------------
* do a "Standard" installation
* delete the "Tags" vocabulary: admin/structure/taxonomy
* it does not matter if you delete "Full HTML", it's messed up anyway


Now perform the migration
-------------------------
* do the migration as usual
* see http://alvinalexander.com/drupal/how-to-upgrade-drupal-6-website-to-drupal-8


Do these things after the migration
-----------------------------------

* copy '/images' dir from the D6 installation
* disable/delete "Full HTML" (full_html)     (admin/config/content/formats)
* disable/delete "Full HTML" (full_html1)    (admin/config/content/formats)
* create "Full HTML D8" text format  (admin/config/content/formats)
    * machine name = full_html_d8
        * admin, editor
        * ckeditor
        * track images, align images, correct faulty html
    * note: this machine name will be found in:
        * node__body
        * node_revision__body
        * (cache, config, and key_value tables — these don't matter)

* queries to fix "Full HTML D8" format for all nodes:
    * UPDATE `node__body` set body_format='full_html_d8'
    * UPDATE `node_revision__body` set body_format='full_html_d8'
    * drush cr
    * D6 Blog nodes should now display properly
        * Edit Blog should show the "Full HTML D8" type

* create the "Photo D8" content type
    * note: do this before 'langcode' fixes, because they run against this table
    * create a "PhotoD8" content type, as described on this page (a few paragraphs below this point):
      http://alvinalexander.com/drupal/how-to-migrate-drupal-6-photos-content-type-drupal-8#toc_5
    * UPDATE node__field_photo SET langcode='en'
    * run MigrateAllD6Photos.php
        * this script is on Github: https://github.com/alvinj/UpdatePhotoContentTypeToDrupal8
        * note: the correct output looks like this:
              nid: 7545, vid: 7735, lang: en, fip: 2218
              nid: 7548, vid: 7738, lang: en, fip: 2219
              Please flush all caches (drush cr)
    * i forgot to add tags here, so:
        * go to 'admin/structure/types/manage/photod8/fields'
        * click 'Add field'
        * Under 'Re-use an existing field':
            * select 'Entity reference: tags' (i don't know what 'field_tags' are)
            * set 'Label' to 'Tags' (it should default to that)
            * i think there are more things on a subsequent screen, but i forgot to
              note those. i'm pretty sure i just went with the default values.
    * good time to make db backup

* fix all the 'langcode' problems
    * see http://alvinalexander.com/drupal/how-to-upgrade-drupal-6-website-to-drupal-8
    * run the queries in 1-FixAllLangcodes.sql
    * drush cr
    * all Blog nodes and Photo nodes should display properly now
    * good time to make db backup

* uninstall the "Migrate" modules at 'admin/modules/uninstall'

* drop all "migrate" tables
    * note: i haven't been uninstalling the Migrate modules, so i created this technique
      to remove all of the 'migrate*' database tables. if those tables are gone after you
      uninstall the Migrate modules, this step is not needed.
    * get the temporary 'migrate' table names using a technique like this:
      http://alvinalexander.com/mysql/how-to-list-mysql-table-column-field-names-without-table-formatting-headers
    * update 2-DropAllMigrateTables.sql with those table names
    * run the queries in 2-DropAllMigrateTables.sql
    * verify all migrate_map_* and migrate_message_* tables are gone

* drush cr
* good time to make db backup

* go to this URI and re-order the display fields, they have poor defaults
    * admin/structure/types/manage/blog/display
    * my preferred order is Body, Category, Tags, Comments. don't show Links or Upload.

* note: all Blog nodes and Photo nodes should still be working


Install other needed modules
----------------------------

* TOC: https://www.drupal.org/project/toc_api
* TOC: https://www.drupal.org/project/toc_filter
* Similar by Terms: https://www.drupal.org/project/similarterms


"Front Page 1" View
-------------------
- content shows up
    TODO: photos/images do not show up
- create a View and make it the front page
- D6 front page view
    - style: unformatted
        - settings:
            - set "Row class" to: content-type-{{ type }}
            - enable "Add views row classes"
    - row style: fields
    - pager
    - 20 items
    - more: no
    - access: unrestricted
    - css class: new-front-page
    - fields:
        - node: type
        - node: title
        - node: teaser
        - content: Photo
        - content: Author
    - node type in Blog, Photo, Text ...
    - node published
    - node promoted to front page
    - sort by:
        - Node: sticky
        - Node: post date
    - no Relationships
    - no Arguments


Similar by Terms Configuration
------------------------------
- install Similar By Terms module (https://www.drupal.org/project/similarterms)
- create a new View
    - create a Contextual Filter
        - select the "Similar By Terms" NID
            - when the filter is not available -> Display all results for the specified field
            - Limit similarity to terms within these vocabularies
                - Category
                - Tags
    - Use aggregation: Yes
    - Sort Criteria
        - COUNT(Content: ID), descending
    - Filter Criteria
        - Aggregation type: Group results together (important)

I hope to write more about this in the future, but in the meantime, those my “Drupal 6 to Drupal 8 migration” notes.