Updates to Booking Entity throws an Entity mismatch is Status page

Created on 9 January 2023, over 1 year ago
Updated 24 March 2023, over 1 year ago

With the most recent update to the Booking Entity changing the base_table definition in the Entity it now says data needs to be migrated. The reason the base_table definition was removed was it was breaking Views relationships between Booking Contacts and Bookings as the data really didn't live in that base_table.

This bug seems like a fake issue Drupal is detecting, but I still want the error message to go away. I'll have to look into what is causing it and write a migration if required.

πŸ› Bug report
Status

Fixed

Version

2.2

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States josh.fabean

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States josh.fabean

    Wow, that was annoying, it was upset about some revisionable stuff on "One Click Booking" and "In Progress Booking" fields on Bookable Calendar. This will be fixed in latest 2.2.x release, and after some testing I'll get that out in a full release soon.

    Just for fun; If you ever have Entity Mismatch issues and using that module that auto updates them isn't an option (like having a contrib module), I think I FINALLY found a way to know why it's so sad.

    Go to: core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php and add extra code and breakpoints in every protected method that checks diffs to find issues.
    For me it was in here

    if (
          $storage_definition->hasCustomStorage() != $original->hasCustomStorage() ||
          $storage_definition->getSchema() != $original->getSchema() ||
          $storage_definition->isRevisionable() != $original->isRevisionable() ||
          $table_mapping->allowsSharedTableStorage($storage_definition) != $table_mapping->allowsSharedTableStorage($original) ||
          $table_mapping->requiresDedicatedTableStorage($storage_definition) != $table_mapping->requiresDedicatedTableStorage($original)
        ) {
          return TRUE;
        }
    

    Then when that was returning true I just ran every if myself to see which one it actually was mad about. Then after that I was able to fix it with a db update like this

    function bookable_calendar_update_8202() {
      $entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
      $field_storage_definition = $entity_definition_update_manager->getFieldStorageDefinition('book_in_progress', 'bookable_calendar');
      $field_storage_definition->setRevisionable(TRUE);
      $entity_definition_update_manager->updateFieldStorageDefinition($field_storage_definition);
    }
    

    That was hours and hours of pain.

  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States josh.fabean
  • Status changed to Fixed over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States josh.fabean
  • Status changed to Fixed over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States josh.fabean
Production build 0.69.0 2024