Config import fails when importing multiple entity_type_behaviors

Created on 14 September 2023, about 1 year ago
Updated 19 September 2023, about 1 year ago

Problem/Motivation

When I run drush cim and have multiple entity_type_behaviors to import I get the following error.

In SqlContentEntityStorage.php line 1594:
                                                                                                                              
  Exception thrown while performing a schema update. Cannot rename 'node' to 'old_2ece08node': table 'old_2ece08node' already exists.                                                                                                                   
                                                                                                                              

In Schema.php line 376:
                                                                                    
  Cannot rename 'node' to 'old_2ece08node': table 'old_2ece08node' already exists. 

Steps to reproduce

0. Dump you DB
1. Add entity_type_behaviors on multiple entity types with content.
2. Export config
3. Import your DB-Dump
4. Run drush cim

Proposed resolution

Fix configStepOperation

🐛 Bug report
Status

RTBC

Version

2.1

Component

Code

Created by

🇩🇪Germany Harlor Berlin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Harlor
  • Status changed to Needs review about 1 year ago
  • 🇩🇪Germany Harlor Berlin

    I'm not sure if one should use the same sandbox parameter for all entity types. Using a different sandbox parameter seems to fix the issue: https://git.drupalcode.org/issue/entity_type_behaviors-3387281/-/commit/...

  • Status changed to Closed: works as designed about 1 year ago
  • 🇩🇪Germany Harlor Berlin

    Sorry it seems the issue was caused by a config for an entity type that does not have bundles. Which is not supported - or is it?

  • Status changed to Active about 1 year ago
  • 🇩🇪Germany Hydra

    I could reproduce this issue in a vainlla D10 setup, activating entity_type_behaviors for nodes and terms and importing them at the same time in an other environment via drush config-import.

    Your patch seems to solve this issue. Of course it would be nice to have some kind of UI integration for entity_types without bundles, but the default issue here is kinda critical and makes this module unusable.

  • @harlor opened merge request.
  • Status changed to Needs review about 1 year ago
  • 🇩🇪Germany Hydra

    Alright, the patch looked good to me. I added some tests to make sure it won't fail again.
    Since there are no tests activated on the project, we don't see anything :( But I could reproduce the described error message with the test, and the commit from @Harlor did indeed fix it.

    Maybe @Harlor Could give me a quick review on the test before setting this to RTBC.

  • Status changed to RTBC about 1 year ago
  • 🇩🇪Germany Harlor Berlin

    LGTM

Production build 0.71.5 2024