Run into issues with Drush after updating from 8.9.20 to 9.3.13

jp flag

I upgraded from 8.9.20 to 9.3.13 and i did an update.php after this. I do get an error:

MISSING UPDATES FOR: VIEWS The installed version of the Views module is too old to update. Update to a version prior to 9.0.0 first (missing updates: views_post_update_remove_core_key).

If i try to update the databse with drush updatedb i get an error too:

In BootstrapHook.php line 36: Bootstrap failed. Run your command with -vvv for more information.

Is there any chance to solve this issue?

This is the status: Drupal version : 9.3.13
Site URI : http://default
DB driver : mysql
DB hostname : localhost
DB port : 3306
DB username : xxx
DB name : xxx
PHP binary : /usr/local/Cellar/php/8.0.3/bin/php
PHP config : /usr/local/etc/php/8.0/php.ini
PHP OS : Darwin
Drush script : /usr/local/bin/drush
Drush version : 11.0.9
Drush temp : /tmp
Drush configs : /Users/mb/Sites/vendor/drush/drush/drush.yml /Users/mb/drush/drush.yml
Drupal root : /Users/mb/Sites
Site path : sites/default

Thanks for helping!

4uk4 avatar
cn flag
What is unclear about the error message that you need to run update.php before and not only after the upgrade?
id flag
Did you consider running your command with -vvv for more information?
id flag
cn flag

The function views_post_update_remove_core_key was introduced in Drupal 8.8 and was removed in Drupal 9.0. See views_removed_post_updates.

To avoid this error and probably other similar errors you have to run update.php or drush updb at least one time with Drupal 8.8.12 or Drupal 8.9.20 (make sure it runs without errors while you are still on Drupal 8) before you can upgrade the code to Drupal 9. Then running update.php on Drupal 9 shouldn't throw this error.

You can add missed post updates to the state of your Drupal installation

$key_value = \Drupal::service('keyvalue');
$existing_updates = $key_value->get('post_update')->get('existing_updates', []);
$post_updates = [
$key_value->get('post_update')->set('existing_updates', array_merge($existing_updates, $post_updates));

(Code is from UpdatePostUpdateTest)

and then run the missed updates yourself. In this example you could simply re-save all Views by hand.

druplash avatar
jp flag
Thanks! That means that i have to go back to 8.9.20 and start the update and upgrade procedure again? Or do i have any chance to solve this within this situation?
4uk4 avatar
cn flag
You can try, see the edited answer. But there could be much more update code missing. It's unlikely this is only this one post update function.

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.