Over the past two months I have gradually updated one of my Lightning projects. Since the integration of media into Core, this process has become more difficult. Since the release of Drupal 8.5, and Lightning 3.1.0, I've encountered a problem I can't solve.

With 8.5/3.1.0 the Lightning Media Image Entity is dropped. The direct update from Drupal 8.4.5/2.2.0 to the current version fails because in this way there is no migration from Lightning Media Image Entity to Media in Core.

To solve the problem I followed the procedure described on https://github.com/acquia/lightning/releases?after=2.2.4. In particular I have been executing the steps in the section "2.2.0 to 2.2.1 Manual Update Steps" one after the other.

Unfortunately, this leads to the following error message, which is caused by a dependency defined in the Lightning installation.

$ drush cr

$ drush updatedb
[error]  This branch of Entity Browser is not compatible with the version of Media Entity installed. (Currently using Entity Browser This branch of Entity Browser is not compatible with the version of Media Entity installed.)  

Finally, I tried https://lightning.acquia.com/blog/lightning-strict, which leads to the same error message with the difference that the underlying installation corresponds to the original at the time of its release.

Why does the dependency on Media Entity cause a problem if it is part of the distribution? And what would be a viable solution to step up to 8.5/3.1.0, which to date is the actual release of Lightning?

Comments

Thomas Factory created an issue. See original summary.

Ralf Eisler’s picture

I went back to Lightning 2.2.0 with all patches applied properly and reinstalled the backup-database:

$ composer require acquia/lightning:2.2.0 balsama/lightning_strict:2.2.0 --no-update

$ drush cr

$ drush sql-cli < my_database.sql

$ drush updatedb

The installation was okay with no errors.

Then I installed Lightning 2.2.1 with all patches applied properly:

$ composer require acquia/lightning:2.2.1 balsama/lightning_strict:2.2.1 --no-update

$ drush cr

$ drush updatedb

Requirements check reports errors. Do you wish to continue? (yes/no) [yes]:
 > yes

 ---------------------- ----------- --------------- --------------------------------------------------------- 
  Module                 Update ID   Type            Description                                              
 ---------------------- ----------- --------------- --------------------------------------------------------- 
  dropzonejs_eb_widget   8101        hook_update_n   Update configurations for new keys.                      
  lightning_media             8018        hook_update_n   Updates the media browser's argument validation.         
  media_entity                  8200        hook_update_n   Clears the module handler's hook implementation cache.   
  media_entity                  8201        hook_update_n   Replace Media Entity with Media.                         
 ---------------------- ----------- --------------- --------------------------------------------------------- 
 Do you wish to run the specified pending updates? (yes/no) [yes]:
 > yes

 [notice] Update started: media_entity_update_8200
 [ok] Update completed: media_entity_update_8200
 [notice] Update started: media_entity_update_8201
 [error]  Cannot change the definition of field media_revision.revision_uid: field doesn't exist. 
 [error]  Update failed: media_entity_update_8201 
 [notice] Update started: dropzonejs_eb_widget_update_8101
 [error]  The "media_bundle" entity type does not exist. 
 [error]  Update failed: dropzonejs_eb_widget_update_8101 
 [error]  Update aborted by: media_entity_update_8201, dropzonejs_eb_widget_update_8101 
 [error]  Finished performing updates.
frederickjh’s picture

I ran into this same error message while doing the same Lightning upgrade from 2.2.0 to 2.2.1.

Not sure if this is in the documentation anywhere but I figured out that I had a number of Lighting required packages also in my root composer.json. When running composer update or composer require vendor/package I would get warning messages like:

> Dependency vendor/package is also a root requirement, but is not explicitly whitelisted. Ignoring.

Once I manually edited and removed these packages and their version constraints from my main composer.json I was able to upgrade from Lightning 2.2.0 => 2.2.2 with

composer require acquia/lightning:2.2.2 balsama/lightning_strict:2.2.2 --no-update
composer update
drush cr
drush updb

I am using the Lightning Strict package for my upgrades.

You may notice that I decided to got directly to the 2.2.2 release instead of upgrading to the 2.2.1. I did this as the notes in UPDATE.md were the same and I figure that it was most likely because it was a bug fix.

I hope this helps someone else having this issue.

frederickjh’s picture

One further note, I notice that one of the database updates listed for upgrading from 2.2.0 => 2.2.0 did not run. This was the
lightning_api module :
8002 - Installs the Consumers module.

The consumers module was not installed but required by lightning. I fixed this with

drush en consumers
drush cr
Ralf Eisler’s picture

Version: 8.x-2.20 » 8.x-2.22
Category: Support request » Bug report

Not sure if this is in the documentation anywhere but I figured out that I had a number of Lighting required packages also in my root composer.json.

I came to the same conclusion, and in fact, I had some requirements in the root composer.json file, which were identical to some requirements in the composer.json file in the Lightning profile. So I removed them from the root file.

You may notice that I decided to got directly to the 2.2.2 release instead of upgrading to the 2.2.1.

I also did that, but this update failed:

drush updatedb
[error]  This branch of Entity Browser is not compatible with the version of Media Entity installed. (Currently using Entity Browser This branch of Entity Browser is not compatible with the version of Media Entity installed.)

I tried differend ways to go up from 2.2.0 to 2.2.1 to 2.2.2. I always end up with the same error message:

---------------------- ----------- --------------- --------------------------------------------------- 
  Module                 Update ID   Type            Description                                        
 ---------------------- ----------- --------------- --------------------------------------------------- 
  dropzonejs_eb_widget   8101        hook_update_n   Update configurations for new keys.                
  lightning_media        8018        hook_update_n   Updates the media browser's argument validation.   
  media_entity           8201        hook_update_n   Replace Media Entity with Media.                   
 ---------------------- ----------- --------------- --------------------------------------------------- 

 Do you wish to run the specified pending updates? (yes/no) [yes]:
 > yes

 [notice] Update started: media_entity_update_8201
 [error]  Cannot change the definition of field media_revision.revision_uid: field doesn't exist. 
 [error]  Update failed: media_entity_update_8201 
 [notice] Update started: dropzonejs_eb_widget_update_8101
 [error]  The "media_bundle" entity type does not exist. 
 [error]  Update failed: dropzonejs_eb_widget_update_8101 
 [error]  Update aborted by: media_entity_update_8201, dropzonejs_eb_widget_update_8101 
 [error]  Finished performing updates. 
Ralf Eisler’s picture

I upgraded to 2.2.5, wich solved the issue dropzonejs_eb_widget_update_8101.

But still no solution for the replacement of the Media Entity with Media.

As a result, Media is not activated and Media Entity is not deactivated.

drush updatedb
 [error]  Media Entity Document's functionality has been merged into the core Media module, so it cannot be installed alongside core Media. 

 Requirements check reports errors. Do you wish to continue? (yes/no) [yes]:
 > yes

 ----------------- ----------- --------------- --------------------------------------------------- 
  Module            Update ID   Type            Description                                        
 ----------------- ----------- --------------- --------------------------------------------------- 
  lightning_media   8018        hook_update_n   Updates the media browser's argument validation.   
  media_entity      8201        hook_update_n   Replace Media Entity with Media.                   
 ----------------- ----------- --------------- --------------------------------------------------- 
 Do you wish to run the specified pending updates? (yes/no) [yes]:
 > yes

 [notice] Update started: media_entity_update_8201
 [error]  Cannot change the definition of field media_revision.revision_uid: field doesn't exist. 
 [error]  Update failed: media_entity_update_8201 
 [error]  Update aborted by: media_entity_update_8201 
 [error]  Finished performing updates. 
frederickjh’s picture

Hi @Thomas Factory!

Looking at your shell output above I have to wonder if you have uninstalled the Lightning Workflow module. At the upgrade to 2.2.4 Lightning Workflow will be updated to use core Workflows and Content moderation modules and existing sites will be migrated.

You may need to enable Lightning Workflow do the upgrade, then uninstall it.

One other interesting note that may be related to your missing field that I found in the github release notes under, 2.2.1 to 2.2.2 Manual Update Steps in the following:

Before proceeding, you may wish to verify that Media Entity's upgrade path will work. Media Entity includes a Drush command (compatible with Drush 8.x only at the moment) to do this:

drush media-entity-check-upgrade
This will report any potential errors and allow you to correct them before you run database updates.

Thanks for your help!
Frederick

Ralf Eisler’s picture

Hello @frederickjh

Looking at your shell output above I have to wonder if you have uninstalled the Lightning Workflow module.

In my recent project, I have straight forward editing processes. Therefore, I don’t need Workflows. In my installation, Lightning Workflow is activated, Content Moderation an Workflows are not. As I can recall of my previous shell outputs, the update of Lightning Workflow to Core went smoothly.

Despite of the ongoing problem updating the database, I stepped up to "acquia/lightning": "2.2.7". Then looking to the list of my modules, I noticed, that Media Entity Image was deactivated, but not Media Entity Document. I could however deactivate Media Entity Document and remove the two modules from the modules folder. I have now a functioning website, with working media editing, but I cannot update the database.

drush updatedb


----------------- ----------- --------------- --------------------------------------------------- 
  Module            Update ID   Type            Description                                        
 ----------------- ----------- --------------- --------------------------------------------------- 
  lightning_media   8018        hook_update_n   Updates the media browser's argument validation.   
  media_entity      8201        hook_update_n   Replace Media Entity with Media.                   
 ----------------- ----------- --------------- --------------------------------------------------- 

 Do you wish to run the specified pending updates? (yes/no) [yes]:
 > yes

 [notice] Update started: media_entity_update_8201
 [error]  Cannot change the definition of field media_revision.revision_uid: field doesn't exist. 
 [error]  Update failed: media_entity_update_8201 
 [error]  Update aborted by: media_entity_update_8201 
 [error]  Finished performing updates. 

/update.php

The following updates returned messages:
media_entity module

Update #8201

Failed: Drupal\Core\Database\SchemaObjectDoesNotExistException: Cannot change the definition of field media_revision.revision_uid: field doesn't exist. in Drupal\Core\Database\Driver\mysql\Schema->changeField() (line 577 of /home/nobagnob/www/update.nobag.com/docroot/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php).
drush media-entity-check-upgrade
This will report any potential errors and allow you to correct them before you run database updates.

drush media-entity-check-upgrade

[error] Error: Call to undefined function Drupal\media_entity\Commands\drush_bootstrap_to_phase() in Drupal\media_entity\Commands\DrushCommands->mediaEntityCheckUpgrade() (line 40 of /home/myproject/www/update.myproject.com/docroot/modules/contrib/media_entity/src/Commands/DrushCommands.php)

So I looked for:

/project/media_entity/issues/2925498

Applied patch from this thread and:

drush mecu

 [error]  ✗ Your site did not pass all upgrade checks. You can find more information in the error messages below. 
 [success] Drupal core is the correct version (>= 8.4.0). [8.4.6 detected]
 [success] All provider plugins and modules depending on media_entity are up-to-date.
 [success] The "Media Entity Actions" module is available.
 [warning] Illegal offset type Logger.php:180
 [error]  In order to run the Media Entity 2.x upgrade, please uninstall and remove from the codebase the contributed "Media" module. 

I deactivated Media Entity 2.x and removed it from the modules folder.

drush cr

drush updatedb

----------------- ----------- --------------- --------------------------------------------------- 
  Module            Update ID   Type            Description                                        
 ----------------- ----------- --------------- --------------------------------------------------- 
  lightning_media   8018        hook_update_n   Updates the media browser's argument validation.   
 ----------------- ----------- --------------- --------------------------------------------------- 

 Do you wish to run the specified pending updates? (yes/no) [yes]:
 > yes

 [success] Finished performing updates.

So, success updating the database, finally. I did this on a copy of the project. I will redo the process again from 2.2.0 and will try to go further from 2.2.7 to 3.1.0.

Thank you for you help!

phenaproxima’s picture

Project: Lightning » Lightning Media
Version: 8.x-2.22 » 8.x-2.x-dev
Component: Media » Code
phenaproxima’s picture

Status: Active » Closed (outdated)

This issue has not seen any action in over 3 years, and refers to old versions of modules Lightning Media no longer includes or uses in any way. Therefore, I think it's time to close this out :)