Site upgraded to Drupal 8

Submitted by Drupal Master on Mon, 01/25/2021 - 09:11

After a lot of struggle this site is now upgraded to Drupal 8. I have not yet managed to port all the functionality due to that many modules not yet exist for Drupal 8. In some cases it is questionable if they ever will be ported. Some pitfalls during the upgrade that needed special treatment:

Use Drush
Use Drush for the generic upgrade. First I tried to use the Web-based upgrade but this crashed all the time leaving error messages that were not possible to understand and thus fix.
Upgrade of old "Media"
In order to upgrade my method of using "Media" in Drupal 7 I found this very neat description: How to convert an existing file/image field to a Media type field. Of course it needs to be tweaked to fit your database scheme but it saves you a lot of time, especially if you have many old nodes. If you have written Drupal 8 modules it is very easy to create one just for this. I used three different files:
  • image_node_update.install
  • image_node_update.module
Text format
The conversion of the old Drupal 7 text formats didn't go that well. It of course worked but it took away old default formats in Drupal 8. To fix this I went straight into the database and did the following things. It is not obvious what to do, you at least need to have some knowledge of the Drupal database structure and of SQL.
  • Before everything else, make a backup of your database!
  • First I copied the text formats from a second pristine Drupal 8 installation.
  • select * from config where name like '%filter.settings%';
  • select * from config where name like '%filter.format%';
  • Next I removed the same from the database being updated.
  • Then I imported them.
  • After this you need to identify with of your tables that are using the text editor and update the format of those. It seems like the upgrade procedure uses number, mine were called 1,2,3,4. In the Drupal 8 they are called basic_html etc.
  • update taxonomy_term_field_data set description__format = 'basic_html';
  • update taxonomy_term_field_revision set description__format = 'basic_html';
  • For nodes you need to identify which old that corresponds to the new name like:
  • update node__body set body_format = 'basic_html' where body_format = 1;
  • Finally clear your cache!
Media types
The is a similar problem for "Media types" as for "Text formats". I.e. when the site is upgraded the standard Drupal 8 Media formats disappear. The reason for this is that it is recommended to use the "Minimal profile" when doing the import. In order to get this fromats you need to use the "Standard profile" intstead. Anyhow I ended up with creating them manually.
Gmap module
I had used the Gmap module a lot. But this has not been upgraded to Druspl 8. So I have used Geolocation & Geolocation - Google Maps API instead. I haven't fixed a way to automatically load the Geolocation field so all has been done by hand. (But it would be possible to find your Gmap strings in your nodes and extract the info using some RegExp and load that into the Geolocation field...)