I'm having trouble upgrading. Here's my flow:

  • installed the flexible_permissions module
  • composer update from Group 1.5 to 2.0
  • run Drush updb

I get this error:

 -------- ----------- --------------- ----------------------------------------- 
  Module   Update ID   Type            Description                              
 -------- ----------- --------------- ----------------------------------------- 
  group    9201        hook_update_n   9201 - Update class name and handler     
                                       class names for group_content_type.      
  group    9202        hook_update_n   9202 - Update class name and handler     
                                       class names for group_content.           
  group    9203        hook_update_n   9203 - Update group_content DB table,    
                                       fields and indexes.                      
  group    9204        hook_update_n   9204 - Remove the 'bypass group access'  
                                       permission from all roles.               
  group    9205        hook_update_n   9205 - Convert group roles with the      
                                       'administer group' permission to admin   
                                       roles.                                   
  group    9206        hook_update_n   9206 - Convert synchronized group roles  
                                       to new scope and target_role structure.  
  group    9207        hook_update_n   9207 - Convert default group roles to    
                                       new scope and target_role structure.     
  group    9208        hook_update_n   9208 - Convert user created group roles  
                                       to new scope and target_role structure.  
  group    9209        hook_update_n   9209 - Remove label and description      
                                       from relationship types.                 
  group    9210        hook_update_n   9210 - Introduce the                     
                                       group_config_wrapper entity type.        
 -------- ----------- --------------- ----------------------------------------- 


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

>  [notice] Update started: group_update_9201
>  [notice] Update completed: group_update_9201
>  [notice] Update started: group_update_9202
>  [notice] Update completed: group_update_9202
>  [notice] Update started: group_update_9203
>  [error]  Exception thrown while performing a schema update. Cannot rename 'tmp_8e7702group_relationship' to 'group_relationship': table 'group_relationship' already exists. 
>  [error]  Update failed: group_update_9203 
 [error]  Update aborted by: group_update_9203 
 [error]  Finished performing updates. 

I tried restoring my prod database to my dev environment and I still get the same error. I've never had Group 2.0 on my prod env. Why would the table already exist?

Comments

markdc created an issue. See original summary.

kristiaanvandeneynde’s picture

Category: Bug report » Support request

No clue, but try deleting it and then start over. You should still have a group_content table, is that the case?

SalvadorP’s picture

Hello,

Same problem with the drupal 9.5 I'm working with, we are using the group version 1.5 and when trying to upgrade to 2.1 we receive a similar error.

Also gives a different one, complaining about that the "entity:group_content_type" plugin does not exist.

Here is the log:

  group    9203        hook_update_n   9203 - Update group_content DB table, fields and indexes.
  group    9204        hook_update_n   9204 - Remove the 'bypass group access' permission from all roles.
  group    9205        hook_update_n   9205 - Convert group roles with the 'administer group' permission to admin roles.
  group    9206        hook_update_n   9206 - Convert synchronized group roles to new scope and target_role structure.
  group    9207        hook_update_n   9207 - Convert default group roles to new scope and target_role structure.
  group    9208        hook_update_n   9208 - Convert user created group roles to new scope and target_role structure.
  group    9209        hook_update_n   9209 - Remove label and description from relationship types.
  group    9210        hook_update_n   9210 - Introduce the group_config_wrapper entity type.
 -------- ----------- --------------- -----------------------------------------


 // Do you wish to run the specified pending updates?: yes.

>  [notice] Update started: group_update_9203
>  [error]  Exception thrown while performing a schema update. Cannot rename 'tmp_9ac9a9group_relationship' to 'group_relationship': table 'group_relationship' already exists.
>  [error]  Update failed: group_update_9203
>
> In DiscoveryTrait.php line 53:
>
>   The "entity:group_content_type" plugin does not exist. Valid plugin IDs for
>    Drupal\rest\Plugin\Type\ResourcePluginManager are: dblog, file:upload, ent
>   ity:block, entity:block_content, entity:block_content_type, entity:comment_
>   type, entity:comment, entity:consumer, entity:contact_message, entity:conta
>   ct_form, entity:editor, entity:print_engine, entity:feeds_feed, entity:feed
>   s_subscription, entity:feeds_feed_type, entity:field_config, entity:field_s
>   torage_config, entity:file, entity:filter_format, entity:group, entity:grou
>   p_content, entity:group_type, entity:group_config_wrapper, entity:group_rol
>   e, entity:image_style, entity:key, entity:key_config_override, entity:confi
>   gurable_language, entity:language_content_settings, entity:media, entity:me
>   dia_type, entity:node_type, entity:node, entity:openid_connect_client, enti
>   ty:paragraphs_type, entity:paragraph, entity:paragraphs_library_item, entit
>   y:path_alias, entity:responsive_image_style, entity:rest_resource_config, e
>   ntity:search_page, entity:shortcut, entity:shortcut_set, entity:menu, entit
>   y:action, entity:taxonomy_vocabulary, entity:taxonomy_term, entity:tour, en
>   tity:user_role, entity:user, entity:workflow, entity:menu_link_content, ent
>   ity:pathauto_pattern, entity:view, entity:date_format, entity:base_field_ov
>   erride, entity:entity_view_display, entity:entity_form_display, entity:enti
>   ty_view_mode, entity:entity_form_mode, user_registration
>
>

In ProcessBase.php line 155:

  Output is empty.

The 9200, 9201 and 9202 were run previously, with no errors, I was going step by step trying to catch were it fails, and it's on the 9203 update step.

At first I thought it was some problem with the dev database so I used a clean copy of other environment but with no luck.

Then I tried to restore the database, erase all the code and redownload it with composer.
Restored the database, checked that the group_relationship table does not exists, then dropped the temporary tables, clear the cache tables and then run the drush updb, and got the same error.

I'm searching for a solution or a way to upgrade to v2, but with no luck for now.
Has this or anything similar happened to you?

DaleTrexel’s picture

@markdc @SalvadorP (or anyone else coming to this issue with the same problem):

One thing that can trip people up (including myself!) is that restoring a database from backup may leave bits of the previous database hanging around, depending on the tools you use.

Reading a database backup from a mysql dump will normally drop individual tables before restoring the from the backup, but tables not in the backup won't be touched. So, if you're iterating through the Group upgrade process and got past the point where the update creates a new table in the database, that table will remain if you don't clear out the entire database (or at least that new table) before re-importing from a previous backup for your next round of testing.

For example, if you're used to using drush sql:dump to generate backups, and something like drush sql:cli < backupFile.sql to re-import a previous backup, this could leave newly-generated tables in the database to confuse you.

Drush has a handy drush sql:drop command to drop and re-create the database, clearing out ALL tables, before you import a backup. Some local development tools like DDEV also have database import tools that clear out old tables before importing a backup, without having to do a two-step process (like you have to do with drush).

If you're still seeing table-already-exists errors after adding this step to your restore process (and you're sure the table hasn't snuck into your backup from a previous upgrade attempt!), then feel free to update here. I've been working on Group 1.5 to 2.x upgrades pretty heavily and the only times I've seen this error it has been my own fault. But that doesn't mean there isn't a real problem for certain scenarios.

SalvadorP’s picture

@DaleTrexel, thank you very much for the information and the heads up on leftover tables.

Restored a backup from other environment and used drush sql:drop to make sure that only the proper tables were imported and after the DB restore all the updates worked!

The downside of this is that I'm still getting the error "entity:group_content_type".
I'm investigating if it's something related to my drupal installation or a content type issue, not sure.

Did you ever see that error on your upgrades?

Here is the output of the ./drush updb after upgrading to groups v2:

./drush updb -y
 -------- ----------- --------------- -----------------------------------------
  Module   Update ID   Type            Description
 -------- ----------- --------------- -----------------------------------------
  group    9200        hook_update_n   9200 - Install required
                                       flexible_permissions contrib module.
  group    9201        hook_update_n   9201 - Update class name and handler
                                       class names for group_content_type.
  group    9202        hook_update_n   9202 - Update class name and handler
                                       class names for group_content.
  group    9203        hook_update_n   9203 - Update group_content DB table,
                                       fields and indexes.
  group    9204        hook_update_n   9204 - Remove the 'bypass group access'
                                       permission from all roles.
  group    9205        hook_update_n   9205 - Convert group roles with the
                                       'administer group' permission to admin
                                       roles.
  group    9206        hook_update_n   9206 - Convert synchronized group roles
                                       to new scope and target_role structure.
  group    9207        hook_update_n   9207 - Convert default group roles to
                                       new scope and target_role structure.
  group    9208        hook_update_n   9208 - Convert user created group roles
                                       to new scope and target_role structure.
  group    9209        hook_update_n   9209 - Remove label and description
                                       from relationship types.
  group    9210        hook_update_n   9210 - Introduce the
                                       group_config_wrapper entity type.
 -------- ----------- --------------- -----------------------------------------


 // Do you wish to run the specified pending updates?: yes.

>  [notice] Update started: group_update_9200
>  [notice] Update completed: group_update_9200
>  [notice] Update started: group_update_9201
>  [notice] Update completed: group_update_9201
>  [notice] Update started: group_update_9202
>  [notice] Update completed: group_update_9202
>  [notice] Update started: group_update_9203
>  [notice] Update completed: group_update_9203
>  [notice] Update started: group_update_9204
>  [notice] Update completed: group_update_9204
>  [notice] Update started: group_update_9205
>  [notice] Update completed: group_update_9205
>  [notice] Update started: group_update_9206
>  [notice] Update completed: group_update_9206
>  [notice] Update started: group_update_9207
>  [notice] Update completed: group_update_9207
>  [notice] Update started: group_update_9208
>  [notice] Update completed: group_update_9208
>  [notice] Update started: group_update_9209
>  [notice] Update completed: group_update_9209
>  [notice] Update started: group_update_9210
>  [notice] Update completed: group_update_9210
>
> In DiscoveryTrait.php line 53:
>
>   The "entity:group_content_type" plugin does not exist. Valid plugin IDs for
>    Drupal\rest\Plugin\Type\ResourcePluginManager are: dblog, file:upload, ent
>   ity:block, entity:block_content, entity:block_content_type, entity:comment_
>   type, entity:comment, entity:consumer, entity:contact_message, entity:conta
>   ct_form, entity:editor, entity:print_engine, entity:feeds_feed, entity:feed
>   s_subscription, entity:feeds_feed_type, entity:field_config, entity:field_s
>   torage_config, entity:file, entity:filter_format, entity:group, entity:grou
>   p_content, entity:group_type, entity:group_config_wrapper, entity:group_rol
>   e, entity:image_style, entity:key, entity:key_config_override, entity:confi
>   gurable_language, entity:language_content_settings, entity:media, entity:me
>   dia_type, entity:node_type, entity:node, entity:openid_connect_client, enti
>   ty:paragraphs_type, entity:paragraph, entity:paragraphs_library_item, entit
>   y:path_alias, entity:responsive_image_style, entity:rest_resource_config, e
>   ntity:search_page, entity:shortcut, entity:shortcut_set, entity:menu, entit
>   y:action, entity:taxonomy_vocabulary, entity:taxonomy_term, entity:tour, en
>   tity:user_role, entity:user, entity:workflow, entity:menu_link_content, ent
>   ity:pathauto_pattern, entity:view, entity:date_format, entity:base_field_ov
>   erride, entity:entity_view_display, entity:entity_form_display, entity:enti
>   ty_view_mode, entity:entity_form_mode, patrolplan_resource, user_registrati
>   on
>
>

In ProcessBase.php line 155:

  Output is empty.

SalvadorP’s picture

Finally could update, the problem I had with the "entity:group_content_type", was related to an old REST Resource configuration.
After removing that I could finishe the upgrade/migration from 1.5 to 2.1 without errors.

markdc’s picture

@DaleTrexel
Thank you. You were exactly right about the database tables. Doing a clean import after drop allowed everything to update.

kristiaanvandeneynde’s picture

Status: Active » Fixed

Cool, marking as resolved then.

vasanthakumar23’s picture

Title: table 'group_relationship' already exists » The "entity:group_content" plugin does not exist. Valid plugin IDs
Version: 2.0.0 » 3.2.0
Status: Fixed » Active
Issue tags: +the
kristiaanvandeneynde’s picture

Title: The "entity:group_content" plugin does not exist. Valid plugin IDs » table 'group_relationship' already exists
Version: 3.2.0 » 2.0.0
Status: Active » Fixed
Issue tags: -the

Please don't do this, open a new issue if you have one.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.